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