Implemented uiEntry on GTK+.

This commit is contained in:
Pietro Gagliardi 2015-04-08 23:28:47 -04:00
parent c6d3a068a9
commit da45c51a82
2 changed files with 37 additions and 5 deletions

32
new/entry_unix.c Normal file
View File

@ -0,0 +1,32 @@
// 8 april 2015
#include "uipriv_unix.h"
struct entry {
uiControl *c;
};
#define E(x) ((struct entry *) (x))
static void onDestroy(GtkWidget *widget, gpointer data)
{
struct entry *e = (struct entry *) data;
uiFree(e);
}
uiControl *uiNewEntry(void)
{
struct entry *e;
GtkWidget *widget;
e = uiNew(struct entry);
e->c = uiUnixNewControl(GTK_TYPE_ENTRY,
FALSE, FALSE, e,
NULL);
widget = GTK_WIDGET(uiControlHandle(e->c));
g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), e);
return e->c;
}

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[])
mainStack = uiNewVerticalStack(); mainStack = uiNewVerticalStack();
uiWindowSetChild(w, mainStack); uiWindowSetChild(w, mainStack);
e = uiTextEntryNew(); e = uiNewEntry();
uiStackAdd(mainStack, e, 0); uiStackAdd(mainStack, e, 0);
buttonStack = uiNewHorizontalStack(); buttonStack = uiNewHorizontalStack();
@ -83,10 +83,10 @@ int main(int argc, char *argv[])
uiStackAdd(mainStack, buttonStack, 0); uiStackAdd(mainStack, buttonStack, 0);
buttonStack = uiNewHorizontalStack(); buttonStack = uiNewHorizontalStack();
//TODO getButton = uiNewButton("Get Button Text"); getButton = uiNewButton("Get Button Text");
uiButtonOnClicked(getButton, getButtonText, getButton); //TODO uiButtonOnClicked(getButton, getButtonText, getButton);
//TODO setButton = uiNewButton("Set Button Text"); setButton = uiNewButton("Set Button Text");
uiButtonOnClicked(setButton, setButtonText, getButton); //TODO 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);