Re: Gtk::Style usage help needed
- From: José Alburquerque <jaalburquerque cox net>
- To: siagogam <siagogam terra es>
- Cc: gtkmm-list gnome org
- Subject: Re: Gtk::Style usage help needed
- Date: Thu, 28 Oct 2010 17:44:19 -0400
On Thu, 2010-10-28 at 14:24 -0700, siagogam wrote:
> 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?
Using Gtk::Style::create() is probably the best way to get a Gtk::Style.
>
> Thanks
--
José
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]