Started filling in controls.
This commit is contained in:
parent
42b0bada64
commit
36f572078e
|
@ -3,35 +3,42 @@
|
|||
|
||||
struct uiCombobox {
|
||||
uiWindowsControl c;
|
||||
DUMMY dummy;
|
||||
gcroot<ComboBox ^> *combobox;
|
||||
void (*onSelected)(uiCombobox *, void *);
|
||||
void *onSelectedData;
|
||||
};
|
||||
|
||||
uiWindowsDefineControl(
|
||||
uiCombobox, // type name
|
||||
uiComboboxType, // type function
|
||||
dummy // handle
|
||||
combobox // handle
|
||||
)
|
||||
|
||||
static void defaultOnSelected(uiCombobox *c, void *data)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void uiComboboxAppend(uiCombobox *c, const char *text)
|
||||
{
|
||||
// TODO
|
||||
(*(c->combobox))->Items->Add(fromUTF8(text));
|
||||
}
|
||||
|
||||
intmax_t uiComboboxSelected(uiCombobox *c)
|
||||
{
|
||||
// TODO
|
||||
// return 0 so the area test can work
|
||||
return 0;
|
||||
// TODO what happens on an editable combobox?
|
||||
return (*(c->combobox))->SelectedIndex;
|
||||
}
|
||||
|
||||
void uiComboboxSetSelected(uiCombobox *c, intmax_t n)
|
||||
{
|
||||
// TODO
|
||||
(*(c->combobox))->SelectedIndex = n;
|
||||
}
|
||||
|
||||
void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data)
|
||||
{
|
||||
// TODO
|
||||
c->onSelected = f;
|
||||
c->onSelectedData = data;
|
||||
}
|
||||
|
||||
static uiCombobox *finishNewCombobox(bool editable)
|
||||
|
@ -40,11 +47,14 @@ static uiCombobox *finishNewCombobox(bool editable)
|
|||
|
||||
c = (uiCombobox *) uiNewControl(uiComboboxType());
|
||||
|
||||
c->dummy = mkdummy(L"uiCombobox");
|
||||
c->combobox = new gcroot<ComboBox ^>();
|
||||
*(c->combobox) = gcnew ComboBox();
|
||||
// TODO doesn't affect the presence of a textbox
|
||||
(*(c->combobox))->IsReadOnly = editable;
|
||||
|
||||
// (*(c->combobox))->IsReadOnly = editable;
|
||||
uiComboboxOnSelected(c, defaultOnSelected, NULL);
|
||||
|
||||
uiWindowsFinishNewControl(c, uiCombobox, dummy);
|
||||
uiWindowsFinishNewControl(c, uiCombobox, combobox);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
// 26 november 2015
|
||||
#include "uipriv_wpf.hpp"
|
||||
|
||||
// TODO TODO TODO AVAILABLE SINCE 4.0 TODO TODO TODO
|
||||
|
||||
struct uiDateTimePicker {
|
||||
uiWindowsControl c;
|
||||
// gcroot<DatePicker ^> *datePicker;
|
||||
DUMMY dummy;
|
||||
};
|
||||
|
||||
uiWindowsDefineControl(
|
||||
uiDateTimePicker, // type name
|
||||
uiDateTimePickerType, // type function
|
||||
// datePicker // handle
|
||||
dummy // handle
|
||||
)
|
||||
|
||||
static uiDateTimePicker *finishNewDateTimePicker(void)
|
||||
static uiDateTimePicker *finishNewDateTimePicker(/* TODO */)
|
||||
{
|
||||
uiDateTimePicker *d;
|
||||
|
||||
d = (uiDateTimePicker *) uiNewControl(uiDateTimePickerType());
|
||||
|
||||
d->dummy = mkdummy(L"uiDateTimePicker");
|
||||
/* d->datePicker = new gcroot<DatePicker ^>();
|
||||
*(d->datePicker) = gcnew DatePicker();
|
||||
// TODO SelectedDateFormat
|
||||
*/
|
||||
d->dummy = mkdummy(L"uiDatePicker");
|
||||
|
||||
uiWindowsFinishNewControl(d, uiDateTimePicker, dummy);
|
||||
uiWindowsFinishNewControl(d, uiDateTimePicker, dummy);//datePicker);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
struct uiEntry {
|
||||
uiWindowsControl c;
|
||||
DUMMY dummy;
|
||||
gcroot<TextBox ^> *textbox;
|
||||
void (*onChanged)(uiEntry *, void *);
|
||||
void *onChangedData;
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ struct uiEntry {
|
|||
uiWindowsDefineControl(
|
||||
uiEntry, // type name
|
||||
uiEntryType, // type function
|
||||
dummy // handle
|
||||
textbox // handle
|
||||
)
|
||||
|
||||
static void defaultOnChanged(uiEntry *e, void *data)
|
||||
|
@ -21,13 +21,12 @@ static void defaultOnChanged(uiEntry *e, void *data)
|
|||
|
||||
char *uiEntryText(uiEntry *e)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
return uiWindowsCLRStringToText((*(e->textbox))->Text);
|
||||
}
|
||||
|
||||
void uiEntrySetText(uiEntry *e, const char *text)
|
||||
{
|
||||
// TODO
|
||||
(*(e->textbox))->Text = fromUTF8(text);
|
||||
}
|
||||
|
||||
void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data), void *data)
|
||||
|
@ -38,13 +37,12 @@ void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data), void *data)
|
|||
|
||||
int uiEntryReadOnly(uiEntry *e)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
return (*(e->textbox))->IsReadOnly != false;
|
||||
}
|
||||
|
||||
void uiEntrySetReadOnly(uiEntry *e, int readonly)
|
||||
{
|
||||
// TODO
|
||||
(*(e->textbox))->IsReadOnly = readonly != 0;
|
||||
}
|
||||
|
||||
uiEntry *uiNewEntry(void)
|
||||
|
@ -53,11 +51,12 @@ uiEntry *uiNewEntry(void)
|
|||
|
||||
e = (uiEntry *) uiNewControl(uiEntryType());
|
||||
|
||||
e->dummy = mkdummy("uiEntry");
|
||||
e->textbox = new gcroot<TextBox ^>();
|
||||
*(e->textbox) = gcnew TextBox();
|
||||
|
||||
uiEntryOnChanged(e, defaultOnChanged, NULL);
|
||||
|
||||
uiWindowsFinishNewControl(e, uiEntry, dummy);
|
||||
uiWindowsFinishNewControl(e, uiEntry, textbox);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
|
|
@ -3,24 +3,29 @@
|
|||
|
||||
struct uiGroup {
|
||||
uiWindowsControl c;
|
||||
DUMMY dummy;
|
||||
gcroot<GroupBox ^> *groupbox;
|
||||
int margined;
|
||||
};
|
||||
|
||||
uiWindowsDefineControl(
|
||||
uiGroup, // type name
|
||||
uiGroupType, // type function
|
||||
dummy // handle
|
||||
groupbox // handle
|
||||
)
|
||||
|
||||
char *uiGroupTitle(uiGroup *g)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
String ^text;
|
||||
|
||||
// TOOD bad cast?
|
||||
text = (String ^) ((*(g->groupbox))->Header);
|
||||
return uiWindowsCLRStringToText(text);
|
||||
}
|
||||
|
||||
void uiGroupSetTitle(uiGroup *g, const char *title)
|
||||
{
|
||||
// TODO
|
||||
(*(g->groupbox))->Header = fromUTF8(title);
|
||||
// TODO layout
|
||||
}
|
||||
|
||||
void uiGroupSetChild(uiGroup *g, uiControl *c)
|
||||
|
@ -30,8 +35,7 @@ void uiGroupSetChild(uiGroup *g, uiControl *c)
|
|||
|
||||
int uiGroupMargined(uiGroup *g)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
return g->margined;
|
||||
}
|
||||
|
||||
void uiGroupSetMargined(uiGroup *g, int margined)
|
||||
|
@ -45,9 +49,11 @@ uiGroup *uiNewGroup(const char *title)
|
|||
|
||||
g = (uiGroup *) uiNewControl(uiGroupType());
|
||||
|
||||
g->dummy = mkdummy(L"uiGroup");
|
||||
g->groupbox = new gcroot<GroupBox ^>();
|
||||
*(g->groupbox) = gcnew GroupBox();
|
||||
(*(g->groupbox))->Header = fromUTF8(title);
|
||||
|
||||
uiWindowsFinishNewControl(g, uiGroup, dummy);
|
||||
uiWindowsFinishNewControl(g, uiGroup, groupbox);
|
||||
|
||||
return g;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue