Re: signal connect on class member objects



Antonio Coralles wrote:
Rob Benton wrote:

I want to create a class that is a Gtk::EventBox with a Gtk::DrawingArea
inside.  But I also want to connect extra methods of this class to the
drawingarea's realize and expose_event signals.  Is this possible or do
I need to create a derived class of Gtk::DrawingArea and then use that
as a member object?
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org <mailto:gtkmm-list gnome org>
http://mail.gnome.org/mailman/listinfo/gtkmm-list


as far as i know your drawing area will look pretty boring if you don't overide at least on_realize and on_expose_event ...; so i would suggest to derive your own drawing area (maybe you should take a look at http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch14.html) and then put an instance of that class in your specal eventbox.

what i don't understand: for what reason do you want to call on_realize() manually (it is called atomatically for you ...) ?

antonio
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



I was looking at the Gtk::DrawingArea example in the 2.4 docs. In there they create a class derived of a drawing area and then overload the on_realize() method like this:

DerivedDrawing::on_realize()
{
	Gtk::DrawingArea::on_realize();
	// other code
}

But if I just use a Gtk::DrawingArea and then connect the signal_realize() to my function, the original Gtk::DrawingArea::on_realize() will get called before my function. Won't it?



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