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



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

LionsPhil




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