combo box: entry as a container?




Hello Peter, hello gtk people,

today I tried to build a combo box widget for gtk+.
You surely know this kind of widget, it's an
entry widget with a button on the right side
that pops up a history when clicked. combo boxes
are used as history list in search dialogs, in netscape 4's
url field and as small font selector in ms 
word 95's main window (actually it has a lot more combo's),
to name a few.

I ran into a problem:

My approach is to build a composite widget out of an entry,
a button, a popup window, a scrolled window and a list widget.
I want entry class to be the parent class, because this
will make it easier to exchange entries in existing software
by a combo box.

Here is the problem: the button has to have a parent - a container.
And an entry is not a container.

Of course I could make combo box a descendant of container (or hbox),
but then one couldn't use the calls of entry class to manipulate it.
Which would be most comfortable and intuitive.

The same problem occurs if somebody tries to build a spinner
widget (an entry with two small up/down buttons to the right to 
select ordered values like numbers or weekdays).

Maybe entry could become a container widget? This may sound bizarre,
but button is a container allready. 

Another option would be to allow every to be a container,
as it is the case in the Qt widget set. One would simply merge
the methods of GtkContainer into GtkWidget and change 'parent's
type from GtkContainer to GtkWidget . This would be a cleaner approach,
but is a major design decision to be made.

Could you please help me?


bye
Stefan
 



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