Re: Combo box investigation + proposed new API
- From: Havoc Pennington <hp redhat com>
- To: kristian planet nl
- Cc: GTK Development list <gtk-devel-list gnome org>
- Subject: Re: Combo box investigation + proposed new API
- Date: 05 Oct 2000 14:04:17 -0400
Kristian Rietveld <kristian planet nl> writes:
> GtkHBox
> + GtkComboBox
> + GtkComboBoxPixmap
> + GtkComboBoxText
>
Does the HBox derivation really make sense? It's just a way to avoid
writing the container boilerplate, but that boilerplate isn't going to
be very complicated.
It only really makes sense conceptually if we support users adding
additional children to the hbox. That seems pretty useless though.
> But I'll change the API of PixmapCombo
> for GtkComboBoxPixmap, I think that a 'dynamic' version is handier than
> the original PixmapCombo where you've to give all the elements at the time
> of creation of the widget.
Agreed.
> Finally, the GtkComboBoxText will be based on
> GtkClueHunter from beast-gtk, which will be also implemented using the new
> GtkTL stuff.
>
The new tree/list is in CVS HEAD now, conveniently.
On the patch, some thoughts:
===
struct _GtkComboBoxPixmapItem
{
/* private */
int index;
GtkImage *image_widget;
/* public */
gchar *tooltip;
GdkPixbuf *image;
};
...
GtkComboBoxPixmapItem *gtk_combo_box_pixmap_add_item ( gchar *tooltip,
GdkPixbuf *image );
GtkType gtk_combo_box_pixmap_get_type ( void );
GtkWidget *gtk_combo_box_pixmap_new ( int max_cols, int max_rows );
void gtk_combo_box_pixmap_remove_item ( GtkComboBoxPixmapItem *item );
void gtk_combo_box_pixmap_select_pixmap ( GtkComboBoxPixmap *cboxpixmap,
GtkComboBoxPixmapItem *item );
===
If we go with pixmaps, I'd call it GtkComboBoxPixbuf instead of Pixmap;
there are no pixmaps involved here anymore. ;-)
I'm not sure what I said in my original combo box notes, but seeing
this API I think it would be cleaner to simply have GtkComboBoxGrid
(name open to question) which takes arbitrary widgets. i.e.:
gtk_combo_box_grid_add_item (combobox, GtkWidget *item);
You remove items with gtk_container_remove(combobox, item).
The user doesn't specify max cols/rows, instead the grid just
automatically picks a nice arrangement.
So to make an image combo you'd just add a bunch of GtkImage to the
GtkComboBoxGrid.
===
void gtk_combo_box_text_set_tlview ( GtkComboBoxText *cboxtext,
GtkWidget *tlview );
void gtk_combo_box_text_set_entry ( GtkComboBoxText *cboxtext,
GtkWidget *entry );
===
Note that it is no longer called tlview, it's tree_view now I think.
However I don't think you need these functions, because if you want to
set custom popdown and entry, you just use the GtkComboBox base class.
===
void gtk_combo_box_text_set_pattern_matching ( GtkComboBoxText *cboxtext,
gboolean matching );
void gtk_combo_box_text_set_keep_history ( GtkComboBoxText *cboxtext,
gboolean keep );
void gtk_combo_box_text_select_entry ( GtkComboBoxText *cboxtext,
const gchar *string );
gchar *gtk_combo_box_text_try_complete ( GtkComboBoxText *cboxtext );
===
Need some elaboration on what these functions do. Also, API is missing
to get the current list of strings in the popdown.
===
void gtk_combo_box_disable_activate ( GtkComboBox *cbox );
===
What does this one do?
I think the overall set of widgets is on the right track, but there
are lots of little details to be worked out and gotten right. I'd
suggest jumping into the implementation, and posting code snapshots
here every so often, so people can comment.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]