From 660377934ba2b1424940356baa3995f8fe6ad722 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 14 May 2015 13:42:28 -0400 Subject: [PATCH] Added an initial windows/container.c. --- redo/windows/container.c | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 redo/windows/container.c diff --git a/redo/windows/container.c b/redo/windows/container.c new file mode 100644 index 00000000..76a1e3b6 --- /dev/null +++ b/redo/windows/container.c @@ -0,0 +1,63 @@ +// 26 april 2015 +#include "uipriv_windows.h" + +// Code for containers. uiMakeContainer() creates a singleHWND of this window class. + +#define containerClass L"libui_uiContainerClass"} + +static LRESULT CALLBACK containerWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ +/* TODO + RECT r; + HDC dc; + PAINTSTRUCT ps; + + switch (uMsg) { + case WM_PAINT: + dc = BeginPaint(hwnd, &ps); + if (dc == NULL) + logLastError("error beginning container paint in containerWndProc()"); + r = ps.rcPaint; + paintContainerBackground(hwnd, dc, &r); + EndPaint(hwnd, &ps); + return 0; + // tab controls use this to draw the background of the tab area + case WM_PRINTCLIENT: + if (GetClientRect(hwnd, &r) == 0) + logLastError("error getting client rect in containerWndProc()"); + paintContainerBackground(hwnd, (HDC) wParam, &r); + return 0; + case WM_ERASEBKGND: + // avoid some flicker + // we draw the whole update area anyway + return 1; + } +*/ + + return DefWindowProcW(hwnd, uMsg, wParam, lParam); +} + +ATOM initContainer(HICON hDefaultIcon, HCURSOR hDefaultCursor) +{ + WNDCLASSW wc; + + ZeroMemory(&wc, sizeof (WNDCLASSW)); + wc.lpszClassName = containerClass; + wc.lpfnWndProc = containerWndProc; + wc.hInstance = hInstance; + wc.hIcon = hDefaultIcon; + wc.hCursor = hDefaultCursor; + wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); + return RegisterClassW(&wc); +} + +void uninitContainer(void) +{ + if (UnregisterClassW(containerClass, hInstance) == 0) + logLastError("error unregistering uiContainer window class in uninitContainer()"); +} + +void uiMakeContainer(uiContainer *c) +{ + // TODO +}