Gtk::Style usage help needed



Hi all:

Reading documentation I think I've understood that if I want to define the
style of a widget I have to inherit from the Gtk::Style class and overload
the provided virtual functions. But this simple example code fails with the
following errors:

(a.out:17921): Pango-CRITICAL **: pango_layout_get_pixel_extents: assertion
`PANGO_IS_LAYOUT (layout)' failed

(a.out:17921): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion
`G_IS_OBJECT (object)' failed

(a.out:17921): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion
`G_IS_OBJECT (object)' failed
Segmentation fault

Here is the code:

#include <gtkmm.h>

class mystyle : public Gtk::Style
{
  public:
     mystyle() : Gtk::Style()
     {
     }

     ~mystyle()
     {
     }
};

int main (int argc, char **argv)
{
	Gtk::Main mainkit(argc, argv);

	Gtk::Window window;
	Gtk::Label label("test");
	mystyle style;

	label.set_style(Glib::RefPtr <Gtk::Style> (&style));

	window.resize(400,100);
	window.add(label);
	window.show_all();
	mainkit.run(window);

	return 0;
}

What is the proper way of doing this?

Thanks
-- 
View this message in context: http://old.nabble.com/Gtk%3A%3AStyle-usage-help-needed-tp30079646p30079646.html
Sent from the Gtkmm mailing list archive at Nabble.com.



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