Added Password and Search Entries. Now for the implementation.

This commit is contained in:
Pietro Gagliardi 2016-06-05 20:26:44 -04:00
parent 6ebdc96b93
commit d0be2979e4
2 changed files with 22 additions and 0 deletions

View File

@ -45,6 +45,8 @@ static void openTestWindow(uiBox *(*mkf)(void))
// TODO nonscrolling and scrolling areas?
BA(uiNewFontButton());
BA(uiNewColorButton());
BA(uiNewPasswordEntry());
BA(uiNewSearchEntry());
uiControlShow(uiControl(w));
}
@ -54,11 +56,21 @@ static void buttonClicked(uiButton *b, void *data)
openTestWindow((uiBox *(*)(void)) data);
}
static void entryChanged(uiEntry *e, void *data)
{
char *text;
text = uiEntryText(e);
printf("%s entry changed: %s\n", (const char *) data, text);
uiFreeText(text);
}
uiBox *makePage13(void)
{
uiBox *page13;
uiRadioButtons *rb;
uiButton *b;
uiEntry *e;
page13 = newVerticalBox();
@ -81,5 +93,13 @@ uiBox *makePage13(void)
uiButtonOnClicked(b, buttonClicked, uiNewVerticalBox);
uiBoxAppend(page13, uiControl(b), 0);
e = uiNewPasswordEntry();
uiEntryOnChanged(e, entryChanged, "password");
uiBoxAppend(page13, uiControl(e), 0);
e = uiNewSearchEntry();
uiEntryOnChanged(e, entryChanged, "search");
uiBoxAppend(page13, uiControl(e), 0);
return page13;
}

2
ui.h
View File

@ -136,6 +136,8 @@ _UI_EXTERN void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data),
_UI_EXTERN int uiEntryReadOnly(uiEntry *e);
_UI_EXTERN void uiEntrySetReadOnly(uiEntry *e, int readonly);
_UI_EXTERN uiEntry *uiNewEntry(void);
_UI_EXTERN uiEntry *uiNewPasswordEntry(void);
_UI_EXTERN uiEntry *uiNewSearchEntry(void);
typedef struct uiLabel uiLabel;
#define uiLabel(this) ((uiLabel *) (this))