Implemented uiEntry on GTK+.
This commit is contained in:
parent
c6d3a068a9
commit
da45c51a82
|
@ -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;
|
||||
}
|
10
new/test.c
10
new/test.c
|
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
|
|||
mainStack = uiNewVerticalStack();
|
||||
uiWindowSetChild(w, mainStack);
|
||||
|
||||
e = uiTextEntryNew();
|
||||
e = uiNewEntry();
|
||||
uiStackAdd(mainStack, e, 0);
|
||||
|
||||
buttonStack = uiNewHorizontalStack();
|
||||
|
@ -83,10 +83,10 @@ int main(int argc, char *argv[])
|
|||
uiStackAdd(mainStack, buttonStack, 0);
|
||||
|
||||
buttonStack = uiNewHorizontalStack();
|
||||
//TODO getButton = uiNewButton("Get Button Text");
|
||||
uiButtonOnClicked(getButton, getButtonText, getButton);
|
||||
//TODO setButton = uiNewButton("Set Button Text");
|
||||
uiButtonOnClicked(setButton, setButtonText, getButton);
|
||||
getButton = uiNewButton("Get Button Text");
|
||||
//TODO uiButtonOnClicked(getButton, getButtonText, getButton);
|
||||
setButton = uiNewButton("Set Button Text");
|
||||
//TODO uiButtonOnClicked(setButton, setButtonText, getButton);
|
||||
uiStackAdd(buttonStack, getButton, 1);
|
||||
uiStackAdd(buttonStack, setButton, 1);
|
||||
uiStackAdd(mainStack, buttonStack, 0);
|
||||
|
|
Loading…
Reference in New Issue