Editable object hierarchy




	I'm working on a new text widget (called GtkEtext).

	I think Havoc's idea of having the text data buffer be a separate
GtkObject from the display widget is a great idea.  It makes multiple
views possible and easy.

	Havoc has his FrooTkxt buffer as a simple GtkObject.  He
has the signals "insert_text", "delete_text", "changed", and the functions
"_insert", "_delete", "_get_chars", and then some stuff more specific to
his type of buffer (stuff to do with an "Index", and "Tags", and such).

	I was thinking that those signals and functions look a lot like a
GtkEditable, so I'm considering the following:

GtkEditable
  |
  +-- GtkEtextBuffer
        |
        +-- GtkEtextView


	So my windowless "GtkEtextBuffer" would get the normal GtkEditable
signals and functions, plus the ones I add for dealing with fonts/styles,
and my "GtkEtextView" (the actual widget that shows the text) would
inherit all that *plus* functions necessary for the view only (such as
whether or not to show line numbers, the blink rate for the cursor, etc.)

	Every GtkEtextView instance will need a pointer to a
GtkEtextBuffer (so it knows what text to display), and any GtkEtextBuffer
calls that you do to a GtkEtextView would simply apply those calls to the
pointed-to GtkEtextBuffer member.

	The reason this seems strange to me is that an instance of the
parent class is a member of child class.  Is that a problem?  Does it
indicate poor design?


Thanks,
Derek Simkowiak
dereks@kd-dev.com



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