From: <kr_...@us...> - 2003-10-11 08:50:58
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv15983/src/cbits/Win32 Modified Files: Window.c Log Message: Add size grippers to resizeable dialogs Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Window.c 10 Oct 2003 22:55:13 -0000 1.55 --- Window.c 11 Oct 2003 08:50:54 -0000 1.56 *************** *** 23,26 **** --- 23,27 ---- HWND hTooltip; + HWND hGripWnd; } WindowData; *************** *** 126,129 **** --- 127,159 ---- } + static void EnableGripWindow(HWND hWnd, BOOL bEnabled) + { + WindowData *pData = (WindowData *) GetWindowLong(hWnd,GWL_USERDATA); + + if (GetParent(hWnd) != NULL) + return; + + if (bEnabled) + { + if (pData->hGripWnd) + return; + + pData->hGripWnd = + CreateWindow("SCROLLBAR", + NULL, + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SBS_SIZEGRIP, + 0,0,0,0, + hWnd, + NULL, + ghModule, + NULL); + } + else + { + DestroyWindow(pData->hGripWnd); + pData->hGripWnd = NULL; + } + } + LRESULT CALLBACK HWindowSharedFunction(WNDPROC pDefWindowProc, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { *************** *** 153,156 **** --- 183,187 ---- pData->disabledCtrls = NULL; pData->hTooltip = NULL; + pData->hGripWnd = NULL; SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); *************** *** 662,667 **** LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) ! { case WM_DESTROY: { --- 693,701 ---- LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + LRESULT lResult; + WindowData *pData = (WindowData *) GetWindowLong(hWnd,GWL_USERDATA); + switch (uMsg) ! { case WM_DESTROY: { *************** *** 690,694 **** } ! return HWindowSharedFunction(DefDlgProc, hWnd, uMsg, wParam, lParam); } --- 724,749 ---- } ! lResult = HWindowSharedFunction(DefDlgProc, hWnd, uMsg, wParam, lParam); ! ! switch (uMsg) ! { ! case WM_CREATE: ! EnableGripWindow(hWnd, TRUE); ! break; ! case WM_SIZE: ! if (pData->hGripWnd) ! { ! int nWidth = LOWORD(lParam); ! int nHeight = HIWORD(lParam); ! int nGripWidth = GetSystemMetrics(SM_CXVSCROLL); ! int nGripHeight = GetSystemMetrics(SM_CYHSCROLL); ! ! SetWindowPos(pData->hGripWnd,NULL, ! nWidth-nGripWidth,nHeight-nGripHeight,nGripWidth,nGripHeight,SWP_NOZORDER); ! } ! break; ! } ! ! return lResult; } *************** *** 1374,1377 **** --- 1429,1434 ---- style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX); SetWindowLong(hTargetWnd, GWL_STYLE, style); + + EnableGripWindow(hwnd, resizeable); GetWindowRect(hTargetWnd,&rc); |