Can't set custom GtkWidget style property in gtkrc
- From: Stefan WEBER <stefan weber wanadoo fr>
- To: gtk-app-devel-list gnome org
- Subject: Can't set custom GtkWidget style property in gtkrc
- Date: Mon, 7 Jul 2008 12:36:03 +0200 (CEST)
Hi all,
I wish to add a style property to GtkWidget in order to retrieve it in several derived gtkmm-classes.
In main() I do the following:
gpointer p = gtk_type_class(GTK_TYPE_WIDGET);
gtk_widget_class_install_style_property (GTK_WIDGET_CLASS(p),
g_param_spec_int ("my-custom-int",
"my int",
"my custom integer",
0,
G_MAXINT,
8,
(GParamFlags)G_PARAM_READWRITE /*was READABLE,
but doesn't change anything*/));
gtk_rc_parse("./gtk-2.0/gtkrc");
In gtkrc:
style "default"
{
# colors to verify that the style is applied
fg[NORMAL] = "#FF0000"
text[NORMAL] = "#FF0000"
GtkWidget::my-custom-int=4
}
class "*" style "default"
Example of derived classes:
class MySpinButton:public Gtk::SpinButton
{
...
}
MySpinButton::MySpinButton(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade)
:Gtk::SpinButton(cobject)
{
Glib::Value<int> my_int;
my_int.init(G_TYPE_INT);
get_style_property_value("my-custom-int",my_int);
cout << "my_int = " << my_int.get() << endl;
}
The output is "my_int = 8", not 4, so I get the property, which proves to me that it is not a GTKMM-Problem,
but I can't set its value in gtkrc.
So, what is wrong with this? Any ideas?
Thanks in advance,
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]