Re: Issue using the "gtk_widget_get_allocated_height" instruction



Hi Sébastien!
It's not simple, but you may try with combinations of

GtkStyleContext *style = gtk_widget_get_style_context(widget);
GValue value = G_VALUE_INIT;
gtk_style_context_get_style_property(style, "prop-name", &value);
//or
gtk_style_context_get_property(style, "prop-name", &value);
/*
...
*/
g_value_unset(&value) //free memory

Unfortunately, that's all I can say, I'm not expert in this area.
Probably it's going to be rather complicated.

Luca

Il giorno lun 26 nov 2018 alle ore 16:34 Sébastien Le Roux <
sebastien leroux ipcms unistra fr> ha scritto:

Le 24/11/2018 à 15:59, Luca Bacci a écrit :

Probably it's a consequence of this work for porting GtkMenuBar to use css
gadgets internally:
https://gitlab.gnome.org/GNOME/gtk/commit/700286c6

You should be able to get the appropriate size if you add menu items to
the bar, i.e. as long as the
menubar is not empty you get the appropriate height with
gtk_widget_get_allocated_height().

Luca

Thank you very much for your reply, it works nicely with the "invisible"
item.

I do have in my code objects (GtkColorBar, GtkButtton) for which I created
css
properties my self to match some specifics using:


void provide_gtk_css (gchar * css)
{
  GtkCssProvider * provider = gtk_css_provider_new ();
  gtk_css_provider_load_from_data (provider, css, -1, NULL);
  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
                                             GTK_STYLE_PROVIDER(provider),
                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
  g_object_unref (provider);
}


About what I understand this is now automatic (somewhat) for many (all ?)
widgets,

Out of curiosity do you think that there is anyway to get that heigh value
from
a query to the css properties of that menu bar ? is there anyway to send
query to the css ?


Best


Sébastien

--
===========================================================
Dr. Sébastien Le Roux
Ingénieur de Recherche CNRS
Institut de Physique et Chimie des Matériaux de Strasbourg
Département des Matériaux Organiques
23, rue du Loess
BP 43
F-67034 Strasbourg Cedex 2, France
E-mail: sebastien leroux ipcms unistra fr
Webpage: http://www-ipcms.u-strasbg.fr/spip.php?article1771
RINGS project: http://rings-code.sourceforge.net/
ISAACS project: http://isaacs.sourceforge.net/
Fax:   +33 3 88 10 72 46
Phone: +33 3 88 10 71 62
===========================================================




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]