Alex
Alex

Reputation: 1641

Share widget-width across different widgets in gtk3 via css

I have different sub-elements in a GtkBox, the first item always is a GtkLabel which should show the line-number. ( Each element of the GtkBox shows a line of a file )

Now I want to make sure that the width of the GtkLabel always is the maximum used width across all GtkLabel's in the GtkBox. I already implemented that in C-code, however I wonder if it is as well possible to do so by using css ... probably that would be more elegant.

For gtkBoxes the css-attribute "min‑width" is available ... but I dont want to set a fixed value, I want to set the maximum width of all objects which are in the css-class.

I have no idea how/if that is possible. Is there some way to express that in css ?

Upvotes: 0

Views: 89

Answers (1)

ebassi
ebassi

Reputation: 8815

No, you cannot define this behaviour in CSS.

You should use a GtkSizeGroup with a GTK_SIZE_GROUP_HORIZONTAL mode, instead; you can also define size groups inside your GtkBuilder XML files, if you want to avoid having this relationship inside the source code.

Upvotes: 1

Related Questions