From ba66d7308af741678a19eb341cbd97cdde328e1a Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 9 Apr 2015 02:43:49 -0400 Subject: [PATCH] Re-enabled the text manipulation code in the test program. --- test.c | 10 ++++------ ui.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test.c b/test.c index 77f74b7c..53869e7a 100644 --- a/test.c +++ b/test.c @@ -11,7 +11,6 @@ int onClosing(uiWindow *w, void *data) uiControl *e; -/*TODO static void getWindowText(uiControl *b, void *data) { char *text; @@ -47,7 +46,6 @@ static void setButtonText(uiControl *b, void *data) uiButtonSetText((uiControl *) data, text); uiFreeText(text); } -*/ int main(int argc, char *argv[]) { @@ -75,18 +73,18 @@ int main(int argc, char *argv[]) buttonStack = uiNewHorizontalStack(); getButton = uiNewButton("Get Window Text"); -//TODO uiButtonOnClicked(getButton, getWindowText, w); + uiButtonOnClicked(getButton, getWindowText, w); setButton = uiNewButton("Set Window Text"); -//TODO uiButtonOnClicked(setButton, setWindowText, w); + uiButtonOnClicked(setButton, setWindowText, w); uiStackAdd(buttonStack, getButton, 1); uiStackAdd(buttonStack, setButton, 1); uiStackAdd(mainStack, buttonStack, 0); buttonStack = uiNewHorizontalStack(); getButton = uiNewButton("Get Button Text"); -//TODO uiButtonOnClicked(getButton, getButtonText, getButton); + uiButtonOnClicked(getButton, getButtonText, getButton); setButton = uiNewButton("Set Button Text"); -//TODO uiButtonOnClicked(setButton, setButtonText, getButton); + uiButtonOnClicked(setButton, setButtonText, getButton); uiStackAdd(buttonStack, getButton, 1); uiStackAdd(buttonStack, setButton, 1); uiStackAdd(mainStack, buttonStack, 0); diff --git a/ui.h b/ui.h index 232b783e..435ec280 100644 --- a/ui.h +++ b/ui.h @@ -15,6 +15,8 @@ void uiInitErrorFree(uiInitError *); void uiMain(void); void uiQuit(void); +void uiFreeText(char *); + typedef struct uiControl uiControl; void uiControlDestroy(uiControl *); uintptr_t uiControlHandle(uiControl *); @@ -23,14 +25,16 @@ typedef struct uiWindow uiWindow; uiWindow *uiNewWindow(char *, int, int); void uiWindowDestroy(uiWindow *); uintptr_t uiWindowHandle(uiWindow *); -// TODO titles +char *uiWindowTitle(uiWindow *); +void uiWindowSetTitle(uiWindow *, const char *); void uiWindowShow(uiWindow *); void uiWindowHide(uiWindow *); void uiWindowOnClosing(uiWindow *, int (*)(uiWindow *, void *), void *); void uiWindowSetChild(uiWindow *, uiControl *); uiControl *uiNewButton(const char *); -// TODO text +char *uiButtonText(uiControl *); +void uiButtonSetText(uiControl *, const char *); void uiButtonOnClicked(uiControl *, void (*)(uiControl *, void *), void *); uiControl *uiNewHorizontalStack(void); @@ -38,5 +42,7 @@ uiControl *uiNewVerticalStack(void); void uiStackAdd(uiControl *, uiControl *, int); uiControl *uiNewEntry(void); +char *uiEntryText(uiControl *); +void uiEntrySetText(uiControl *, const char *); #endif