[Glade-users] extend Drawing Area class

Jeff Simpson wrote:
That sounds about right. I have the custom widget in the project that
seems to be compiling correctly. The only part that I don't have
working is the basing of this custom class on the Drawing Area object.

For example, I have a class called "Scope", which should be based on
drawing area:

Scope::Scope() : Gtk::DrawingArea()

However, in a bit of example code, I get an error that Scope doesn't
have the window member that it should have (if it has inherited it
from DrawingArea):

Scope.cc:41: `class Scope' has no member named `window'

(from within the Scope member function, I was trying to access
this->window similar to the example on

    maybe you should check this out with the gtkmm people; I dont
know if there is a list, optionaly; you might want to ask about
this on gtk-app-devel-list gnome org.

I'm not sure how gtkmm handles casting; in the above example
(in the api docs) it simply says "widget->window", this only
works because widget is a "GtkWidget *" (or a GtkDrawingArea
which was /cast/ to a GtkWidget).

What happens in c++ when a parent class has a class member
with the same name as a class member in a child implementation
of the said class ? does it not compile ?

With GObject, it is perfectly OK for a `struct _GtkWidget' to have
a `->window' member and a child implementation to also have a
`->window' member; although these wouldn't be the same element at
i.e. GTK_WIDGET (darea)->window != GTK_DRAWINGAREA (darea)->window.


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