Re: problems subclassing Gtk::Notebook



Akos Maroy wrote:
Hi,

I'm trying to create a custom implementation of Gtk::Notebook, and I'm having great difficulties.

for one, I wanted to catch the event of a new page added to the Notebook object. but there's no such event handler. so I considered overriding all the zillion prepend_page(), insert_page(), etc. functions. but none of them are declared as virtual, so there's no use in doing so.

as a workaround, I added a function that would create my own representation of the pages, that could be called explicitly. that seemed to be OK, but no matter what I do, the widget is rendered as the stock Gtk::Notebook widget. even if I override the on_realize(), on_expose_event(), on_map(), etc. functions. what is even more interesting, is that if I override all these, and call explicitly Gtk::Container::on_realize(), etc. from them, rendering is still done as the stock Gtk::Notebook does.

this seems very weird to me, and goes contrary to my C++ knowledge. how come that Gtk::Notebook::on_realize() can be called, if I explicitly call Gtk::Container::on_realize() myself?

or is it so, that Gtk::Container::on_realize() and the like check what kind of object this is, and execute code accordingly? well, that it's quite contrary to generic object inheritance logic...



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

Hey Akos,

I have never tried to customize the containers that the notebook class uses to display its pages, so I am not sure that this will even be relevant:  When you override the various virtual functions like "on_realize" what boolean value are you returning?  If I understand the documentation properly, you should return false if you have not handled the event and want the standard ancestor class implementation to be called or your version of the function should return true if it has handled the event and you do not want the ancestor class implementation to be called.

If you are already doing this, please forgive my suggestion.

--

Robert L Caryl Jr
Fiscal Systems, Inc.
256-772-8920 Ext. 108


This email message may contain privileged or confidential information. If you are not the recipient, you may not disclose, use, disseminate, distribute, copy or rely on this message or attachment in any way. If you received this email message in error, please return by forwarding the message and its attachment to the sender and then delete the message and its attachment from your computer. Fiscal Systems, Inc. and its affiliates do not accept liability for any errors, omissions, corruption or virus in the contents of this message or any attachments that arise as a result of e-mail transmission.



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