Connecting DrawingArea signal w/ gtkmm 3



I have a gtkmm app (gui built with glade). It has several buttons, and one
DrawingArea widget.

I use the builder's "create_from_file" to load the gui, get pointers to the
widgets, and then (try to) connect signals through
widget->signal_xxx().connect(). This works fine for the buttons, but I
can't get it to work for the DrawingArea.

For the buttons:

p_builder->get_widget("button_x", p_button);
p_button->signal_clicked().connect( sigc::bind<int>(sigc::mem_fun(*this,
&CMy_GUI::on_button_pressed), x));

where:
   x - specifies a particular button, and - as an int - is passed to the
signal handler (CMy_GUI::on_button_pressed);

As I said, for the buttons, this works great.

But I can't seem to get the right syntax for the DrawingArea widgets
signal_draw().connect(). I am guessing this has to do with the
Cairo::Context argument being passed to the callback.

(FWIW: for this case, I don't need to pass any additional parameters, as
with the buttons. )

I thought of trying to use a derived class, and overload the virtual
callback function (on_draw() ), but I don't see how to connect that with
the widget created by the builder (loaded from the glade file).

Any help greatly appreciated.

TIA

ken


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