Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a GUI with GTK in C, is everything possible with the basics Widgets ? Or should I build a custom one?

Tags:

c

gtk

First, I'm totally new to GTK and would not consider myself very experienced with C.

I'm currently working on a project where I have to build a GTK GUI in C. I've started tinkering around with the GTK library, but it seems I can't find Widgets that would match the exact look of the UI I have to produce, especially while building the layout with existing Widgets.

Since I'm not very familiar with GTK, I was wondering if maybe I should build my own widget for what I would like to do? I've added an image of the render I would like to achieve:

render

Is it possible to achieve this look without building a custom widget?

Are there libraries that exists on top of GTK with more Widgets available that would help me with this?

Thank you.

like image 719
Matthis Avatar asked Sep 07 '25 22:09

Matthis


1 Answers

Almost all of what you've got there can be done with the built-in widgets, except maybe the phone icon's offset from the top of that container. You should use built-in widgets whenever possible.

What you really need is CSS styling. This will allow you to customize the look of existing widgets. You can style all of a particular type of widget, or you can add classes to individual widgets in your UI file and apply styles to those.

For example, you might want to add a notification-row class with some CSS like:

.notification-row {
  background-color: grey;
  border-radius: 6px;
}

Here's a list of available CSS properties.

To add a CSS file to your program, add it to your .gresources.xml file, then follow the instructions in the description of GtkCssProvider.

like image 198
James Westman Avatar answered Sep 10 '25 00:09

James Westman