Migrated control.c, I think. Changing the current way uiControl works will wait for another branch.
This commit is contained in:
parent
dafdaa4de4
commit
277fa5d6bd
|
@ -15,13 +15,16 @@ HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCW
|
||||||
// use a nonzero initial size just in case some control breaks with a zero initial size
|
// use a nonzero initial size just in case some control breaks with a zero initial size
|
||||||
100, 100,
|
100, 100,
|
||||||
utilWindow, NULL, hInstance, lpParam);
|
utilWindow, NULL, hInstance, lpParam);
|
||||||
if (hwnd == NULL)
|
if (hwnd == NULL) {
|
||||||
logLastError("error creating window in uiWindowsUtilCreateControlHWND()");
|
logLastError("error creating window");
|
||||||
|
// TODO return a decoy window
|
||||||
|
}
|
||||||
if (useStandardControlFont)
|
if (useStandardControlFont)
|
||||||
SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE);
|
SendMessageW(hwnd, WM_SETFONT, (WPARAM) hMessageFont, (LPARAM) TRUE);
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO make this unnecessary
|
||||||
static uintmax_t type_uiWindowsControl = 0;
|
static uintmax_t type_uiWindowsControl = 0;
|
||||||
|
|
||||||
uintmax_t uiWindowsControlType(void)
|
uintmax_t uiWindowsControlType(void)
|
||||||
|
@ -57,27 +60,6 @@ void uiWindowsFinishControl(uiControl *c)
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void uiWindowsRearrangeControlIDsZOrder(uiControl *c)
|
void uiWindowsRearrangeControlIDsZOrder(uiControl *c)
|
||||||
{
|
{
|
||||||
uiWindowsControl *wc;
|
uiWindowsControl *wc;
|
|
@ -85,3 +85,23 @@ noTextOrError:
|
||||||
uiFree(text);
|
uiFree(text);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *uiWindowsWindowText(HWND hwnd)
|
||||||
|
{
|
||||||
|
WCHAR *wtext;
|
||||||
|
char *text;
|
||||||
|
|
||||||
|
wtext = windowText(hwnd);
|
||||||
|
text = toUTF8(wtext);
|
||||||
|
uiFree(wtext);
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiWindowsSetWindowText(HWND hwnd, const char *text)
|
||||||
|
{
|
||||||
|
WCHAR *wtext;
|
||||||
|
|
||||||
|
wtext = toUTF16(text);
|
||||||
|
setWindowText(hwnd, wtext);
|
||||||
|
uiFree(wtext);
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// 21 april 2016
|
// 21 april 2016
|
||||||
|
|
||||||
|
// TODO document
|
||||||
|
_UI_EXTERN HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, HINSTANCE hInstance, LPVOID lpParam, BOOL useStandardControlFont);
|
||||||
|
|
||||||
// TODO document
|
// TODO document
|
||||||
_UI_EXTERN void uiWindowsEnsureDestroyWindow(HWND hwnd);
|
_UI_EXTERN void uiWindowsEnsureDestroyWindow(HWND hwnd);
|
||||||
|
|
||||||
|
@ -9,6 +12,10 @@ _UI_EXTERN void uiWindowsEnsureSetParent(HWND hwnd, HWND parent);
|
||||||
// TODO document
|
// TODO document
|
||||||
_UI_EXTERN void uiWindowsEnsureAssignControlIDZOrder(HWND hwnd, LONG_PTR controlID, HWND insertAfter);
|
_UI_EXTERN void uiWindowsEnsureAssignControlIDZOrder(HWND hwnd, LONG_PTR controlID, HWND insertAfter);
|
||||||
|
|
||||||
|
// TODO document
|
||||||
|
_UI_EXTERN char *uiWindowsWindowText(HWND hwnd);
|
||||||
|
_UI_EXTERN void uiWindowsSetWindowText(HWND hwnd, const char *text);
|
||||||
|
|
||||||
// TODO document
|
// TODO document
|
||||||
_UI_EXTERN intmax_t uiWindowsWindowTextWidth(HWND hwnd);
|
_UI_EXTERN intmax_t uiWindowsWindowTextWidth(HWND hwnd);
|
||||||
|
|
||||||
|
@ -27,3 +34,11 @@ _UI_EXTERN void uiWindowsUnregisterWM_HSCROLLHandler(HWND hwnd);
|
||||||
// TODO document
|
// TODO document
|
||||||
_UI_EXTERN void uiWindowsRegisterReceiveWM_WININICHANGE(HWND hwnd);
|
_UI_EXTERN void uiWindowsRegisterReceiveWM_WININICHANGE(HWND hwnd);
|
||||||
_UI_EXTERN void uiWindowsUnregisterReceiveWM_WININICHANGE(HWND hwnd);
|
_UI_EXTERN void uiWindowsUnregisterReceiveWM_WININICHANGE(HWND hwnd);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// everything below here is TODO
|
||||||
|
|
||||||
|
_UI_EXTERN void uiWindowsFinishControl(uiControl *c);
|
||||||
|
_UI_EXTERN void uiWindowsRearrangeControlIDsZOrder(uiControl *c);
|
||||||
|
|
Loading…
Reference in New Issue