Fixed the other build errors and warnings. Removed lifetimes.c.
This commit is contained in:
parent
a3d89b614c
commit
344bae4ca4
|
@ -24,7 +24,6 @@ baseHFILES = \
|
||||||
|
|
||||||
baseCFILES = \
|
baseCFILES = \
|
||||||
box.c \
|
box.c \
|
||||||
lifetimes.c \
|
|
||||||
$(osCFILES)
|
$(osCFILES)
|
||||||
|
|
||||||
baseMFILES = $(osMFILES)
|
baseMFILES = $(osMFILES)
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
// 25 april 2015
|
|
||||||
#include "ui.h"
|
|
||||||
#include "uipriv.h"
|
|
||||||
|
|
||||||
// called by uiParentDestroy() and any container control in its uiControlDestroy()
|
|
||||||
void properlyDestroyControl(uiControl *c)
|
|
||||||
{
|
|
||||||
uiControlSetOSContainer(c, NULL);
|
|
||||||
uiControlSetHasParent(c, 0);
|
|
||||||
uiControlDestroy(c);
|
|
||||||
}
|
|
|
@ -97,7 +97,7 @@ const char *uiInit(uiInitOptions *o)
|
||||||
if (hMessageFont == NULL)
|
if (hMessageFont == NULL)
|
||||||
return loadLastError("loading default messagebox font; this is the default UI font");
|
return loadLastError("loading default messagebox font; this is the default UI font");
|
||||||
|
|
||||||
ce = initOSContainer(hDefaultIcon, hDefaultCursor);
|
ce = initContainer(hDefaultIcon, hDefaultCursor);
|
||||||
if (ce != NULL)
|
if (ce != NULL)
|
||||||
return loadLastError(ce);
|
return loadLastError(ce);
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,9 @@ extern const char *initCommonControls(void);
|
||||||
// window.c
|
// window.c
|
||||||
extern ATOM registerWindowClass(HICON, HCURSOR);
|
extern ATOM registerWindowClass(HICON, HCURSOR);
|
||||||
|
|
||||||
// parent.c
|
// container.c
|
||||||
extern HWND initialOSContainer;
|
extern HWND initialParent;
|
||||||
extern const char *initOSContainer(HICON, HCURSOR);
|
extern const char *initContainer(HICON, HCURSOR);
|
||||||
|
|
||||||
// menu.c
|
// menu.c
|
||||||
extern HMENU makeMenubar(void);
|
extern HMENU makeMenubar(void);
|
||||||
|
|
|
@ -20,7 +20,7 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
|
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
|
||||||
WINDOWPOS *wp = (WINDOWPOS *) lParam;
|
WINDOWPOS *wp = (WINDOWPOS *) lParam;
|
||||||
RECT r;
|
RECT r;
|
||||||
HWND boxhwnd;
|
HWND binhwnd;
|
||||||
|
|
||||||
w = (struct window *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
w = (struct window *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||||
if (w == NULL) {
|
if (w == NULL) {
|
||||||
|
@ -45,13 +45,13 @@ static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
case msgUpdateChild:
|
case msgUpdateChild:
|
||||||
if (GetClientRect(w->hwnd, &r) == 0)
|
if (GetClientRect(w->hwnd, &r) == 0)
|
||||||
logLastError("error getting window client rect for resize in uiWindowWndProc()");
|
logLastError("error getting window client rect for resize in uiWindowWndProc()");
|
||||||
boxhwnd = (HWND) uiControlHandle(uiControl(w->box));
|
binhwnd = (HWND) uiControlHandle(uiControl(w->bin));
|
||||||
if (MoveWindow(boxhwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE) == 0)
|
if (MoveWindow(binhwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, TRUE) == 0)
|
||||||
logLastError("error resizing uiWindow box in windowWndProc()");
|
logLastError("error resizing uiWindow box in windowWndProc()");
|
||||||
return 0;
|
return 0;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
if (!(*(w->onClosing))(uiWindow(w), w->onClosingData))
|
if (!(*(w->onClosing))(uiWindow(w), w->onClosingData))
|
||||||
uiWindowDestroy(uiWindow(w));
|
uiControlDestroy(uiControl(w));
|
||||||
return 0; // we destroyed it already
|
return 0; // we destroyed it already
|
||||||
}
|
}
|
||||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||||
|
@ -99,7 +99,7 @@ static uintptr_t windowHandle(uiControl *c)
|
||||||
return (uintptr_t) (w->hwnd);
|
return (uintptr_t) (w->hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowSetParent(uiControl *c)
|
static void windowSetParent(uiControl *c, uiContainer *parent)
|
||||||
{
|
{
|
||||||
complain("attempt to give the uiWindow at %p a parent", c);
|
complain("attempt to give the uiWindow at %p a parent", c);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ static int windowVisible(uiControl *c)
|
||||||
return !w->hidden;
|
return !w->hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowShow(uiControl *w)
|
static void windowShow(uiControl *c)
|
||||||
{
|
{
|
||||||
struct window *w = (struct window *) c;
|
struct window *w = (struct window *) c;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ static void windowShow(uiControl *w)
|
||||||
w->hidden = 0;
|
w->hidden = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowHide(uiControl *w)
|
static void windowHide(uiControl *c)
|
||||||
{
|
{
|
||||||
struct window *w = (struct window *) c;
|
struct window *w = (struct window *) c;
|
||||||
|
|
||||||
|
@ -174,12 +174,12 @@ static char *windowTitle(uiWindow *ww)
|
||||||
static void windowSetTitle(uiWindow *ww, const char *title)
|
static void windowSetTitle(uiWindow *ww, const char *title)
|
||||||
{
|
{
|
||||||
struct window *w = (struct window *) ww;
|
struct window *w = (struct window *) ww;
|
||||||
WCHAR *wtext;
|
WCHAR *wtitle;
|
||||||
|
|
||||||
wtext = toUTF16(text);
|
wtitle = toUTF16(title);
|
||||||
if (SetWindowTextW(w->hwnd, wtext) == 0)
|
if (SetWindowTextW(w->hwnd, wtitle) == 0)
|
||||||
logLastError("error setting window title in uiWindowSetTitle()");
|
logLastError("error setting window title in uiWindowSetTitle()");
|
||||||
uiFree(wtext);
|
uiFree(wtitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowOnClosing(uiWindow *ww, int (*f)(uiWindow *, void *), void *data)
|
static void windowOnClosing(uiWindow *ww, int (*f)(uiWindow *, void *), void *data)
|
||||||
|
@ -233,6 +233,9 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
if (hasMenubar)
|
if (hasMenubar)
|
||||||
hasMenubarBOOL = TRUE;
|
hasMenubarBOOL = TRUE;
|
||||||
|
|
||||||
|
#define style WS_OVERLAPPEDWINDOW
|
||||||
|
#define exstyle 0
|
||||||
|
|
||||||
adjust.left = 0;
|
adjust.left = 0;
|
||||||
adjust.top = 0;
|
adjust.top = 0;
|
||||||
adjust.right = width;
|
adjust.right = width;
|
||||||
|
@ -242,9 +245,9 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
logLastError("error getting real window coordinates in uiNewWindow()");
|
logLastError("error getting real window coordinates in uiNewWindow()");
|
||||||
|
|
||||||
wtitle = toUTF16(title);
|
wtitle = toUTF16(title);
|
||||||
w->hwnd = CreateWindowExW(0,
|
w->hwnd = CreateWindowExW(exstyle,
|
||||||
windowClass, wtitle,
|
windowClass, wtitle,
|
||||||
WS_OVERLAPPEDWINDOW,
|
style,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
adjust.right - adjust.left, adjust.bottom - adjust.top,
|
adjust.right - adjust.left, adjust.bottom - adjust.top,
|
||||||
NULL, NULL, hInstance, w);
|
NULL, NULL, hInstance, w);
|
||||||
|
@ -261,6 +264,8 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
logLastError("error giving menu to window in uiNewWindow()");
|
logLastError("error giving menu to window in uiNewWindow()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w->onClosing = defaultOnClosing;
|
||||||
|
|
||||||
uiControl(w)->Destroy = windowDestroy;
|
uiControl(w)->Destroy = windowDestroy;
|
||||||
uiControl(w)->Handle = windowHandle;
|
uiControl(w)->Handle = windowHandle;
|
||||||
uiControl(w)->SetParent = windowSetParent;
|
uiControl(w)->SetParent = windowSetParent;
|
||||||
|
|
Loading…
Reference in New Issue