Fixed linker errors. Now for runtime errors.
This commit is contained in:
parent
099d15b638
commit
993cb67ba4
|
@ -57,7 +57,7 @@ void uninitContainer(void)
|
||||||
logLastError("error unregistering container window class in uninitContainer()");
|
logLastError("error unregistering container window class in uninitContainer()");
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND makeContainer(void)
|
HWND newContainer(void)
|
||||||
{
|
{
|
||||||
return uiWindowsEnsureCreateControlHWND(WS_EX_CONTROLPARENT,
|
return uiWindowsEnsureCreateControlHWND(WS_EX_CONTROLPARENT,
|
||||||
containerClass, L"",
|
containerClass, L"",
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
// 16 august 2015
|
// 16 august 2015
|
||||||
#include "uipriv_windows.h"
|
#include "uipriv_windows.h"
|
||||||
|
|
||||||
|
HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, HINSTANCE hInstance, LPVOID lpParam, BOOL useStandardControlFont)
|
||||||
|
{
|
||||||
|
HWND hwnd;
|
||||||
|
|
||||||
|
hwnd = CreateWindowExW(dwExStyle,
|
||||||
|
lpClassName, lpWindowName,
|
||||||
|
dwStyle | WS_CHILD | WS_VISIBLE,
|
||||||
|
0, 0,
|
||||||
|
// use a nonzero initial size just in case some control breaks with a zero initial size
|
||||||
|
100, 100,
|
||||||
|
utilWindow, NULL, hInstance, lpParam);
|
||||||
|
if (hwnd == NULL)
|
||||||
|
logLastError("error creating window in uiWindowsUtilCreateControlHWND()");
|
||||||
|
if (useStandardControlFont)
|
||||||
|
SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE);
|
||||||
|
return hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
static uintmax_t type_uiWindowsControl = 0;
|
static uintmax_t type_uiWindowsControl = 0;
|
||||||
|
|
||||||
uintmax_t uiWindowsControlType(void)
|
uintmax_t uiWindowsControlType(void)
|
||||||
|
@ -35,3 +53,24 @@ void uiWindowsFinishControl(uiControl *c)
|
||||||
c->CommitShow = defaultCommitShow;
|
c->CommitShow = defaultCommitShow;
|
||||||
c->CommitHide = defaultCommitHide;
|
c->CommitHide = defaultCommitHide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *uiWindowsUtilText(HWND hwnd)
|
||||||
|
{
|
||||||
|
WCHAR *wtext;
|
||||||
|
char *text;
|
||||||
|
|
||||||
|
wtext = windowText(hwnd);
|
||||||
|
text = toUTF8(wtext);
|
||||||
|
uiFree(wtext);
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiWindowsUtilSetText(HWND hwnd, const char *text)
|
||||||
|
{
|
||||||
|
WCHAR *wtext;
|
||||||
|
|
||||||
|
wtext = toUTF16(text);
|
||||||
|
if (SetWindowTextW(hwnd, wtext) == 0)
|
||||||
|
logLastError("error setting control text in uiWindowsControlSetText()");
|
||||||
|
uiFree(wtext);
|
||||||
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ static void onDestroy(uiRadioButtons *r)
|
||||||
hwnd = ptrArrayIndex(r->hwnds, HWND, 0);
|
hwnd = ptrArrayIndex(r->hwnds, HWND, 0);
|
||||||
ptrArrayDelete(r->hwnds, 0);
|
ptrArrayDelete(r->hwnds, 0);
|
||||||
uiWindowsUnregisterWM_COMMANDHandler(hwnd);
|
uiWindowsUnregisterWM_COMMANDHandler(hwnd);
|
||||||
uiWindowsUtilDestroy(hwnd);
|
uiWindowsEnsureDestroyWindow(hwnd);
|
||||||
}
|
}
|
||||||
ptrArrayDestroy(r->hwnds);
|
ptrArrayDestroy(r->hwnds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,18 +15,18 @@ void uninitResizes(void)
|
||||||
ptrArrayDestroy(resizes);
|
ptrArrayDestroy(resizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void queueResize(uiControl *c)
|
void uiWindowsControlQueueRelayout(uiWindowsControl *c)
|
||||||
{
|
{
|
||||||
uintmax_t i;
|
uintmax_t i;
|
||||||
uiControl *d;
|
uiWindowsControl *d;
|
||||||
|
|
||||||
// resizing a control requires us to reocmpute the sizes of everything in the top-level window
|
// resizing a control requires us to reocmpute the sizes of everything in the top-level window
|
||||||
c = toplevelOwning(c);
|
c = uiWindowsControl(toplevelOwning(uiControl(c)));
|
||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
return;
|
return;
|
||||||
// make sure we're only queued once
|
// make sure we're only queued once
|
||||||
for (i = 0 ; i < resizes->len; i++) {
|
for (i = 0 ; i < resizes->len; i++) {
|
||||||
d = ptrArrayIndex(resizes, uiControl *, i);
|
d = ptrArrayIndex(resizes, uiWindowsControl *, i);
|
||||||
if (c == d)
|
if (c == d)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ void doResizes(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveWindow(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiWindowsSizing *d)
|
void uiWindowsEnsureMoveWindow(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
|
|
|
@ -80,3 +80,15 @@ void setExStyle(HWND hwnd, DWORD exstyle)
|
||||||
{
|
{
|
||||||
SetWindowLongPtrW(hwnd, GWL_EXSTYLE, (LONG_PTR) exstyle);
|
SetWindowLongPtrW(hwnd, GWL_EXSTYLE, (LONG_PTR) exstyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiWindowsEnsureDestroyWindow(HWND hwnd)
|
||||||
|
{
|
||||||
|
if (DestroyWindow(hwnd) == 0)
|
||||||
|
logLastError("error destroying window in uiWindowsEnsureDestroyWindow");
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiWindowsEnsureSetParent(HWND hwnd, HWND parent)
|
||||||
|
{
|
||||||
|
if (SetParent(hwnd, parent) == 0)
|
||||||
|
logLastError("error setting window parent in uiWindowsEnsureSetParent");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue