Re: Gtk::Style paint_box() cannot be used fully



Philip Boulain wrote:
> Paul Pogonyshev wrote:
> > As an ugly workaround, try passing `*static_cast <const 
> > Gdk::Rectangle*> (0)' as a parameter.
>
> That causes me a lovely segfault. ;)

Well, that was untested and might have caused a segfault, right :)

> I actually converted this (inside a Gtk::Widget subclass' on_expose_event() method):
> 
> get_style()->paint_box(gdk_window, get_state(), Gtk::SHADOW_IN, 0, *this, 0,
>     0, 0, get_allocation().get_width(), get_allocation().get_height());
> 
> To this:
> 
> gtk_paint_box(get_style()->gobj(), gdk_window->gobj(), (GtkStateType) 
> get_state(), GTK_SHADOW_IN, NULL, this->gobj(), NULL,
>     0, 0, get_allocation().get_width(), get_allocation().get_height());
> 
> Which makes the (hopefully safe) assumption that the Gtk::StateType and 
> GtkStateType enumerations use the same values. And thanks to whichever 
> GTKmm developer had the sense to realise that being able to access the C 
> data structures being wrapped would be useful. :)

If there is no gobj() method it must be the same as C enum, I think.
But I have made one mistake already :)

Paul



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