More object implementation mocking. Windows-specific common code.
This commit is contained in:
parent
3c68e73dea
commit
d88282a676
|
@ -0,0 +1,75 @@
|
|||
// 27 may 2015
|
||||
#include "uipriv_windows.h"
|
||||
|
||||
#define HWND(c) ((HWND) uiControlHandle((c)))
|
||||
|
||||
void uiWindowsUtilDestroy(HWND hwnd)
|
||||
{
|
||||
if (DestroyWindow(hwnd) == 0)
|
||||
logLastError("error destroying window in uiWindowsUtilDestroyWindow()");
|
||||
}
|
||||
|
||||
void uiWindowsSingleHWNDControlCommitDestroy(uiControl *c)
|
||||
{
|
||||
uiWindowsUtilDestroy(HWND(c));
|
||||
}
|
||||
|
||||
void uiWindowsUtilSetParent(HWND hwnd, uiControl *parent)
|
||||
{
|
||||
HWND newParent;
|
||||
|
||||
newParent = utilWindow;
|
||||
if (parent != NULL)
|
||||
newParent = HWND(parent);
|
||||
if (SetParent(hwnd, newParent) == 0)
|
||||
logLastError("error changing window parent in uiWindowsUtilSetParent()");
|
||||
}
|
||||
|
||||
void uiWindowsSingleHWNDControlCommitSetParent(uiControl *c, uiControl *parent)
|
||||
{
|
||||
uiWindowsUtilSetParent(HWND(c), parent);
|
||||
}
|
||||
|
||||
// TODO resizing
|
||||
|
||||
void uiWIndowsUtilShow(HWND hwnd)
|
||||
{
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
}
|
||||
|
||||
void uiWindowsSingleHWNDControlCommitShow(uiControl *c)
|
||||
{
|
||||
uiWindowsUtilShow(HWND(c));
|
||||
}
|
||||
|
||||
void uiWindowsUtilHide(HWND hwnd)
|
||||
{
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
}
|
||||
|
||||
void uiWindowsSingleHWNDControlCommitHide(uiControl *c)
|
||||
{
|
||||
uiWindowsUtilHide(HWND(c));
|
||||
}
|
||||
|
||||
void uiWIndowsUtilEnable(HWND hwnd)
|
||||
{
|
||||
EnableWindow(hwnd, TRUE);
|
||||
}
|
||||
|
||||
void uiWindowsSingleHWNDControlCommitEnable(uiControl *c)
|
||||
{
|
||||
uiWindowsUtilEnable(HWND(c));
|
||||
}
|
||||
|
||||
void uiWindowsUtilDisable(HWND hwnd)
|
||||
{
|
||||
EnableWindow(hwnd, FALSE);
|
||||
}
|
||||
|
||||
void uiWindowsSingleHWNDControlCommitDisable(uiControl *c)
|
||||
{
|
||||
uiWindowsUtilDisable(HWND(c));
|
||||
}
|
||||
|
||||
// TODO sysfunc and zorder
|
|
@ -144,12 +144,18 @@ const char *uiInit(uiInitOptions *o)
|
|||
if (initDialogHelper(hDefaultIcon, hDefaultCursor) == 0)
|
||||
return loadLastError("initializing the dialog helper");
|
||||
|
||||
// TODO initialize COM
|
||||
// TODO initialize COM security
|
||||
// TODO (windows vista) turn off COM exception handling
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void uiUninit(void)
|
||||
{
|
||||
uninitMenus();
|
||||
// TODO uninitialize COM
|
||||
// TODO uninitialize the dialog helper
|
||||
// TODO delete hollow brush
|
||||
if (SetConsoleCtrlHandler(consoleCtrlHandler, FALSE) == 0)
|
||||
logLastError("unregistering console end session handler");
|
||||
|
|
Loading…
Reference in New Issue