Began uiEditableCombobox splitting.
This commit is contained in:
parent
a571bd4779
commit
996ba99b0f
|
@ -82,6 +82,7 @@ int main(void)
|
|||
uiBox *inner2;
|
||||
uiEntry *entry;
|
||||
uiCombobox *cbox;
|
||||
uiEditableCombobox *ecbox;
|
||||
uiRadioButtons *rb;
|
||||
uiTab *tab;
|
||||
|
||||
|
@ -206,11 +207,11 @@ int main(void)
|
|||
uiComboboxAppend(cbox, "Combobox Item 3");
|
||||
uiBoxAppend(inner, uiControl(cbox), 0);
|
||||
|
||||
cbox = uiNewEditableCombobox();
|
||||
uiComboboxAppend(cbox, "Editable Item 1");
|
||||
uiComboboxAppend(cbox, "Editable Item 2");
|
||||
uiComboboxAppend(cbox, "Editable Item 3");
|
||||
uiBoxAppend(inner, uiControl(cbox), 0);
|
||||
ecbox = uiNewEditableCombobox();
|
||||
uiEditableComboboxAppend(ecbox, "Editable Item 1");
|
||||
uiEditableComboboxAppend(ecbox, "Editable Item 2");
|
||||
uiEditableComboboxAppend(ecbox, "Editable Item 3");
|
||||
uiBoxAppend(inner, uiControl(ecbox), 0);
|
||||
|
||||
rb = uiNewRadioButtons();
|
||||
uiRadioButtonsAppend(rb, "Radio Button 1");
|
||||
|
|
|
@ -82,6 +82,9 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp)
|
|||
uiDrawTextLayoutSetColor(layout,
|
||||
5, 6,
|
||||
1, 0, 0.5, 0.5);
|
||||
uiDrawTextLayoutSetColor(layout,
|
||||
6, 7,
|
||||
0.5, 0, 1, 0.5);
|
||||
uiDrawText(dp->Context, 10, 10 + height + height, layout);
|
||||
uiDrawFreeTextLayout(layout);
|
||||
|
||||
|
|
23
test/page4.c
23
test/page4.c
|
@ -29,13 +29,13 @@ SETTOO(Slider, Low, -80)
|
|||
SETTOO(Slider, High, 80)
|
||||
|
||||
static uiCombobox *cbox;
|
||||
static uiCombobox *editable;
|
||||
static uiEditableCombobox *editable;
|
||||
static uiRadioButtons *rb;
|
||||
|
||||
static void appendCBRB(uiButton *b, void *data)
|
||||
{
|
||||
uiComboboxAppend(cbox, "New Item");
|
||||
uiComboboxAppend(editable, "New Item");
|
||||
uiEditableComboboxAppend(editable, "New Item");
|
||||
uiRadioButtonsAppend(rb, "New Item");
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,17 @@ static void onCBChanged(uiCombobox *c, void *data)
|
|||
(int) uiComboboxSelected(c));
|
||||
}
|
||||
|
||||
static void onECBChanged(uiEditableCombobox *c, void *data)
|
||||
{
|
||||
char *t;
|
||||
|
||||
t = uiEditableComboboxText(c);
|
||||
printf("%s combobox changed to %s\n",
|
||||
(char *) data,
|
||||
t);
|
||||
uiFreeText(t);
|
||||
}
|
||||
|
||||
uiBox *makePage4(void)
|
||||
{
|
||||
uiBox *page4;
|
||||
|
@ -101,10 +112,10 @@ uiBox *makePage4(void)
|
|||
uiBoxAppend(page4, uiControl(cbox), 0);
|
||||
|
||||
editable = uiNewEditableCombobox();
|
||||
uiComboboxAppend(editable, "Editable Item 1");
|
||||
uiComboboxAppend(editable, "Editable Item 2");
|
||||
uiComboboxAppend(editable, "Editable Item 3");
|
||||
uiComboboxOnSelected(editable, onCBChanged, "editable");
|
||||
uiEditableComboboxAppend(editable, "Editable Item 1");
|
||||
uiEditableComboboxAppend(editable, "Editable Item 2");
|
||||
uiEditableComboboxAppend(editable, "Editable Item 3");
|
||||
uiEditableComboboxOnChanged(editable, onECBChanged, "editable");
|
||||
uiBoxAppend(page4, uiControl(editable), 0);
|
||||
|
||||
rb = uiNewRadioButtons();
|
||||
|
|
10
ui.h
10
ui.h
|
@ -190,7 +190,15 @@ _UI_EXTERN intmax_t uiComboboxSelected(uiCombobox *c);
|
|||
_UI_EXTERN void uiComboboxSetSelected(uiCombobox *c, intmax_t n);
|
||||
_UI_EXTERN void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data);
|
||||
_UI_EXTERN uiCombobox *uiNewCombobox(void);
|
||||
_UI_EXTERN uiCombobox *uiNewEditableCombobox(void);
|
||||
|
||||
typedef struct uiEditableCombobox uiEditableCombobox;
|
||||
#define uiEditableCombobox(this) ((uiEditableCombobox *) (this))
|
||||
_UI_EXTERN void uiEditableComboboxAppend(uiEditableCombobox *c, const char *text);
|
||||
_UI_EXTERN char *uiEditableComboboxText(uiEditableCombobox *c);
|
||||
_UI_EXTERN void uiEditableComboboxSetText(uiEditableCombobox *c, intmax_t n);
|
||||
// TODO what do we call a function that sets the currently selected item and fills the text field with it? editable comboboxes have no consistent concept of selected item
|
||||
_UI_EXTERN void uiEditableComboboxOnChanged(uiEditableCombobox *c, void (*f)(uiEditableCombobox *c, void *data), void *data);
|
||||
_UI_EXTERN uiEditableCombobox *uiNewEditableCombobox(void);
|
||||
|
||||
typedef struct uiRadioButtons uiRadioButtons;
|
||||
#define uiRadioButtons(this) ((uiRadioButtons *) (this))
|
||||
|
|
Loading…
Reference in New Issue