Re: [gtk-list] Re: GtkEtext overview and: GTK_WIDGET_SET_FLAGSinheritance?



> >	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.

> If you're trying to implement MVC, then having View inherit from Model
> is the wrong approach. Views and Models and Controllers have no
> inheritance relationship.

	I will get the "Design Patterns" book.  Thanks for the reference.

	The reason I had the View inherit from the Model was that I didn't
want the user to be forced into two separate widgets for a simple text
display.  I.e., I wanted the "view" to be equivalent to the current
GtkText, which has both view and data.  I guess that is a mistake.

	I *did* want to inherit from the GtkEditable, because it has the
clipboard functions, relevant signals, and correct bindings for a text
widget.  

	However, the bindings are part of a View, and the signals
(insert_text, changed, etc.) are part of a Model (I'm assuming that a
Model is the data).  In essence, I'm trying to inherit from the
GtkEditable with appearantly does not support MVC (?).

	Perhaps I should have the following?

GtkEditable
  |
  +--  GtkEtextBuffer
  |
  +--  GtkEtextView

	...where the data (Model?) and View are peers to one-another.
Then, my GtkEtextBuffer will override the GtkEditable's data-handling
signals and functions (insert_text, delete_text, changed, plus add the
necessary functions for changing the font and style of the text) and the
GtkView will override the viewing functions (_realize, _expose, etc.) plus
all the view-specific API functions, for things like setting the cursor
blink rate and whether or not line numbers are displayed.

	Does this make more sense?  Of course, it will be more difficult
than using GtkText because now the user needs to create a GtkEtextBuffer
*and* a GtkEtextView, and then "attach" that GtkEtextView to the
GtkEtextBuffer...which is why I wanted the View to inherit from the
buffer.

	I would sincerely appreciate some help with this.


Thanks,
Derek Simkowiak
dereks@kd-dev.com



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