[Glade-users] extend Drawing Area class



IIRC, with glade-2 or the original glade; you would treat this as
a "custom widget", you'd add it to your project and use a few generic
parameters (int 1, int 2, string 1, string 2) and a "create function"
to be looked up in the program by libglade.

I always used "string 1" to be the name of an xml file that I would
parse in my create_function() (but that's unimportant).

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
http://developer.gnome.org/doc/API/2.0/gtk/GtkDrawingArea.html)

Note also that GtkDrawingArea is just a simple GtkWidget with its
own GdkWindow, the DrawingArea does *not* implement any "draw_line"
method or whatnot; it is the responsability of the DrawingArea user
to trap the "expose-event" signal and draw to GTK_WIDGET (darea)->window
using the GdkDrawable API.

http://developer.gnome.org/doc/API/2.0/gdk/gdk-Drawing-Primitives.html

Oops. Yeah, that's what I meant. I think gtkmm is done up in such a
way that you can use drawable->drawing_primative_function(); as if it
is an actual member. It's been a few weeks since I last worked on
this, so I forget what I've aready tried.

 - Jeff




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