Re-enabled the text manipulation code in the test program.

This commit is contained in:
Pietro Gagliardi 2015-04-09 02:43:49 -04:00
parent 27b7089423
commit ba66d7308a
2 changed files with 12 additions and 8 deletions

10
test.c
View File

@ -11,7 +11,6 @@ int onClosing(uiWindow *w, void *data)
uiControl *e; uiControl *e;
/*TODO
static void getWindowText(uiControl *b, void *data) static void getWindowText(uiControl *b, void *data)
{ {
char *text; char *text;
@ -47,7 +46,6 @@ static void setButtonText(uiControl *b, void *data)
uiButtonSetText((uiControl *) data, text); uiButtonSetText((uiControl *) data, text);
uiFreeText(text); uiFreeText(text);
} }
*/
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -75,18 +73,18 @@ int main(int argc, char *argv[])
buttonStack = uiNewHorizontalStack(); buttonStack = uiNewHorizontalStack();
getButton = uiNewButton("Get Window Text"); getButton = uiNewButton("Get Window Text");
//TODO uiButtonOnClicked(getButton, getWindowText, w); uiButtonOnClicked(getButton, getWindowText, w);
setButton = uiNewButton("Set Window Text"); setButton = uiNewButton("Set Window Text");
//TODO uiButtonOnClicked(setButton, setWindowText, w); uiButtonOnClicked(setButton, setWindowText, w);
uiStackAdd(buttonStack, getButton, 1); uiStackAdd(buttonStack, getButton, 1);
uiStackAdd(buttonStack, setButton, 1); uiStackAdd(buttonStack, setButton, 1);
uiStackAdd(mainStack, buttonStack, 0); uiStackAdd(mainStack, buttonStack, 0);
buttonStack = uiNewHorizontalStack(); buttonStack = uiNewHorizontalStack();
getButton = uiNewButton("Get Button Text"); getButton = uiNewButton("Get Button Text");
//TODO uiButtonOnClicked(getButton, getButtonText, getButton); uiButtonOnClicked(getButton, getButtonText, getButton);
setButton = uiNewButton("Set Button Text"); setButton = uiNewButton("Set Button Text");
//TODO uiButtonOnClicked(setButton, setButtonText, getButton); uiButtonOnClicked(setButton, setButtonText, getButton);
uiStackAdd(buttonStack, getButton, 1); uiStackAdd(buttonStack, getButton, 1);
uiStackAdd(buttonStack, setButton, 1); uiStackAdd(buttonStack, setButton, 1);
uiStackAdd(mainStack, buttonStack, 0); uiStackAdd(mainStack, buttonStack, 0);

10
ui.h
View File

@ -15,6 +15,8 @@ void uiInitErrorFree(uiInitError *);
void uiMain(void); void uiMain(void);
void uiQuit(void); void uiQuit(void);
void uiFreeText(char *);
typedef struct uiControl uiControl; typedef struct uiControl uiControl;
void uiControlDestroy(uiControl *); void uiControlDestroy(uiControl *);
uintptr_t uiControlHandle(uiControl *); uintptr_t uiControlHandle(uiControl *);
@ -23,14 +25,16 @@ typedef struct uiWindow uiWindow;
uiWindow *uiNewWindow(char *, int, int); uiWindow *uiNewWindow(char *, int, int);
void uiWindowDestroy(uiWindow *); void uiWindowDestroy(uiWindow *);
uintptr_t uiWindowHandle(uiWindow *); uintptr_t uiWindowHandle(uiWindow *);
// TODO titles char *uiWindowTitle(uiWindow *);
void uiWindowSetTitle(uiWindow *, const char *);
void uiWindowShow(uiWindow *); void uiWindowShow(uiWindow *);
void uiWindowHide(uiWindow *); void uiWindowHide(uiWindow *);
void uiWindowOnClosing(uiWindow *, int (*)(uiWindow *, void *), void *); void uiWindowOnClosing(uiWindow *, int (*)(uiWindow *, void *), void *);
void uiWindowSetChild(uiWindow *, uiControl *); void uiWindowSetChild(uiWindow *, uiControl *);
uiControl *uiNewButton(const char *); uiControl *uiNewButton(const char *);
// TODO text char *uiButtonText(uiControl *);
void uiButtonSetText(uiControl *, const char *);
void uiButtonOnClicked(uiControl *, void (*)(uiControl *, void *), void *); void uiButtonOnClicked(uiControl *, void (*)(uiControl *, void *), void *);
uiControl *uiNewHorizontalStack(void); uiControl *uiNewHorizontalStack(void);
@ -38,5 +42,7 @@ uiControl *uiNewVerticalStack(void);
void uiStackAdd(uiControl *, uiControl *, int); void uiStackAdd(uiControl *, uiControl *, int);
uiControl *uiNewEntry(void); uiControl *uiNewEntry(void);
char *uiEntryText(uiControl *);
void uiEntrySetText(uiControl *, const char *);
#endif #endif