aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-10-05 00:13:22 +0200
committerStapleButter <thetotalworm@gmail.com>2017-10-05 00:13:22 +0200
commit9d3f13b6891eafc4b12d62259ad0b6876952eccd (patch)
treed98686b55afa90146b63400d3c1fe1c890f608c1 /src
parent5b71ffceee18a38dc81bb95a4001cb22f878f300 (diff)
rework things a bit.
also remove some useless variables.
Diffstat (limited to 'src')
-rw-r--r--src/libui_sdl/libui/common/control.c3
-rw-r--r--src/libui_sdl/libui/ui.h1
-rw-r--r--src/libui_sdl/libui/ui_windows.h6
-rw-r--r--src/libui_sdl/libui/windows/box.cpp9
-rw-r--r--src/libui_sdl/libui/windows/colordialog.cpp1
-rw-r--r--src/libui_sdl/libui/windows/form.cpp6
-rw-r--r--src/libui_sdl/libui/windows/grid.cpp6
-rw-r--r--src/libui_sdl/libui/windows/group.cpp6
-rw-r--r--src/libui_sdl/libui/windows/tab.cpp6
-rw-r--r--src/libui_sdl/libui/windows/window.cpp5
10 files changed, 43 insertions, 6 deletions
diff --git a/src/libui_sdl/libui/common/control.c b/src/libui_sdl/libui/common/control.c
index f811728..78d1e5f 100644
--- a/src/libui_sdl/libui/common/control.c
+++ b/src/libui_sdl/libui/common/control.c
@@ -66,8 +66,7 @@ void uiControlSetMinSize(uiControl *c, int w, int h)
{
c->MinWidth = w;
c->MinHeight = h;
-
- // TODO: resize if needed
+ (*(c->SetMinSize))(c, w, h);
}
#define uiControlSignature 0x7569436F
diff --git a/src/libui_sdl/libui/ui.h b/src/libui_sdl/libui/ui.h
index e78de5e..6e51d44 100644
--- a/src/libui_sdl/libui/ui.h
+++ b/src/libui_sdl/libui/ui.h
@@ -73,6 +73,7 @@ struct uiControl {
void (*Enable)(uiControl *);
void (*Disable)(uiControl *);
void (*SetFocus)(uiControl *);
+ void (*SetMinSize)(uiControl*, int, int);
int MinWidth, MinHeight;
};
diff --git a/src/libui_sdl/libui/ui_windows.h b/src/libui_sdl/libui/ui_windows.h
index 3917c97..85c3137 100644
--- a/src/libui_sdl/libui/ui_windows.h
+++ b/src/libui_sdl/libui/ui_windows.h
@@ -107,6 +107,10 @@ _UI_EXTERN void uiWindowsControlChildVisibilityChanged(uiWindowsControl *);
{ \
SetFocus(type(c)->hwnd); \
}
+#define uiWindowsControlDefaultSetMinSize(type) \
+ static void type ## SetMinSize(uiControl *c, int w, int h) \
+ { \
+ }
#define uiWindowsControlDefaultSyncEnableState(type) \
static void type ## SyncEnableState(uiWindowsControl *c, int enabled) \
{ \
@@ -158,6 +162,7 @@ _UI_EXTERN void uiWindowsControlChildVisibilityChanged(uiWindowsControl *);
uiWindowsControlDefaultEnable(type) \
uiWindowsControlDefaultDisable(type) \
uiWindowsControlDefaultSetFocus(type) \
+ uiWindowsControlDefaultSetMinSize(type) \
uiWindowsControlDefaultSyncEnableState(type) \
uiWindowsControlDefaultSetParentHWND(type) \
uiWindowsControlDefaultMinimumSizeChanged(type) \
@@ -184,6 +189,7 @@ _UI_EXTERN void uiWindowsControlChildVisibilityChanged(uiWindowsControl *);
uiControl(var)->Enable = type ## Enable; \
uiControl(var)->Disable = type ## Disable; \
uiControl(var)->SetFocus = type ## SetFocus; \
+ uiControl(var)->SetMinSize = type ## SetMinSize; \
uiWindowsControl(var)->SyncEnableState = type ## SyncEnableState; \
uiWindowsControl(var)->SetParentHWND = type ## SetParentHWND; \
uiWindowsControl(var)->MinimumSize = type ## MinimumSize; \
diff --git a/src/libui_sdl/libui/windows/box.cpp b/src/libui_sdl/libui/windows/box.cpp
index c306989..5ed8447 100644
--- a/src/libui_sdl/libui/windows/box.cpp
+++ b/src/libui_sdl/libui/windows/box.cpp
@@ -38,7 +38,6 @@ static void boxRelayout(uiBox *b)
int i;
int minimumWidth, minimumHeight;
int nVisible;
- uiWindowsSizing *d;
if (b->controls->size() == 0)
return;
@@ -165,10 +164,8 @@ static void uiBoxMinimumSize(uiWindowsControl *c, int *width, int *height)
// these two contain the largest minimum width and height of all stretchy controls in the box
// all stretchy controls will use this value to determine the final minimum size
int maxStretchyWidth, maxStretchyHeight;
- int i;
int minimumWidth, minimumHeight;
int nVisible;
- uiWindowsSizing sizing;
*width = 0;
*height = 0;
@@ -235,6 +232,12 @@ static void uiBoxMinimumSizeChanged(uiWindowsControl *c)
boxRelayout(b);
}
+static void uiBoxSetMinSize(uiControl *c, int w, int h)
+{
+ // checkme
+ uiBoxMinimumSizeChanged(uiWindowsControl(c));
+}
+
uiWindowsControlDefaultLayoutRect(uiBox)
uiWindowsControlDefaultAssignControlIDZOrder(uiBox)
diff --git a/src/libui_sdl/libui/windows/colordialog.cpp b/src/libui_sdl/libui/windows/colordialog.cpp
index 2efe72c..9c2551a 100644
--- a/src/libui_sdl/libui/windows/colordialog.cpp
+++ b/src/libui_sdl/libui/windows/colordialog.cpp
@@ -87,7 +87,6 @@ static void hsv2RGB(double h, double s, double v, double *r, double *g, double *
int h60;
double x;
double m;
- double c1, c2;
c = v * s;
hPrime = h * 6;
diff --git a/src/libui_sdl/libui/windows/form.cpp b/src/libui_sdl/libui/windows/form.cpp
index 83ed587..65ef539 100644
--- a/src/libui_sdl/libui/windows/form.cpp
+++ b/src/libui_sdl/libui/windows/form.cpp
@@ -232,6 +232,12 @@ static void uiFormMinimumSizeChanged(uiWindowsControl *c)
formRelayout(f);
}
+static void uiFormSetMinSize(uiControl *c, int w, int h)
+{
+ // checkme
+ uiFormMinimumSizeChanged(uiWindowsControl(c));
+}
+
uiWindowsControlDefaultLayoutRect(uiForm)
uiWindowsControlDefaultAssignControlIDZOrder(uiForm)
diff --git a/src/libui_sdl/libui/windows/grid.cpp b/src/libui_sdl/libui/windows/grid.cpp
index 78719ac..0a854c5 100644
--- a/src/libui_sdl/libui/windows/grid.cpp
+++ b/src/libui_sdl/libui/windows/grid.cpp
@@ -516,6 +516,12 @@ static void uiGridMinimumSizeChanged(uiWindowsControl *c)
gridRelayout(g);
}
+static void uiGridSetMinSize(uiControl *c, int w, int h)
+{
+ // checkme
+ uiGridMinimumSizeChanged(uiWindowsControl(c));
+}
+
uiWindowsControlDefaultLayoutRect(uiGrid)
uiWindowsControlDefaultAssignControlIDZOrder(uiGrid)
diff --git a/src/libui_sdl/libui/windows/group.cpp b/src/libui_sdl/libui/windows/group.cpp
index f78e7de..9c36da1 100644
--- a/src/libui_sdl/libui/windows/group.cpp
+++ b/src/libui_sdl/libui/windows/group.cpp
@@ -119,6 +119,12 @@ static void uiGroupMinimumSizeChanged(uiWindowsControl *c)
groupRelayout(g);
}
+static void uiGroupSetMinSize(uiControl *c, int w, int h)
+{
+ // checkme
+ uiGroupMinimumSizeChanged(uiWindowsControl(c));
+}
+
uiWindowsControlDefaultLayoutRect(uiGroup)
uiWindowsControlDefaultAssignControlIDZOrder(uiGroup)
diff --git a/src/libui_sdl/libui/windows/tab.cpp b/src/libui_sdl/libui/windows/tab.cpp
index ea6209b..93373b0 100644
--- a/src/libui_sdl/libui/windows/tab.cpp
+++ b/src/libui_sdl/libui/windows/tab.cpp
@@ -164,6 +164,12 @@ static void uiTabMinimumSizeChanged(uiWindowsControl *c)
tabRelayout(t);
}
+static void uiTabSetMinSize(uiControl *c, int w, int h)
+{
+ // checkme
+ uiTabMinimumSizeChanged(uiWindowsControl(c));
+}
+
uiWindowsControlDefaultLayoutRect(uiTab)
uiWindowsControlDefaultAssignControlIDZOrder(uiTab)
diff --git a/src/libui_sdl/libui/windows/window.cpp b/src/libui_sdl/libui/windows/window.cpp
index 44fb306..50a01c6 100644
--- a/src/libui_sdl/libui/windows/window.cpp
+++ b/src/libui_sdl/libui/windows/window.cpp
@@ -309,6 +309,11 @@ static void uiWindowLayoutRect(uiWindowsControl *c, RECT *r)
uiWindowsEnsureGetClientRect(w->hwnd, r);
}
+static void uiWindowSetMinSize(uiControl *c, int w, int h)
+{
+ // TODO: relayout, eventually
+}
+
uiWindowsControlDefaultAssignControlIDZOrder(uiWindow)
static void uiWindowChildVisibilityChanged(uiWindowsControl *c)