More work. NOW we're getting boring :v

This commit is contained in:
Pietro Gagliardi 2015-11-26 20:34:21 -05:00
parent 36f572078e
commit 60becb332e
3 changed files with 35 additions and 8 deletions

View File

@ -59,6 +59,7 @@ static void boxContainerUpdateState(uiControl *c)
// Grid unfortunately does not have a way to set the spacing between rows and columns.
// This means we have to do padding ourselves.
// TODO this doesn't work right for visibility purposes
static void resetMargins(uiBox *b)
{
double paddingUnit;

View File

@ -49,8 +49,7 @@ static uiCombobox *finishNewCombobox(bool editable)
c->combobox = new gcroot<ComboBox ^>();
*(c->combobox) = gcnew ComboBox();
// TODO doesn't affect the presence of a textbox
(*(c->combobox))->IsReadOnly = editable;
(*(c->combobox))->IsEditable = editable;
uiComboboxOnSelected(c, defaultOnSelected, NULL);
@ -61,10 +60,10 @@ static uiCombobox *finishNewCombobox(bool editable)
uiCombobox *uiNewCombobox(void)
{
return finishNewCombobox(true);
return finishNewCombobox(false);
}
uiCombobox *uiNewEditableCombobox(void)
{
return finishNewCombobox(false);
return finishNewCombobox(true);
}

View File

@ -4,15 +4,28 @@
struct uiGroup {
uiWindowsControl c;
gcroot<GroupBox ^> *groupbox;
uiControl *child;
int margined;
};
uiWindowsDefineControl(
static void onDestroy(uiGroup *);
uiWindowsDefineControlWithOnDestroy(
uiGroup, // type name
uiGroupType, // type function
groupbox // handle
groupbox, // handle
onDestroy(hthis); // on destroy
)
static void onDestroy(uiGroup *g)
{
if (g->child != NULL) {
(*(g->groupbox))->Content = nullptr;
uiControlSetParent(g->child, NULL);
uiControlDestroy(g->child);
}
}
char *uiGroupTitle(uiGroup *g)
{
String ^text;
@ -30,7 +43,15 @@ void uiGroupSetTitle(uiGroup *g, const char *title)
void uiGroupSetChild(uiGroup *g, uiControl *c)
{
// TODO
if (g->child != NULL) {
uiControlSetParent(g->child, NULL);
(*(g->groupbox))->Content = nullptr;
}
g->child = c;
if (g->child != NULL) {
(*(g->groupbox))->Content = genericHandle(g->child);
uiControlSetParent(g->child, uiControl(g));
}
}
int uiGroupMargined(uiGroup *g)
@ -40,7 +61,13 @@ int uiGroupMargined(uiGroup *g)
void uiGroupSetMargined(uiGroup *g, int margined)
{
// TODO
g->margined = margined;
// TODO Margin or Padding?
// TODO really this? or should we just use another Border?
if (g->margined)
(*(g->groupbox))->Padding = Thickness(10, 10, 10, 10);
else
(*(g->groupbox))->Padding = Thickness(0, 0, 0, 0);
}
uiGroup *uiNewGroup(const char *title)