Fixed build issues. Now I just need to hook resizing into uiWindow and implement a control and we'll be set...

This commit is contained in:
Pietro Gagliardi 2015-04-07 03:12:34 -04:00
parent 54259ed98b
commit a09430113f
5 changed files with 13 additions and 4 deletions

View File

@ -84,7 +84,7 @@ uiInitError *uiInit(uiInitOptions *o)
// give each control a reasonable initial parent // give each control a reasonable initial parent
// don't free the initial parent! // don't free the initial parent!
// TODO tune this better; it shouldn't be closed, for instance // TODO tune this better; it shouldn't be closed, for instance
initialParent = uiWindowHandle(uiNewWindow("", 0, 0)); initialParent = (HWND) uiWindowHandle(uiNewWindow("", 0, 0));
uiFree(err); uiFree(err);
return NULL; return NULL;

View File

@ -100,7 +100,7 @@ uiControl *uiWindowsNewControl(uiWindowsNewControlParams *p)
c->onCommandNotifyData = p->onCommandNotifyData; c->onCommandNotifyData = p->onCommandNotifyData;
c->preferredSize = p->preferredSize; c->preferredSize = p->preferredSize;
if ((*fv_SetWindowSubclass)(c->hwnd, singleSubclassProc, 0, c) == FALSE) if ((*fv_SetWindowSubclass)(c->hwnd, singleSubclassProc, 0, (DWORD_PTR) c) == FALSE)
logLastError("error subclassing Windows control in uiWindowsNewControl()"); logLastError("error subclassing Windows control in uiWindowsNewControl()");
return (uiControl *) c; return (uiControl *) c;

2
ui.h
View File

@ -24,4 +24,6 @@ void uiWindowShow(uiWindow *);
void uiWindowHide(uiWindow *); void uiWindowHide(uiWindow *);
void uiWindowOnClosing(uiWindow *, int (*)(uiWindow *, void *), void *); void uiWindowOnClosing(uiWindow *, int (*)(uiWindow *, void *), void *);
typedef struct uiControl uiControl;
#endif #endif

View File

@ -36,6 +36,13 @@ enum {
msgNOTIFY, msgNOTIFY,
}; };
// TODO move this to the right place
struct uiSizing {
int baseX;
int baseY;
LONG internalLeading;
};
// alloc_windows.c // alloc_windows.c
extern void *uiAlloc(size_t); extern void *uiAlloc(size_t);
// TODO use this in existing files // TODO use this in existing files

View File

@ -14,7 +14,7 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
{ {
uiWindow *w; uiWindow *w;
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam; CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
LRESULT lr; LRESULT lResult;
w = (uiWindow *) GetWindowLongPtrW(hwnd, GWLP_USERDATA); w = (uiWindow *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
if (w == NULL) { if (w == NULL) {
@ -23,7 +23,7 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
// fall through to DefWindowProc() anyway // fall through to DefWindowProc() anyway
return DefWindowProcW(hwnd, uMsg, wParam, lParam); return DefWindowProcW(hwnd, uMsg, wParam, lParam);
} }
if (sharedWindowProc(hwnd, uMsg, wParam, lParam, &lResult) != FALSE) if (sharedWndProc(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
return lResult; return lResult;
switch (uMsg) { switch (uMsg) {
case WM_CLOSE: case WM_CLOSE: