GtkEtext overview and: GTK_WIDGET_SET_FLAGS inheritance?
- From: Derek Simkowiak <dereks kd-dev com>
- To: GTK List <gtk-list redhat com>
- Subject: GtkEtext overview and: GTK_WIDGET_SET_FLAGS inheritance?
- Date: Mon, 3 Apr 2000 12:14:00 -0700 (PDT)
Hello,
I'm writing a new text widget.
I'm creating two GtkObjects: one is a windowless buffer, called
GtkEtextBuffer, and one is a view, called GtkEtextView.
These are both children of a GtkEditable. The hierarchy looks
like this:
GtkEditable
|
+-- GtkEtextBuffer
|
+-- GtkEtextView
GtkEtextBuffer is a windowless widget. It lets you insert text,
delete text, cut, copy, etc. by overriding the GtkEditable's virtual
functions, but does not actually display anything.
The GtkEtextView does everything the GtkEtextBuffer does, *plus*
it has functions which affect display and input (such setting the cursor
image, setting the cursor blink rate, whether or not line numbers are
displayed, etc.)
I want multiple views, so one member of the GtkEtextView will be a
pointer to a GtkEtextBuffer. That is, every GtkEtextView will be
associated with a GtkEtextBuffer, and a GtkEtextBuffer can have several
GtkEtextViews displaying it. The GtkEtextView will attach signal handlers
to the pointed-to GtkEtextBuffer's signals in order to correctly update
the display for that particular buffer. Then, to have multiple views with
the widget, the user can simply have several GtkEtextViews point to the
same GtkEtextBuffer.
In the implementation, the GtkEtextView widget instance struct
will have a pointer to a GtkEtextBuffer. Then, any insertions or
deletions you do to that GtkEtextView will simply be done on the
corresponding GtkEtextBuffer.
This is a little strange, because one member of the child class
will be a (pointer to an) instance of the parent class. But I can't find
anything wrong with it, and a post to gtk-devel-list offered no other
suggestions. It seems logical since I want the user to be able to do
insertions/deletions to the GtkEtextView, but still have the ability to
handle multiple views.
Now, on to my question: The _init for GtkEtextBuffer has this:
GTK_WIDGET_SET_FLAGS (etext_buffer, GTK_NO_WINDOW);
Will this "GTK_NO_WINDOW" flag be inherited by the child
GtkEtextView? If so, is there a "GTK_HAS_WINDOW" or equivalent to
override the GTK_NO_WINDOW flag?
From looking at gtkwidget.h, there is no way to override the flag,
and I'm guessing that flag is inherited (is it?). Thus, it seems
impossible to have a window-using child from a GTK_NO_WINDOW parent. Am I
screwed?
What about doing
GTK_WIDGET_FLAGS (etext_view) &= ~GTK_NO_WINDOW;
...in my init function? Will this break the GtkObject system?
Thanks,
Derek Simkowiak
dereks@kd-dev.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]