We are FINALLY adding uiForm. About time :V

This commit is contained in:
Pietro Gagliardi 2016-06-07 09:56:53 -04:00
parent 3e1258cc62
commit 1ad18ddc8e
5 changed files with 31 additions and 2 deletions

View File

@ -10,6 +10,7 @@
#define uiEditableComboboxSignature 0x45644362
#define uiEntrySignature 0x456E7472
#define uiFontButtonSignature 0x466F6E42
#define uiFormSignature 0x466F726D
#define uiGroupSignature 0x47727062
#define uiLabelSignature 0x4C61626C
#define uiMultilineEntrySignature 0x4D6C6E45

View File

@ -70,6 +70,7 @@ uiBox *makePage13(void)
uiBox *page13;
uiRadioButtons *rb;
uiButton *b;
uiForm *f;
uiEntry *e;
page13 = newVerticalBox();
@ -93,13 +94,18 @@ uiBox *makePage13(void)
uiButtonOnClicked(b, buttonClicked, uiNewVerticalBox);
uiBoxAppend(page13, uiControl(b), 0);
f = newForm();
uiBoxAppend(page13, uiControl(f), 1);
e = uiNewPasswordEntry();
uiEntryOnChanged(e, entryChanged, "password");
uiBoxAppend(page13, uiControl(e), 0);
uiFormAppend(f, "Password Entry", uiControl(e), 0);
e = uiNewSearchEntry();
uiEntryOnChanged(e, entryChanged, "search");
uiBoxAppend(page13, uiControl(e), 0);
uiFormAppend(f, "Search Box", uiControl(e), 0);
uiFormAppend(f, "MLE", uiControl(uiNewMultilineEntry()), 1);
return page13;
}

View File

@ -31,6 +31,7 @@ enum types {
box,
tab,
group,
form,
};
void setSpaced(int spaced)
@ -56,6 +57,9 @@ void setSpaced(int spaced)
case group:
uiGroupSetMargined(uiGroup(p), spaced);
break;
case form:
uiFormSetPadded(uiForm(p), spaced);
break;
}
}
}
@ -88,6 +92,7 @@ void querySpaced(char out[12]) // more than enough
if (uiGroupMargined(uiGroup(pp)))
m++;
break;
// TODO form
}
}
@ -147,3 +152,12 @@ uiGroup *newGroup(const char *text)
append(g, group);
return g;
}
uiForm *newForm(void)
{
uiForm *f;
f = uiNewForm();
append(f, form);
return f;
}

View File

@ -22,6 +22,7 @@ extern uiBox *newHorizontalBox(void);
extern uiBox *newVerticalBox(void);
extern uiTab *newTab(void);
extern uiGroup *newGroup(const char *);
extern uiForm *newForm(void);
// menus.c
extern uiMenuItem *shouldQuitItem;

7
ui.h
View File

@ -620,6 +620,13 @@ _UI_EXTERN void uiColorButtonSetColor(uiColorButton *b, double r, double g, doub
_UI_EXTERN void uiColorButtonOnChanged(uiColorButton *b, void (*f)(uiColorButton *, void *), void *data);
_UI_EXTERN uiColorButton *uiNewColorButton(void);
typedef struct uiForm uiForm;
#define uiForm(this) ((uiForm *) (this))
_UI_EXTERN void uiFormAppend(uiForm *f, const char *label, uiControl *control, int stretchy);
_UI_EXTERN int uiFormPadded(uiForm *f);
_UI_EXTERN void uiFormSetPadded(uiForm *f, int padded);
_UI_EXTERN uiForm *uiNewForm(void);
#ifdef __cplusplus
}
#endif