From: <kr_...@us...> - 2003-10-17 12:12:32
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv17334/src/cbits/Win32 Modified Files: Internals.h Window.c Log Message: Remove hGripWnd window and draw own gripper. This simplifies implementation and makes better look and feel for colored dialogs Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Internals.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Internals.h 12 Oct 2003 23:14:57 -0000 1.11 --- Internals.h 17 Oct 2003 08:52:22 -0000 1.12 *************** *** 90,95 **** HWND hTooltip; ! HWND hGripWnd; ! SIZE MinTrackSize; } WindowData; --- 90,94 ---- HWND hTooltip; ! SIZE MinTrackSize; } WindowData; Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Window.c 12 Oct 2003 23:14:57 -0000 1.58 --- Window.c 17 Oct 2003 08:52:22 -0000 1.59 *************** *** 101,131 **** } ! 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; } } --- 101,133 ---- } ! static void DrawSizeGripLine(HDC hDC, int right, int bottom, COLORREF rgbColor, int nIndex) { ! HPEN hPen, hOldPen; ! hPen = CreatePen(PS_SOLID, 1, rgbColor); ! hOldPen = SelectObject(hDC, hPen); { ! MoveToEx(hDC,right-5+nIndex,bottom, NULL); ! LineTo(hDC,right,bottom-5+nIndex); ! MoveToEx(hDC,right-9+nIndex,bottom, NULL); ! LineTo(hDC,right,bottom-9+nIndex); ! ! MoveToEx(hDC,right-13+nIndex,bottom, NULL); ! LineTo(hDC,right,bottom-13+nIndex); } + SelectObject(hDC, hOldPen); + DeleteObject(hPen); + } + + static void DrawSizeGrip(HWND hWnd, HDC hDC) + { + RECT rect; + GetClientRect(hWnd, &rect); + + DrawSizeGripLine(hDC,rect.right,rect.bottom,RGB(255,255,255),0); + DrawSizeGripLine(hDC,rect.right,rect.bottom,GetSysColor(COLOR_3DSHADOW),1); + DrawSizeGripLine(hDC,rect.right,rect.bottom,GetSysColor(COLOR_3DSHADOW),2); + DrawSizeGripLine(hDC,rect.right,rect.bottom,GetSysColor(COLOR_3DFACE),3); } *************** *** 157,161 **** pData->disabledCtrls = NULL; pData->hTooltip = NULL; - pData->hGripWnd = NULL; pData->MinTrackSize.cx = 0; pData->MinTrackSize.cy = 0; --- 159,162 ---- *************** *** 264,267 **** --- 265,271 ---- rfree(canvas); + if (GetParent(hWnd) == NULL && (GetWindowLong(hWnd, GWL_STYLE) & WS_THICKFRAME)) + DrawSizeGrip(hWnd, ps.hdc); + EndPaint(hWnd, &ps); } *************** *** 269,272 **** --- 273,287 ---- case WM_ERASEBKGND: return TRUE; + case WM_SIZING: + if (GetParent(hWnd) == NULL && (GetWindowLong(hWnd, GWL_STYLE) & WS_THICKFRAME)) + { + RECT rect; + GetClientRect(hWnd,&rect); + + rect.left = rect.right-14; + rect.top = rect.bottom-14; + InvalidateRect(hWnd,&rect,TRUE); + } + break; case WM_SIZE: { *************** *** 676,680 **** LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - LRESULT lResult; WindowData *pData = (WindowData *) GetWindowLong(hWnd,GWL_USERDATA); --- 691,694 ---- *************** *** 716,741 **** } ! 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; } --- 730,734 ---- } ! return HWindowSharedFunction(DefDlgProc, hWnd, uMsg, wParam, lParam); } *************** *** 1422,1427 **** SetWindowLong(hTargetWnd, GWL_STYLE, style); - EnableGripWindow(hwnd, resizeable); - GetWindowRect(hTargetWnd,&rc); SetWindowPos(hTargetWnd,NULL,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,SWP_NOZORDER | SWP_FRAMECHANGED); --- 1415,1418 ---- *************** *** 1430,1433 **** --- 1421,1431 ---- handleWindowResize(hwnd,rc.right-rc.left,rc.bottom-rc.top); handleContainerReLayout(hwnd); + + if (GetParent(hwnd) == NULL) + { + rc.left = rc.right-14; + rc.top = rc.bottom-14; + InvalidateRect(hwnd,&rc,TRUE); + } } |