Re: Evolving ComboBox API



On Wed, 2003-04-23 at 18:14, Kristian Rietveld wrote:
> Hey,
> 
> After more thinking and talking, it's time for another round of headers.
> A number of things have changed since last time:
> 
> - EggCellView and friends will be private widgets,
> 
> - The original base class, EggComboBox, has been dropped,
> 
> - Quite a number of changes in the TextCombo area, completion will move
> to GtkEntry (API details to be announced later on), history handling
> will be totally up to the user. Also, EggComboBoxText is now just a
> EggComboBox with a GtkEntry as child,
> 
> - The TextCombo popdown and the completion items will now come from
> separate models. The TextCombo would use the model specified during
> construction of the widget. The GtkEntry completion code would get the
> items from the model specified during enabling completion.

Sounds reasonable (not that I can really object after advocating
this route earlier.) There may be some convenience functions that
are useful, but the Entry completion API probably needs to be
fleshed out and used a bit first.

> - The name egg_combo_box_new_text() is badly chosen, we need another
> name for this. Maybe something like egg_combo_box_simple_new(),

My suggestion is:

 egg_combo_box_new_text() as now
 egg_combo_box_entry_new()

You can have an EggComboBox with text in it, the distinctive thing
about the current EggComboBoxText is that it is *editable* text.

> - The pixtext convenience handlers, which would provide easy API for
> creating option menus with pixbuf, text pairs has been dropped. I still
> think that this code can be useful, others don't.

Putting flags by the country names is crack, as much as people want
to do it. We should make them pay for it just a _little_ bit.
With the raw API, doing pixmap/text pairs will still be easier
than creating a GtkTreeView with pixmap/text pairs, so I think
it counts as easy.

>  /* signals */
>  void     (* popped_up)        (EggComboBox *combo_box);
>  void     (* popped_down)      (EggComboBox *combo_box);
>  void     (* changed)          (EggComboBox *combo_box);

I'll repeat my earlier call to eliminate popped_up/popped_down
(I don't see the use case) and to add a

 gboolean (* activate) (EggComboBox *combo_box);

where the *default* action is to set_activate(), which then
emits ::changed.

>  /* vtable */
>  void     (* set_active)       (EggComboBox *combo_box,
>                                 gint         index);
>  gint     (* get_active)       (EggComboBox *combo_box);

Do these need to be virtualized, or can you (with my above
scheme), just do what's needed out of the default handlers
for ::activate and ::changed?

> void egg_combo_box_set_span_columns (EggComboBox     *combo_box,
>                                      gint             width_column,
>                                      gint             height_column);

Free prize for whoever can figure out what this should be called
so as not to confuse the heck out of everybody who looks at the
header file. 
Maybe set_span_model_column(); int width_model_column; int height_model_column.

I wonder if we should add:

 GtkEntry *egg_combo_box_entry_get_entry(EggComboBoxEntry *combo_box_entry);

to keep from having to continually point people to gtk_bin_get_child().

Regards,
                                       Owen






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