Re: a new combo box
- From: Emmanuele Bassi <ebassi gmail com>
- To: Matthias Clasen <matthias clasen gmail com>
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: a new combo box
- Date: Mon, 29 Dec 2014 00:42:24 +0000
hi Matthias;
On 27 December 2014 at 13:02, Matthias Clasen <matthias clasen gmail com> wrote:
over Christmas, I had some for a little side project, a new combo
box. It is based on these mockups:
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/theming/widgets/combobox-replacements.png
There are some lose ends in the code, like the interaction of grouping
and search, but it is complete enough to give it a try and evaluate
the design. If you want to try it, the code is in the wip/combo
branch, and there is a testnewcombo test app with some examples.
I'm off for a few days now - would be great to hear some feedback when
I come back.
just a bunch of comments going through the commits.
looking at the API, it seems that every item in the selectable values has:
• a string value used for the row id
• a string value used for the text
• a string value used as the sorting key
• a string value used as the grouping key
that's a lot of strings; some languages with named and optional
arguments (e.g. Python) will be better served by this API, but I'm
worried about C developers getting it wrong — like with
gtk_box_pack_*.
the stringified id is miles better than the numeric one we use in the
combobox widget currently, but I'm not entirely sold on the sorting
and grouping keys being (nullable) arguments for add_item(). maybe it
should be add_item_full(), or a specific set_sort_key(id, sort_key)
and/or set_group_key(id, group_key).
we're only allowing textual data, but we may want to allow an image
selection instead — for instance, to select among a dropdown of known
colours, or know background, or known emojis, or whatever. we clearly
don't want to have that exposed in the API, but this would require
having GtkComboRow as a public class that the user can inherit from.
set_placeholder() should probably be set_placeholder_text(), to match
the corresponding method in GtkEntry.
set_allow_custom() is probably fine, but we probably want a
set_allow_custom_text() to customize the text to something other than
"Custom entry"; or maybe have set_allow_custom() take a const char*
with NULL being the equivalent of FALSE; "" being the equivalent of
the default string; and a string for a custom label. not the nicest
thing, to be honest.
the widget design does not seem to allow multiple selection, but the
<select> element in HTML has a "multiple" option which may turn
useful.
as for the overall naming: I think "combo box" does not entirely
apply, given that the entry is not only optional, but also part of the
drop down, instead of being an entry *with* a drop down. maybe
something like "GtkDropdown"? or "GtkDropList"?
ciao,
Emmanuele.
--
http://www.bassi.io
[ ] ebassi [ gmail com]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]