Finished Windows conversion. Works perfectly!

This commit is contained in:
Pietro Gagliardi 2015-04-09 17:57:08 -04:00
parent 924d6d6a7c
commit d84df8f38f
5 changed files with 30 additions and 11 deletions

View File

@ -88,12 +88,12 @@ void resize(uiControl *control, HWND parent, RECT r, RECT margin)
logLastError("error restoring previous font into device context in resize()");
if (ReleaseDC(parent, dc) == 0)
logLastError("error releasing DC in resize()");
r.left += uiDlgUnitToX(margin.left, d.baseX);
r.top += uiDlgUnitToY(margin.top, d.baseY);
r.right -= uiDlgUnitToX(margin.right, d.baseX);
r.bottom -= uiDlgUnitToY(margin.bottom, d.baseY);
d.xPadding = uiDlgUnitToX(winXPadding, d.baseX);
d.yPadding = uiDlgUnitToY(winYPadding, d.baseY);
r.left += uiDlgUnitToX(margin.left, sys.baseX);
r.top += uiDlgUnitToY(margin.top, sys.baseY);
r.right -= uiDlgUnitToX(margin.right, sys.baseX);
r.bottom -= uiDlgUnitToY(margin.bottom, sys.baseY);
d.xPadding = uiDlgUnitToX(winXPadding, sys.baseX);
d.yPadding = uiDlgUnitToY(winYPadding, sys.baseY);
d.sys = &sys;
uiControlResize(control, r.left, r.top, r.right - r.left, r.bottom - r.top, &d);
}

View File

@ -11,4 +11,22 @@ uintptr_t uiControlHandle(uiControl *c)
return (*(c->handle))(c);
}
// TODO do this for the others
void uiControlSetParent(uiControl *c, uintptr_t parent)
{
(*(c->setParent))(c, parent);
}
void uiControlRemoveParent(uiControl *c)
{
(*(c->removeParent))(c);
}
void uiControlPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
{
(*(c->preferredSize))(c, d, width, height);
}
void uiControlResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
{
(*(c->resize))(c, x, y, width, height, d);
}

View File

@ -4,12 +4,12 @@
struct entry {
};
static BOOL onWM_COMMAND(uiControl *c, WPARAM wParam, LPARAM lParam, void *data, LRESULT *lResult)
static BOOL onWM_COMMAND(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
{
return FALSE;
}
static BOOL onWM_NOTIFY(uiControl *c, WPARAM wParam, LPARAM lParam, void *data, LRESULT *lResult)
static BOOL onWM_NOTIFY(uiControl *c, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
{
return FALSE;
}

View File

@ -3,7 +3,7 @@
typedef struct singleHWND singleHWND;
struct uiSingleHWNDControl {
struct singleHWND {
HWND hwnd;
BOOL (*onWM_COMMAND)(uiControl *, WPARAM, LPARAM, LRESULT *);
BOOL (*onWM_NOTIFY)(uiControl *, WPARAM, LPARAM, LRESULT *);

3
ui.h
View File

@ -18,10 +18,11 @@ void uiQuit(void);
void uiFreeText(char *);
typedef struct uiSizing uiSizing;
typedef struct uiSizingSys uiSizingSys;
struct uiSizing {
intmax_t xPadding;
intmax_t yPadding;
struct uiSizingSys *sys;
uiSizingSys *sys;
};
typedef struct uiControl uiControl;