Re: Override default screen_changed Window function ?



On Mon, 2007-02-26 at 20:50 -0800, k0001 wrote:
> Hi! Yesterday i started with C++, and today I'm into GTKMM. I came from
> Python and PyGTK. =)
> 
> well what i'm trying to do... (becouse i need to...) is overriding the
> default screen_changed window function, but the problem is that i can't find
> how to do it. so, bassicaly, this here is the "python way" which worked for
> me:
> 
> First i defined a method inside my widget class which inherited from
> gtk.DrawingArea for this particular case. (Gtk::DrawingArea in C++)
> 
> class MyWidget(gtk.DrawingArea):
>     def screen_changed(self, widget, old_screen=None):
>         ... whatever you want to do goes here....
>     ..(rest of the class)...
> 
> after having that done. in main() method, i create the window and the widget
> and everything else, and before showing the window, this is what i wrote:
> 
>     # Override default screen-changed Window function.
>        window.connect("screen-changed", mywidget.screen_changed)
>        mywidget.screen_changed(window)
> 
> and that worked like a charm!!!! but i want to do that in C++, then.... how
> should i do that? please,, i can't find how to in the reference.

You should just be able to override the on_screen_changed method:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Widget.html#bf2193e450620fde4457b2c062fc63cb

Here is more information about overriding default signal handlers:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/apbs04.html

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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