| 1 | /* $Id: win32wbasenonclient.cpp,v 1.13 2000-02-21 17:25:32 cbratschi Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Win32 Window Base Class for OS/2 (non-client methods)
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
|
|---|
| 6 | *
|
|---|
| 7 | * Based on Wine code (windows\nonclient.c)
|
|---|
| 8 | * Corel Version 20000212
|
|---|
| 9 | *
|
|---|
| 10 | * Copyright 1994 Alexandre Julliard
|
|---|
| 11 | *
|
|---|
| 12 | * TODO: Not thread/process safe
|
|---|
| 13 | *
|
|---|
| 14 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 15 | *
|
|---|
| 16 | */
|
|---|
| 17 | #include <os2win.h>
|
|---|
| 18 | #include <win.h>
|
|---|
| 19 | #include <stdlib.h>
|
|---|
| 20 | #include <string.h>
|
|---|
| 21 | #include <stdarg.h>
|
|---|
| 22 | #include <assert.h>
|
|---|
| 23 | #include <misc.h>
|
|---|
| 24 | #include <heapstring.h>
|
|---|
| 25 | #include <win32wbase.h>
|
|---|
| 26 | #include <winres.h>
|
|---|
| 27 | #include "wndmsg.h"
|
|---|
| 28 | #include "pmframe.h"
|
|---|
| 29 | #include "oslibwin.h"
|
|---|
| 30 | #include "oslibmsg.h"
|
|---|
| 31 | #include "oslibutil.h"
|
|---|
| 32 | #include "oslibgdi.h"
|
|---|
| 33 | #include "oslibres.h"
|
|---|
| 34 | #include "oslibdos.h"
|
|---|
| 35 | #include "syscolor.h"
|
|---|
| 36 | #include "win32wndhandle.h"
|
|---|
| 37 | #include "dc.h"
|
|---|
| 38 | #include "win32wdesktop.h"
|
|---|
| 39 | #include "controls.h"
|
|---|
| 40 | #include <menu.h>
|
|---|
| 41 |
|
|---|
| 42 | #define DBG_LOCALLOG DBG_win32wbasenonclient
|
|---|
| 43 | #include "dbglocal.h"
|
|---|
| 44 |
|
|---|
| 45 | /* bits in the dwKeyData */
|
|---|
| 46 | #define KEYDATA_ALT 0x2000
|
|---|
| 47 | #define KEYDATA_PREVSTATE 0x4000
|
|---|
| 48 |
|
|---|
| 49 | static INT bitmapW = 16,bitmapH = 14;
|
|---|
| 50 | static HBITMAP hbitmapClose = 0;
|
|---|
| 51 | static HBITMAP hbitmapCloseD = 0;
|
|---|
| 52 | static HBITMAP hbitmapMinimize = 0;
|
|---|
| 53 | static HBITMAP hbitmapMinimizeD = 0;
|
|---|
| 54 | static HBITMAP hbitmapMaximize = 0;
|
|---|
| 55 | static HBITMAP hbitmapMaximizeD = 0;
|
|---|
| 56 | static HBITMAP hbitmapRestore = 0;
|
|---|
| 57 | static HBITMAP hbitmapRestoreD = 0;
|
|---|
| 58 | static HBITMAP hbitmapHelp = 0;
|
|---|
| 59 | static HBITMAP hbitmapHelpD = 0;
|
|---|
| 60 |
|
|---|
| 61 | BYTE lpGrayMask[] = { 0xAA, 0xA0,
|
|---|
| 62 | 0x55, 0x50,
|
|---|
| 63 | 0xAA, 0xA0,
|
|---|
| 64 | 0x55, 0x50,
|
|---|
| 65 | 0xAA, 0xA0,
|
|---|
| 66 | 0x55, 0x50,
|
|---|
| 67 | 0xAA, 0xA0,
|
|---|
| 68 | 0x55, 0x50,
|
|---|
| 69 | 0xAA, 0xA0,
|
|---|
| 70 | 0x55, 0x50};
|
|---|
| 71 |
|
|---|
| 72 | static INT (* WINAPI ShellAboutA)(HWND,LPCSTR,LPCSTR,HICON) = 0;
|
|---|
| 73 |
|
|---|
| 74 | //******************************************************************************
|
|---|
| 75 | //******************************************************************************
|
|---|
| 76 | LONG Win32BaseWindow::HandleNCActivate(WPARAM wParam)
|
|---|
| 77 | {
|
|---|
| 78 | WORD wStateChange;
|
|---|
| 79 |
|
|---|
| 80 | if( wParam ) wStateChange = !(flags & WIN_NCACTIVATED);
|
|---|
| 81 | else wStateChange = flags & WIN_NCACTIVATED;
|
|---|
| 82 |
|
|---|
| 83 | if( wStateChange )
|
|---|
| 84 | {
|
|---|
| 85 | if (wParam) flags |= WIN_NCACTIVATED;
|
|---|
| 86 | else flags &= ~WIN_NCACTIVATED;
|
|---|
| 87 |
|
|---|
| 88 | if (!(dwStyle & WS_CAPTION)) return TRUE;
|
|---|
| 89 |
|
|---|
| 90 | if(!(dwStyle & WS_MINIMIZE))
|
|---|
| 91 | DoNCPaint((HRGN)1,FALSE);
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | return TRUE;
|
|---|
| 95 | }
|
|---|
| 96 | //******************************************************************************
|
|---|
| 97 | //******************************************************************************
|
|---|
| 98 | VOID Win32BaseWindow::TrackMinMaxBox(WORD wParam)
|
|---|
| 99 | {
|
|---|
| 100 | MSG msg;
|
|---|
| 101 | HDC hdc;
|
|---|
| 102 | BOOL pressed = TRUE;
|
|---|
| 103 | UINT state;
|
|---|
| 104 |
|
|---|
| 105 | if (wParam == HTMINBUTTON)
|
|---|
| 106 | {
|
|---|
| 107 | /* If the style is not present, do nothing */
|
|---|
| 108 | if (!(dwStyle & WS_MINIMIZEBOX))
|
|---|
| 109 | return;
|
|---|
| 110 | /* Check if the sysmenu item for minimize is there */
|
|---|
| 111 | state = GetMenuState(hSysMenu,SC_MINIMIZE,MF_BYCOMMAND);
|
|---|
| 112 | } else
|
|---|
| 113 | {
|
|---|
| 114 | /* If the style is not present, do nothing */
|
|---|
| 115 | if (!(dwStyle & WS_MAXIMIZEBOX))
|
|---|
| 116 | return;
|
|---|
| 117 | /* Check if the sysmenu item for maximize is there */
|
|---|
| 118 | state = GetMenuState(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
|
|---|
| 119 | }
|
|---|
| 120 | SetCapture(Win32Hwnd);
|
|---|
| 121 | hdc = GetWindowDC(Win32Hwnd);
|
|---|
| 122 | if (wParam == HTMINBUTTON)
|
|---|
| 123 | DrawMinButton(hdc,NULL,TRUE,FALSE);
|
|---|
| 124 | else
|
|---|
| 125 | DrawMaxButton(hdc,NULL,TRUE,FALSE);
|
|---|
| 126 | do
|
|---|
| 127 | {
|
|---|
| 128 | BOOL oldstate = pressed;
|
|---|
| 129 |
|
|---|
| 130 | GetMessageA(&msg,Win32Hwnd,0,0);
|
|---|
| 131 | pressed = (HandleNCHitTest(msg.pt) == wParam);
|
|---|
| 132 | if (pressed != oldstate)
|
|---|
| 133 | {
|
|---|
| 134 | if (wParam == HTMINBUTTON)
|
|---|
| 135 | DrawMinButton(hdc,NULL,pressed,FALSE);
|
|---|
| 136 | else
|
|---|
| 137 | DrawMaxButton(hdc,NULL,pressed,FALSE);
|
|---|
| 138 | }
|
|---|
| 139 | } while (msg.message != WM_LBUTTONUP);
|
|---|
| 140 | if (wParam == HTMINBUTTON)
|
|---|
| 141 | DrawMinButton(hdc,NULL,FALSE,FALSE);
|
|---|
| 142 | else
|
|---|
| 143 | DrawMaxButton(hdc,NULL,FALSE,FALSE);
|
|---|
| 144 | ReleaseCapture();
|
|---|
| 145 | ReleaseDC(Win32Hwnd,hdc);
|
|---|
| 146 | /* If the item minimize or maximize of the sysmenu are not there */
|
|---|
| 147 | /* or if the style is not present, do nothing */
|
|---|
| 148 | if ((!pressed) || (state == 0xFFFFFFFF))
|
|---|
| 149 | return;
|
|---|
| 150 | if (wParam == HTMINBUTTON)
|
|---|
| 151 | SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,*(LPARAM*)&msg.pt);
|
|---|
| 152 | else
|
|---|
| 153 | SendInternalMessageA(WM_SYSCOMMAND,IsZoomed(Win32Hwnd) ? SC_RESTORE:SC_MAXIMIZE,*(LPARAM*)&msg.pt);
|
|---|
| 154 | }
|
|---|
| 155 | //******************************************************************************
|
|---|
| 156 | //******************************************************************************
|
|---|
| 157 | VOID Win32BaseWindow::TrackCloseButton(WORD wParam)
|
|---|
| 158 | {
|
|---|
| 159 | MSG msg;
|
|---|
| 160 | HDC hdc;
|
|---|
| 161 | BOOL pressed = TRUE;
|
|---|
| 162 | UINT state;
|
|---|
| 163 |
|
|---|
| 164 | if (hSysMenu == 0)
|
|---|
| 165 | return;
|
|---|
| 166 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
|
|---|
| 167 | /* If the item close of the sysmenu is disabled or not there do nothing */
|
|---|
| 168 | if((state & MF_DISABLED) || (state & MF_GRAYED) || (state == 0xFFFFFFFF))
|
|---|
| 169 | return;
|
|---|
| 170 | hdc = GetWindowDC(Win32Hwnd);
|
|---|
| 171 | SetCapture(Win32Hwnd);
|
|---|
| 172 | DrawCloseButton(hdc,NULL,TRUE,FALSE);
|
|---|
| 173 | do
|
|---|
| 174 | {
|
|---|
| 175 | BOOL oldstate = pressed;
|
|---|
| 176 |
|
|---|
| 177 | GetMessageA(&msg,Win32Hwnd,0,0);
|
|---|
| 178 | pressed = (HandleNCHitTest(msg.pt) == wParam);
|
|---|
| 179 | if (pressed != oldstate)
|
|---|
| 180 | DrawCloseButton(hdc,NULL,pressed,FALSE);
|
|---|
| 181 | } while (msg.message != WM_LBUTTONUP);
|
|---|
| 182 | DrawCloseButton(hdc,NULL,FALSE,FALSE);
|
|---|
| 183 | ReleaseCapture();
|
|---|
| 184 | ReleaseDC(Win32Hwnd,hdc);
|
|---|
| 185 | if (!pressed) return;
|
|---|
| 186 | SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,*(LPARAM*)&msg.pt);
|
|---|
| 187 | }
|
|---|
| 188 | //******************************************************************************
|
|---|
| 189 | //******************************************************************************
|
|---|
| 190 | VOID Win32BaseWindow::TrackScrollBar(WPARAM wParam,POINT pt)
|
|---|
| 191 | {
|
|---|
| 192 | INT scrollbar;
|
|---|
| 193 | MSG msg;
|
|---|
| 194 |
|
|---|
| 195 | if ((wParam & 0xfff0) == SC_HSCROLL)
|
|---|
| 196 | {
|
|---|
| 197 | if ((wParam & 0x0f) != HTHSCROLL) return;
|
|---|
| 198 | scrollbar = SB_HORZ;
|
|---|
| 199 | } else /* SC_VSCROLL */
|
|---|
| 200 | {
|
|---|
| 201 | if ((wParam & 0x0f) != HTVSCROLL) return;
|
|---|
| 202 | scrollbar = SB_VERT;
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | pt.x -= rectWindow.left;
|
|---|
| 206 | pt.y -= rectWindow.top;
|
|---|
| 207 | SCROLL_HandleScrollEvent(Win32Hwnd,0,MAKELONG(pt.x,pt.y),scrollbar,WM_LBUTTONDOWN);
|
|---|
| 208 | if (GetCapture() != Win32Hwnd) return;
|
|---|
| 209 | do
|
|---|
| 210 | {
|
|---|
| 211 | GetMessageA(&msg, 0, 0, 0);
|
|---|
| 212 | if(msg.hwnd == getWindowHandle())
|
|---|
| 213 | {
|
|---|
| 214 | switch(msg.message)
|
|---|
| 215 | {
|
|---|
| 216 | case WM_LBUTTONUP:
|
|---|
| 217 | case WM_MOUSEMOVE:
|
|---|
| 218 | pt.x = msg.pt.x-rectWindow.left;
|
|---|
| 219 | pt.y = msg.pt.y-rectWindow.top;
|
|---|
| 220 | msg.lParam = MAKELONG(pt.x,pt.y);
|
|---|
| 221 |
|
|---|
| 222 | case WM_SYSTIMER:
|
|---|
| 223 | SCROLL_HandleScrollEvent(Win32Hwnd,msg.wParam,msg.lParam,scrollbar,msg.message);
|
|---|
| 224 | break;
|
|---|
| 225 |
|
|---|
| 226 | default:
|
|---|
| 227 | TranslateMessage(&msg);
|
|---|
| 228 | DispatchMessageA(&msg);
|
|---|
| 229 | break;
|
|---|
| 230 | }
|
|---|
| 231 | }
|
|---|
| 232 | else {
|
|---|
| 233 | TranslateMessage(&msg);
|
|---|
| 234 | DispatchMessageA(&msg);
|
|---|
| 235 | }
|
|---|
| 236 | if (!IsWindow())
|
|---|
| 237 | {
|
|---|
| 238 | ReleaseCapture();
|
|---|
| 239 | break;
|
|---|
| 240 | }
|
|---|
| 241 | } while (msg.message != WM_LBUTTONUP);
|
|---|
| 242 | }
|
|---|
| 243 | //******************************************************************************
|
|---|
| 244 | //******************************************************************************
|
|---|
| 245 | LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam)
|
|---|
| 246 | {
|
|---|
| 247 | switch(wParam) /* Hit test */
|
|---|
| 248 | {
|
|---|
| 249 | case HTCAPTION:
|
|---|
| 250 | {
|
|---|
| 251 | Win32BaseWindow *topparent = GetTopParent();
|
|---|
| 252 |
|
|---|
| 253 | if (GetActiveWindow() != topparent->getWindowHandle())
|
|---|
| 254 | topparent->SetActiveWindow();
|
|---|
| 255 |
|
|---|
| 256 | if (GetActiveWindow() == topparent->getWindowHandle())
|
|---|
| 257 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
|
|---|
| 258 | break;
|
|---|
| 259 | }
|
|---|
| 260 |
|
|---|
| 261 | case HTSYSMENU:
|
|---|
| 262 | if(dwStyle & WS_SYSMENU )
|
|---|
| 263 | {
|
|---|
| 264 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
|
|---|
| 265 | }
|
|---|
| 266 | break;
|
|---|
| 267 |
|
|---|
| 268 | case HTMENU:
|
|---|
| 269 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
|
|---|
| 270 | break;
|
|---|
| 271 |
|
|---|
| 272 | case HTHSCROLL:
|
|---|
| 273 | SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
|
|---|
| 274 | break;
|
|---|
| 275 |
|
|---|
| 276 | case HTVSCROLL:
|
|---|
| 277 | SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
|
|---|
| 278 | break;
|
|---|
| 279 |
|
|---|
| 280 | case HTMINBUTTON:
|
|---|
| 281 | case HTMAXBUTTON:
|
|---|
| 282 | TrackMinMaxBox(wParam);
|
|---|
| 283 | break;
|
|---|
| 284 |
|
|---|
| 285 | case HTCLOSE:
|
|---|
| 286 | TrackCloseButton(wParam);
|
|---|
| 287 | break;
|
|---|
| 288 |
|
|---|
| 289 | case HTLEFT:
|
|---|
| 290 | case HTRIGHT:
|
|---|
| 291 | case HTTOP:
|
|---|
| 292 | case HTTOPLEFT:
|
|---|
| 293 | case HTTOPRIGHT:
|
|---|
| 294 | case HTBOTTOM:
|
|---|
| 295 | case HTBOTTOMLEFT:
|
|---|
| 296 | case HTBOTTOMRIGHT:
|
|---|
| 297 | /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
|
|---|
| 298 | SendInternalMessageA(WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);
|
|---|
| 299 | break;
|
|---|
| 300 | case HTBORDER:
|
|---|
| 301 | break;
|
|---|
| 302 | }
|
|---|
| 303 |
|
|---|
| 304 | return 0;
|
|---|
| 305 | }
|
|---|
| 306 | //******************************************************************************
|
|---|
| 307 | //******************************************************************************
|
|---|
| 308 | VOID Win32BaseWindow::AdjustMaximizedRect(LPRECT rect)
|
|---|
| 309 | {
|
|---|
| 310 | if (HAS_THICKFRAME(dwStyle,dwExStyle ))
|
|---|
| 311 | InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
|
|---|
| 312 | else
|
|---|
| 313 | if (HAS_DLGFRAME( dwStyle, dwExStyle ))
|
|---|
| 314 | InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
|
|---|
| 315 | else
|
|---|
| 316 | if (HAS_THINFRAME( dwStyle ))
|
|---|
| 317 | InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
|
|---|
| 318 | }
|
|---|
| 319 | //******************************************************************************
|
|---|
| 320 | //******************************************************************************
|
|---|
| 321 | VOID Win32BaseWindow::AdjustTrackInfo(PPOINT minTrackSize,PPOINT maxTrackSize)
|
|---|
| 322 | {
|
|---|
| 323 | if ((dwStyle & WS_THICKFRAME) || !(dwStyle & (WS_POPUP | WS_CHILD)))
|
|---|
| 324 | GetMinMaxInfo(NULL,NULL,minTrackSize,maxTrackSize);
|
|---|
| 325 | }
|
|---|
| 326 | //******************************************************************************
|
|---|
| 327 | //******************************************************************************
|
|---|
| 328 | VOID Win32BaseWindow::AdjustRectOuter(LPRECT rect,BOOL menu)
|
|---|
| 329 | {
|
|---|
| 330 | if(dwStyle & WS_ICONIC) return;
|
|---|
| 331 |
|
|---|
| 332 | if (HAS_THICKFRAME(dwStyle,dwExStyle ))
|
|---|
| 333 | InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
|
|---|
| 334 | else
|
|---|
| 335 | if (HAS_DLGFRAME( dwStyle, dwExStyle ))
|
|---|
| 336 | InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
|
|---|
| 337 | else
|
|---|
| 338 | if (HAS_THINFRAME( dwStyle ))
|
|---|
| 339 | InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
|
|---|
| 340 |
|
|---|
| 341 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
|---|
| 342 | {
|
|---|
| 343 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
|---|
| 344 | rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
|
|---|
| 345 | else
|
|---|
| 346 | rect->top -= GetSystemMetrics(SM_CYCAPTION);
|
|---|
| 347 | }
|
|---|
| 348 |
|
|---|
| 349 | if (menu)
|
|---|
| 350 | rect->top -= GetSystemMetrics(SM_CYMENU);
|
|---|
| 351 | }
|
|---|
| 352 | //******************************************************************************
|
|---|
| 353 | //******************************************************************************
|
|---|
| 354 | VOID Win32BaseWindow::AdjustRectInner(LPRECT rect)
|
|---|
| 355 | {
|
|---|
| 356 | if(dwStyle & WS_ICONIC) return;
|
|---|
| 357 |
|
|---|
| 358 | if (dwExStyle & WS_EX_CLIENTEDGE)
|
|---|
| 359 | InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
|
|---|
| 360 |
|
|---|
| 361 | if (dwExStyle & WS_EX_STATICEDGE)
|
|---|
| 362 | InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
|
|---|
| 363 |
|
|---|
| 364 | if (dwStyle & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL);
|
|---|
| 365 | if (dwStyle & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
|
|---|
| 366 | }
|
|---|
| 367 | //******************************************************************************
|
|---|
| 368 | //******************************************************************************
|
|---|
| 369 | LONG Win32BaseWindow::HandleNCCalcSize(BOOL calcValidRects,RECT *winRect)
|
|---|
| 370 | {
|
|---|
| 371 | RECT tmpRect = { 0, 0, 0, 0 };
|
|---|
| 372 | LONG result = 0;
|
|---|
| 373 | UINT style;
|
|---|
| 374 |
|
|---|
| 375 | dprintf(("Default WM_NCCALCSIZE handler"));
|
|---|
| 376 |
|
|---|
| 377 | if (!calcValidRects) return 0;
|
|---|
| 378 |
|
|---|
| 379 | style = (UINT) GetClassLongA(Win32Hwnd,GCL_STYLE);
|
|---|
| 380 |
|
|---|
| 381 | if (style & CS_VREDRAW) result |= WVR_VREDRAW;
|
|---|
| 382 | if (style & CS_HREDRAW) result |= WVR_HREDRAW;
|
|---|
| 383 |
|
|---|
| 384 | if(!(dwStyle & WS_MINIMIZE))
|
|---|
| 385 | {
|
|---|
| 386 | AdjustRectOuter(&tmpRect,FALSE);
|
|---|
| 387 |
|
|---|
| 388 | winRect->left -= tmpRect.left;
|
|---|
| 389 | winRect->top -= tmpRect.top;
|
|---|
| 390 | winRect->right -= tmpRect.right;
|
|---|
| 391 | winRect->bottom -= tmpRect.bottom;
|
|---|
| 392 |
|
|---|
| 393 | if (HAS_MENU())
|
|---|
| 394 | {
|
|---|
| 395 | winRect->top +=
|
|---|
| 396 | MENU_GetMenuBarHeight(Win32Hwnd,
|
|---|
| 397 | winRect->right - winRect->left,
|
|---|
| 398 | -tmpRect.left, -tmpRect.top ) + 1;
|
|---|
| 399 | }
|
|---|
| 400 |
|
|---|
| 401 | SetRect (&tmpRect, 0, 0, 0, 0);
|
|---|
| 402 | AdjustRectInner(&tmpRect);
|
|---|
| 403 | winRect->left -= tmpRect.left;
|
|---|
| 404 | winRect->top -= tmpRect.top;
|
|---|
| 405 | winRect->right -= tmpRect.right;
|
|---|
| 406 | winRect->bottom -= tmpRect.bottom;
|
|---|
| 407 | }
|
|---|
| 408 |
|
|---|
| 409 | return result;
|
|---|
| 410 | }
|
|---|
| 411 | //******************************************************************************
|
|---|
| 412 | //******************************************************************************
|
|---|
| 413 | LONG Win32BaseWindow::HandleNCHitTest(POINT pt)
|
|---|
| 414 | {
|
|---|
| 415 | RECT rect = rectWindow;
|
|---|
| 416 |
|
|---|
| 417 | if (dwStyle & WS_MINIMIZE) return HTCAPTION;
|
|---|
| 418 |
|
|---|
| 419 | if (!PtInRect(&rect,pt)) return HTNOWHERE;
|
|---|
| 420 |
|
|---|
| 421 | /* Check borders */
|
|---|
| 422 | if (HAS_THICKFRAME(dwStyle,dwExStyle))
|
|---|
| 423 | {
|
|---|
| 424 | InflateRect(&rect,-GetSystemMetrics(SM_CXFRAME),-GetSystemMetrics(SM_CYFRAME));
|
|---|
| 425 | if (!PtInRect(&rect,pt))
|
|---|
| 426 | {
|
|---|
| 427 | /* Check top sizing border */
|
|---|
| 428 | if (pt.y < rect.top)
|
|---|
| 429 | {
|
|---|
| 430 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
|
|---|
| 431 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
|
|---|
| 432 | return HTTOP;
|
|---|
| 433 | }
|
|---|
| 434 | /* Check bottom sizing border */
|
|---|
| 435 | if (pt.y >= rect.bottom)
|
|---|
| 436 | {
|
|---|
| 437 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
|
|---|
| 438 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
|
|---|
| 439 | return HTBOTTOM;
|
|---|
| 440 | }
|
|---|
| 441 | /* Check left sizing border */
|
|---|
| 442 | if (pt.x < rect.left)
|
|---|
| 443 | {
|
|---|
| 444 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
|
|---|
| 445 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
|
|---|
| 446 | return HTLEFT;
|
|---|
| 447 | }
|
|---|
| 448 | /* Check right sizing border */
|
|---|
| 449 | if (pt.x >= rect.right)
|
|---|
| 450 | {
|
|---|
| 451 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
|
|---|
| 452 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
|
|---|
| 453 | return HTRIGHT;
|
|---|
| 454 | }
|
|---|
| 455 | }
|
|---|
| 456 | } else /* No thick frame */
|
|---|
| 457 | {
|
|---|
| 458 | if (HAS_DLGFRAME(dwStyle,dwExStyle))
|
|---|
| 459 | InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
|
|---|
| 460 | else if (HAS_THINFRAME(dwStyle ))
|
|---|
| 461 | InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
|
|---|
| 462 | if (!PtInRect( &rect, pt )) return HTBORDER;
|
|---|
| 463 | }
|
|---|
| 464 |
|
|---|
| 465 | /* Check caption */
|
|---|
| 466 |
|
|---|
| 467 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
|---|
| 468 | {
|
|---|
| 469 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
|---|
| 470 | rect.top += GetSystemMetrics(SM_CYSMCAPTION)-1;
|
|---|
| 471 | else
|
|---|
| 472 | rect.top += GetSystemMetrics(SM_CYCAPTION)-1;
|
|---|
| 473 | if (!PtInRect(&rect,pt))
|
|---|
| 474 | {
|
|---|
| 475 | /* Check system menu */
|
|---|
| 476 | if(dwStyle & WS_SYSMENU)
|
|---|
| 477 | {
|
|---|
| 478 | /* Check if there is an user icon */
|
|---|
| 479 | HICON hSysIcon = hIconSm;
|
|---|
| 480 | if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd,GCL_HICONSM);
|
|---|
| 481 |
|
|---|
| 482 | /* If there is an icon associated with the window OR */
|
|---|
| 483 | /* If there is no hIcon specified and this is not a modal dialog, */
|
|---|
| 484 | /* there is a system menu icon. */
|
|---|
| 485 | if((hSysIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
|
|---|
| 486 | rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
|
|---|
| 487 | }
|
|---|
| 488 | if (pt.x < rect.left) return HTSYSMENU;
|
|---|
| 489 |
|
|---|
| 490 | /* Check close button */
|
|---|
| 491 | if (dwStyle & WS_SYSMENU)
|
|---|
| 492 | rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
|
|---|
| 493 | if (pt.x > rect.right) return HTCLOSE;
|
|---|
| 494 |
|
|---|
| 495 | //Check context help
|
|---|
| 496 | if (dwExStyle & WS_EX_CONTEXTHELP)
|
|---|
| 497 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
|---|
| 498 | if (pt.x > rect.right) return HTHELP;
|
|---|
| 499 |
|
|---|
| 500 | /* Check maximize box */
|
|---|
| 501 | /* In win95 there is automatically a Maximize button when there is a minimize one*/
|
|---|
| 502 | if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX))
|
|---|
| 503 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
|---|
| 504 | if (pt.x > rect.right) return HTMAXBUTTON;
|
|---|
| 505 |
|
|---|
| 506 | /* Check minimize box */
|
|---|
| 507 | /* In win95 there is automatically a Maximize button when there is a Maximize one*/
|
|---|
| 508 | if ((dwStyle & WS_MINIMIZEBOX)||(dwStyle & WS_MAXIMIZEBOX))
|
|---|
| 509 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
|---|
| 510 |
|
|---|
| 511 | if (pt.x > rect.right) return HTMINBUTTON;
|
|---|
| 512 | return HTCAPTION;
|
|---|
| 513 | }
|
|---|
| 514 | }
|
|---|
| 515 |
|
|---|
| 516 | /* Check client area */
|
|---|
| 517 |
|
|---|
| 518 | ScreenToClient(Win32Hwnd,&pt);
|
|---|
| 519 | getClientRect(&rect);
|
|---|
| 520 | if (PtInRect(&rect,pt)) return HTCLIENT;
|
|---|
| 521 |
|
|---|
| 522 | /* Check vertical scroll bar */
|
|---|
| 523 |
|
|---|
| 524 | if (dwStyle & WS_VSCROLL)
|
|---|
| 525 | {
|
|---|
| 526 | rect.right += GetSystemMetrics(SM_CXVSCROLL);
|
|---|
| 527 | if (PtInRect( &rect, pt )) return HTVSCROLL;
|
|---|
| 528 | }
|
|---|
| 529 |
|
|---|
| 530 | /* Check horizontal scroll bar */
|
|---|
| 531 |
|
|---|
| 532 | if (dwStyle & WS_HSCROLL)
|
|---|
| 533 | {
|
|---|
| 534 | rect.bottom += GetSystemMetrics(SM_CYHSCROLL);
|
|---|
| 535 | if (PtInRect( &rect, pt ))
|
|---|
| 536 | {
|
|---|
| 537 | /* Check size box */
|
|---|
| 538 | if ((dwStyle & WS_VSCROLL) &&
|
|---|
| 539 | (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL)))
|
|---|
| 540 | return (dwStyle & WS_CHILD) ? HTSIZE:HTBOTTOMRIGHT;
|
|---|
| 541 | return HTHSCROLL;
|
|---|
| 542 | }
|
|---|
| 543 | }
|
|---|
| 544 |
|
|---|
| 545 | /* Check menu bar */
|
|---|
| 546 |
|
|---|
| 547 | if (HAS_MENU())
|
|---|
| 548 | {
|
|---|
| 549 | if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
|
|---|
| 550 | return HTMENU;
|
|---|
| 551 | }
|
|---|
| 552 |
|
|---|
| 553 | /* Has to return HTNOWHERE if nothing was found
|
|---|
| 554 | Could happen when a window has a customized non client area */
|
|---|
| 555 | return HTNOWHERE;
|
|---|
| 556 | }
|
|---|
| 557 |
|
|---|
| 558 | //******************************************************************************
|
|---|
| 559 | //******************************************************************************
|
|---|
| 560 | VOID Win32BaseWindow::GetInsideRect(RECT *rect)
|
|---|
| 561 | {
|
|---|
| 562 | rect->top = rect->left = 0;
|
|---|
| 563 | rect->right = rectWindow.right - rectWindow.left;
|
|---|
| 564 | rect->bottom = rectWindow.bottom - rectWindow.top;
|
|---|
| 565 |
|
|---|
| 566 | if (dwStyle & WS_ICONIC) return;
|
|---|
| 567 |
|
|---|
| 568 | /* Remove frame from rectangle */
|
|---|
| 569 | if (HAS_THICKFRAME(dwStyle,dwExStyle))
|
|---|
| 570 | {
|
|---|
| 571 | InflateRect( rect, -GetSystemMetrics(SM_CXSIZEFRAME), -GetSystemMetrics(SM_CYSIZEFRAME) );
|
|---|
| 572 | }
|
|---|
| 573 | else if (HAS_DLGFRAME(dwStyle,dwExStyle ))
|
|---|
| 574 | {
|
|---|
| 575 | InflateRect( rect, -GetSystemMetrics(SM_CXFIXEDFRAME), -GetSystemMetrics(SM_CYFIXEDFRAME));
|
|---|
| 576 | }
|
|---|
| 577 | else if (HAS_THINFRAME(dwStyle))
|
|---|
| 578 | {
|
|---|
| 579 | InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) );
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| 582 | /* We have additional border information if the window
|
|---|
| 583 | * is a child (but not an MDI child) */
|
|---|
| 584 | if ( (dwStyle & WS_CHILD) &&
|
|---|
| 585 | ( (dwExStyle & WS_EX_MDICHILD) == 0 ) )
|
|---|
| 586 | {
|
|---|
| 587 | if (dwExStyle & WS_EX_CLIENTEDGE)
|
|---|
| 588 | InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE));
|
|---|
| 589 |
|
|---|
| 590 | if (dwExStyle & WS_EX_STATICEDGE)
|
|---|
| 591 | InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
|
|---|
| 592 | }
|
|---|
| 593 | }
|
|---|
| 594 | //******************************************************************************
|
|---|
| 595 | //******************************************************************************
|
|---|
| 596 | VOID Win32BaseWindow::DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active)
|
|---|
| 597 | {
|
|---|
| 598 | INT width, height;
|
|---|
| 599 | HBRUSH oldBrush;
|
|---|
| 600 |
|
|---|
| 601 | if (dlgFrame)
|
|---|
| 602 | {
|
|---|
| 603 | width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
|
|---|
| 604 | height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
|
|---|
| 605 | }
|
|---|
| 606 | else
|
|---|
| 607 | {
|
|---|
| 608 | width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE);
|
|---|
| 609 | height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE);
|
|---|
| 610 | }
|
|---|
| 611 |
|
|---|
| 612 | oldBrush = SelectObject(hdc,GetSysColorBrush(active ? COLOR_ACTIVEBORDER:COLOR_INACTIVEBORDER));
|
|---|
| 613 |
|
|---|
| 614 | /* Draw frame */
|
|---|
| 615 | PatBlt(hdc,rect->left, rect->top, rect->right-rect->left, height,PATCOPY); //top
|
|---|
| 616 | PatBlt(hdc,rect->left, rect->top, width, rect->bottom-rect->top,PATCOPY); //left
|
|---|
| 617 | PatBlt(hdc,rect->left, rect->bottom-1, rect->right-rect->left,-height,PATCOPY); //bottom
|
|---|
| 618 | PatBlt(hdc,rect->right-1,rect->top, -width, rect->bottom-rect->top,PATCOPY); //right
|
|---|
| 619 | SelectObject(hdc,oldBrush);
|
|---|
| 620 |
|
|---|
| 621 | InflateRect(rect,-width,-height);
|
|---|
| 622 | }
|
|---|
| 623 | //******************************************************************************
|
|---|
| 624 | //******************************************************************************
|
|---|
| 625 | BOOL Win32BaseWindow::DrawSysButton(HDC hdc,RECT *rect)
|
|---|
| 626 | {
|
|---|
| 627 | HICON hSysIcon;
|
|---|
| 628 | RECT r;
|
|---|
| 629 |
|
|---|
| 630 | if (!rect) GetInsideRect(&r);
|
|---|
| 631 | else r = *rect;
|
|---|
| 632 |
|
|---|
| 633 | hSysIcon = hIconSm;
|
|---|
| 634 |
|
|---|
| 635 | /* if no small icon and no large icon, use class small icon */
|
|---|
| 636 | if (!hSysIcon && !hIcon)
|
|---|
| 637 | hSysIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
|
|---|
| 638 |
|
|---|
| 639 | /* otherwise use the large icon */
|
|---|
| 640 | if (!hSysIcon) hSysIcon = hIcon;
|
|---|
| 641 |
|
|---|
| 642 | /* if all else fails, use the application icon. */
|
|---|
| 643 | if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
|
|---|
| 644 |
|
|---|
| 645 | /* If there is no hIcon specified or this is not a modal dialog, */
|
|---|
| 646 | /* get the default one. */
|
|---|
| 647 | if(hSysIcon == 0)
|
|---|
| 648 | if (!(dwStyle & DS_MODALFRAME))
|
|---|
| 649 | hSysIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
|
|---|
| 650 | //CB: todo: add icons (including Odin icon) to user32.rc
|
|---|
| 651 | if (hSysIcon)
|
|---|
| 652 | DrawIconEx(hdc,r.left+2,r.top+2,hSysIcon,
|
|---|
| 653 | GetSystemMetrics(SM_CXSMICON),
|
|---|
| 654 | GetSystemMetrics(SM_CYSMICON),
|
|---|
| 655 | 0, 0, DI_NORMAL);
|
|---|
| 656 |
|
|---|
| 657 | return (hSysIcon != 0);
|
|---|
| 658 | }
|
|---|
| 659 | //******************************************************************************
|
|---|
| 660 | //******************************************************************************
|
|---|
| 661 | BOOL Win32BaseWindow::GetSysPopupPos(RECT* rect)
|
|---|
| 662 | {
|
|---|
| 663 | if(hSysMenu)
|
|---|
| 664 | {
|
|---|
| 665 | if(dwStyle & WS_MINIMIZE )
|
|---|
| 666 | *rect = rectWindow;
|
|---|
| 667 | else
|
|---|
| 668 | {
|
|---|
| 669 | GetInsideRect(rect );
|
|---|
| 670 | OffsetRect( rect, rectWindow.left, rectWindow.top);
|
|---|
| 671 | rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
|
|---|
| 672 | rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
|
|---|
| 673 | }
|
|---|
| 674 | return TRUE;
|
|---|
| 675 | }
|
|---|
| 676 | return FALSE;
|
|---|
| 677 | }
|
|---|
| 678 | //******************************************************************************
|
|---|
| 679 | //******************************************************************************
|
|---|
| 680 | BOOL Win32BaseWindow::DrawGrayButton(HDC hdc,int x,int y)
|
|---|
| 681 | {
|
|---|
| 682 | HBITMAP hMaskBmp;
|
|---|
| 683 | HDC hdcMask = CreateCompatibleDC (0);
|
|---|
| 684 | HBRUSH hOldBrush;
|
|---|
| 685 | hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask);
|
|---|
| 686 |
|
|---|
| 687 | if(hMaskBmp == 0)
|
|---|
| 688 | return FALSE;
|
|---|
| 689 |
|
|---|
| 690 | SelectObject (hdcMask, hMaskBmp);
|
|---|
| 691 |
|
|---|
| 692 | /* Draw the grayed bitmap using the mask */
|
|---|
| 693 | hOldBrush = SelectObject (hdc, RGB(128, 128, 128));
|
|---|
| 694 | BitBlt (hdc, x, y, 12, 10,
|
|---|
| 695 | hdcMask, 0, 0, 0xB8074A);
|
|---|
| 696 |
|
|---|
| 697 | /* Clean up */
|
|---|
| 698 | SelectObject (hdc, hOldBrush);
|
|---|
| 699 | DeleteObject(hMaskBmp);
|
|---|
| 700 | DeleteDC (hdcMask);
|
|---|
| 701 |
|
|---|
| 702 | return TRUE;
|
|---|
| 703 | }
|
|---|
| 704 | //******************************************************************************
|
|---|
| 705 | //******************************************************************************
|
|---|
| 706 | VOID Win32BaseWindow::DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
|
|---|
| 707 | {
|
|---|
| 708 | RECT r;
|
|---|
| 709 | HDC hdcMem;
|
|---|
| 710 | BITMAP bmp;
|
|---|
| 711 | HBITMAP hBmp, hOldBmp;
|
|---|
| 712 |
|
|---|
| 713 | if (!rect) GetInsideRect(&r);
|
|---|
| 714 | else r = *rect;
|
|---|
| 715 |
|
|---|
| 716 | /* A tool window has a smaller Close button */
|
|---|
| 717 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
|---|
| 718 | {
|
|---|
| 719 | RECT toolRect;
|
|---|
| 720 | INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */
|
|---|
| 721 | INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */
|
|---|
| 722 | INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION);
|
|---|
| 723 |
|
|---|
| 724 |
|
|---|
| 725 | toolRect.top = r.top + (iCaptionHeight - 1 - iBmpHeight) / 2;
|
|---|
| 726 | toolRect.left = r.right - (iCaptionHeight + 1 + iBmpWidth) / 2;
|
|---|
| 727 | toolRect.bottom = toolRect.top + iBmpHeight;
|
|---|
| 728 | toolRect.right = toolRect.left + iBmpWidth;
|
|---|
| 729 | DrawFrameControl(hdc,&toolRect,
|
|---|
| 730 | DFC_CAPTION,DFCS_CAPTIONCLOSE |
|
|---|
| 731 | down ? DFCS_PUSHED : 0 |
|
|---|
| 732 | bGrayed ? DFCS_INACTIVE : 0);
|
|---|
| 733 | } else
|
|---|
| 734 | {
|
|---|
| 735 | hdcMem = CreateCompatibleDC( hdc );
|
|---|
| 736 | hBmp = down ? hbitmapCloseD : hbitmapClose;
|
|---|
| 737 | hOldBmp = SelectObject (hdcMem, hBmp);
|
|---|
| 738 | GetObjectA (hBmp, sizeof(BITMAP), &bmp);
|
|---|
| 739 |
|
|---|
| 740 | BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
|
|---|
| 741 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
|
|---|
| 742 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
|
|---|
| 743 |
|
|---|
| 744 | if(bGrayed)
|
|---|
| 745 | DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
|
|---|
| 746 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
|
|---|
| 747 |
|
|---|
| 748 | SelectObject (hdcMem, hOldBmp);
|
|---|
| 749 | DeleteDC (hdcMem);
|
|---|
| 750 | }
|
|---|
| 751 | }
|
|---|
| 752 | //******************************************************************************
|
|---|
| 753 | //******************************************************************************
|
|---|
| 754 | VOID Win32BaseWindow::DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
|
|---|
| 755 | {
|
|---|
| 756 | RECT r;
|
|---|
| 757 | HDC hdcMem;
|
|---|
| 758 | BITMAP bmp;
|
|---|
| 759 | HBITMAP hBmp,hOldBmp;
|
|---|
| 760 |
|
|---|
| 761 | if (!rect) GetInsideRect(&r);
|
|---|
| 762 | else r = *rect;
|
|---|
| 763 | hdcMem = CreateCompatibleDC( hdc );
|
|---|
| 764 | hBmp = IsZoomed(Win32Hwnd) ?
|
|---|
| 765 | (down ? hbitmapRestoreD : hbitmapRestore ) :
|
|---|
| 766 | (down ? hbitmapMaximizeD: hbitmapMaximize);
|
|---|
| 767 | hOldBmp = SelectObject( hdcMem, hBmp );
|
|---|
| 768 | GetObjectA (hBmp, sizeof(BITMAP), &bmp);
|
|---|
| 769 |
|
|---|
| 770 | if (dwStyle & WS_SYSMENU)
|
|---|
| 771 | r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
|
|---|
| 772 |
|
|---|
| 773 | if (dwExStyle & WS_EX_CONTEXTHELP)
|
|---|
| 774 | r.right -= bmp.bmWidth;
|
|---|
| 775 |
|
|---|
| 776 | BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
|
|---|
| 777 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
|
|---|
| 778 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
|
|---|
| 779 |
|
|---|
| 780 | if(bGrayed)
|
|---|
| 781 | DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
|
|---|
| 782 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
|
|---|
| 783 |
|
|---|
| 784 | SelectObject (hdcMem, hOldBmp);
|
|---|
| 785 | DeleteDC( hdcMem );
|
|---|
| 786 | }
|
|---|
| 787 | //******************************************************************************
|
|---|
| 788 | //******************************************************************************
|
|---|
| 789 | VOID Win32BaseWindow::DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
|
|---|
| 790 | {
|
|---|
| 791 | RECT r;
|
|---|
| 792 | HDC hdcMem;
|
|---|
| 793 | BITMAP bmp;
|
|---|
| 794 | HBITMAP hBmp,hOldBmp;
|
|---|
| 795 |
|
|---|
| 796 | if (!rect) GetInsideRect(&r);
|
|---|
| 797 | else r = *rect;
|
|---|
| 798 |
|
|---|
| 799 | hdcMem = CreateCompatibleDC( hdc );
|
|---|
| 800 | hBmp = down ? hbitmapMinimizeD : hbitmapMinimize;
|
|---|
| 801 | hOldBmp= SelectObject( hdcMem, hBmp );
|
|---|
| 802 | GetObjectA (hBmp, sizeof(BITMAP), &bmp);
|
|---|
| 803 |
|
|---|
| 804 | if (dwStyle & WS_SYSMENU)
|
|---|
| 805 | r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
|
|---|
| 806 |
|
|---|
| 807 | if (dwExStyle & WS_EX_CONTEXTHELP)
|
|---|
| 808 | r.right -= bmp.bmWidth;
|
|---|
| 809 |
|
|---|
| 810 | /* In win 95 there is always a Maximize box when there is a Minimize one */
|
|---|
| 811 | if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
|
|---|
| 812 | r.right -= bmp.bmWidth;
|
|---|
| 813 |
|
|---|
| 814 | BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
|
|---|
| 815 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
|
|---|
| 816 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
|
|---|
| 817 |
|
|---|
| 818 | if(bGrayed)
|
|---|
| 819 | DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
|
|---|
| 820 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
|
|---|
| 821 |
|
|---|
| 822 |
|
|---|
| 823 | SelectObject (hdcMem, hOldBmp);
|
|---|
| 824 | DeleteDC( hdcMem );
|
|---|
| 825 | }
|
|---|
| 826 | //******************************************************************************
|
|---|
| 827 | //******************************************************************************
|
|---|
| 828 | VOID Win32BaseWindow::DrawHelpButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
|
|---|
| 829 | {
|
|---|
| 830 | RECT r;
|
|---|
| 831 | HDC hdcMem;
|
|---|
| 832 | BITMAP bmp;
|
|---|
| 833 | HBITMAP hBmp,hOldBmp;
|
|---|
| 834 |
|
|---|
| 835 | if (!rect) GetInsideRect(&r);
|
|---|
| 836 | else r = *rect;
|
|---|
| 837 |
|
|---|
| 838 | hdcMem = CreateCompatibleDC(hdc);
|
|---|
| 839 | hBmp = down ? hbitmapHelpD : hbitmapHelp;
|
|---|
| 840 | hOldBmp = SelectObject(hdcMem,hBmp);
|
|---|
| 841 | GetObjectA(hBmp,sizeof(BITMAP),&bmp);
|
|---|
| 842 |
|
|---|
| 843 | if (dwStyle & WS_SYSMENU)
|
|---|
| 844 | r.right -= GetSystemMetrics(SM_CYCAPTION)+1;
|
|---|
| 845 |
|
|---|
| 846 | BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
|
|---|
| 847 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
|
|---|
| 848 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
|
|---|
| 849 |
|
|---|
| 850 | if(bGrayed)
|
|---|
| 851 | DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
|
|---|
| 852 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
|
|---|
| 853 |
|
|---|
| 854 |
|
|---|
| 855 | SelectObject (hdcMem, hOldBmp);
|
|---|
| 856 | DeleteDC( hdcMem );
|
|---|
| 857 | }
|
|---|
| 858 | //******************************************************************************
|
|---|
| 859 | //******************************************************************************
|
|---|
| 860 | VOID Win32BaseWindow::DrawCaption(HDC hdc,RECT *rect,BOOL active)
|
|---|
| 861 | {
|
|---|
| 862 | RECT r = *rect,r2;
|
|---|
| 863 | char buffer[256];
|
|---|
| 864 | HPEN hPrevPen;
|
|---|
| 865 | HDC memDC;
|
|---|
| 866 | HBITMAP memBmp,oldBmp;
|
|---|
| 867 |
|
|---|
| 868 | memDC = CreateCompatibleDC(hdc);
|
|---|
| 869 | r.right -= r.left;
|
|---|
| 870 | r.bottom -= r.top;
|
|---|
| 871 | r.left = r.top = 0;
|
|---|
| 872 | r2 = r;
|
|---|
| 873 | memBmp = CreateCompatibleBitmap(hdc,r.right,r.bottom);
|
|---|
| 874 | oldBmp = SelectObject(memDC,memBmp);
|
|---|
| 875 |
|
|---|
| 876 | hPrevPen = SelectObject(memDC,GetSysColorPen(COLOR_3DFACE));
|
|---|
| 877 | MoveToEx(memDC,r.left,r.bottom-1,NULL);
|
|---|
| 878 | LineTo(memDC,r.right,r.bottom-1);
|
|---|
| 879 | SelectObject(memDC,hPrevPen);
|
|---|
| 880 | r.bottom--;
|
|---|
| 881 |
|
|---|
| 882 | if (SYSCOLOR_GetUseWinColors())
|
|---|
| 883 | {
|
|---|
| 884 | COLORREF startColor = GetSysColor(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION),endColor = GetSysColor(active ? COLOR_GRADIENTACTIVECAPTION:COLOR_GRADIENTINACTIVECAPTION);
|
|---|
| 885 |
|
|---|
| 886 | if (startColor == endColor)
|
|---|
| 887 | FillRect(memDC,&r,GetSysColorBrush(startColor));
|
|---|
| 888 | else
|
|---|
| 889 | {
|
|---|
| 890 | INT rDiff = GetRValue(endColor)-GetRValue(startColor);
|
|---|
| 891 | INT gDiff = GetGValue(endColor)-GetGValue(startColor);
|
|---|
| 892 | INT bDiff = GetBValue(endColor)-GetBValue(startColor);
|
|---|
| 893 | INT steps = MAX(MAX(abs(rDiff),abs(gDiff)),abs(bDiff));
|
|---|
| 894 | INT w = r.right-r.left;
|
|---|
| 895 | RECT r2;
|
|---|
| 896 |
|
|---|
| 897 | if (w < steps) steps = w;
|
|---|
| 898 | r2.left = r2.right = r.left;
|
|---|
| 899 | r2.top = r.top;
|
|---|
| 900 | r2.bottom = r.bottom;
|
|---|
| 901 | for (INT x = 0;x <= steps;x++)
|
|---|
| 902 | {
|
|---|
| 903 | COLORREF color = RGB(GetRValue(startColor)+rDiff*x/steps,GetGValue(startColor)+gDiff*x/steps,GetBValue(startColor)+bDiff*x/steps);
|
|---|
| 904 | HBRUSH brush = CreateSolidBrush(color);
|
|---|
| 905 |
|
|---|
| 906 | r2.left = r2.right;
|
|---|
| 907 | r2.right = r.left+w*x/steps;
|
|---|
| 908 | FillRect(memDC,&r2,brush);
|
|---|
| 909 | DeleteObject(brush);
|
|---|
| 910 | }
|
|---|
| 911 | }
|
|---|
| 912 | } else FillRect(memDC,&r,GetSysColorBrush(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION));
|
|---|
| 913 |
|
|---|
| 914 | if (!hbitmapClose)
|
|---|
| 915 | {
|
|---|
| 916 | if (!(hbitmapClose = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSE)))) return;
|
|---|
| 917 | hbitmapCloseD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSED));
|
|---|
| 918 | hbitmapMinimize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCE));
|
|---|
| 919 | hbitmapMinimizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCED));
|
|---|
| 920 | hbitmapMaximize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOM));
|
|---|
| 921 | hbitmapMaximizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOMD));
|
|---|
| 922 | hbitmapRestore = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORE));
|
|---|
| 923 | hbitmapRestoreD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORED));
|
|---|
| 924 | hbitmapHelp = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_HELP));
|
|---|
| 925 | hbitmapHelpD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_HELPD));
|
|---|
| 926 | }
|
|---|
| 927 |
|
|---|
| 928 | if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW))
|
|---|
| 929 | {
|
|---|
| 930 | if (DrawSysButton(memDC,&r))
|
|---|
| 931 | r.left += GetSystemMetrics(SM_CYCAPTION) - 1;
|
|---|
| 932 | }
|
|---|
| 933 |
|
|---|
| 934 | if (dwStyle & WS_SYSMENU)
|
|---|
| 935 | {
|
|---|
| 936 | UINT state;
|
|---|
| 937 |
|
|---|
| 938 | /* Go get the sysmenu */
|
|---|
| 939 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
|
|---|
| 940 |
|
|---|
| 941 | /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */
|
|---|
| 942 | DrawCloseButton(memDC,&r2,FALSE,
|
|---|
| 943 | ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF)));
|
|---|
| 944 | r.right -= GetSystemMetrics(SM_CYCAPTION)-1;
|
|---|
| 945 |
|
|---|
| 946 | if (dwExStyle & WS_EX_CONTEXTHELP)
|
|---|
| 947 | {
|
|---|
| 948 | DrawHelpButton(memDC,&r2,FALSE,FALSE);
|
|---|
| 949 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
|---|
| 950 | }
|
|---|
| 951 |
|
|---|
| 952 | if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
|
|---|
| 953 | {
|
|---|
| 954 | /* In win95 the two buttons are always there */
|
|---|
| 955 | /* But if the menu item is not in the menu they're disabled*/
|
|---|
| 956 |
|
|---|
| 957 | DrawMaxButton(memDC,&r2,FALSE,(!(dwStyle & WS_MAXIMIZEBOX)));
|
|---|
| 958 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
|---|
| 959 |
|
|---|
| 960 | DrawMinButton(memDC,&r2,FALSE, (!(dwStyle & WS_MINIMIZEBOX)));
|
|---|
| 961 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
|---|
| 962 | }
|
|---|
| 963 | }
|
|---|
| 964 |
|
|---|
| 965 | if (GetWindowTextA(buffer, sizeof(buffer) ))
|
|---|
| 966 | {
|
|---|
| 967 | NONCLIENTMETRICSA nclm;
|
|---|
| 968 | HFONT hFont, hOldFont;
|
|---|
| 969 |
|
|---|
| 970 | nclm.cbSize = sizeof(NONCLIENTMETRICSA);
|
|---|
| 971 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
|
|---|
| 972 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
|---|
| 973 | hFont = CreateFontIndirectA (&nclm.lfSmCaptionFont);
|
|---|
| 974 | else
|
|---|
| 975 | hFont = CreateFontIndirectA (&nclm.lfCaptionFont);
|
|---|
| 976 | hOldFont = SelectObject (memDC, hFont);
|
|---|
| 977 | SetTextColor(memDC,GetSysColor(active ? COLOR_CAPTIONTEXT:COLOR_INACTIVECAPTIONTEXT));
|
|---|
| 978 | SetBkMode(memDC, TRANSPARENT );
|
|---|
| 979 | r.left += 2;
|
|---|
| 980 | DrawTextExA(memDC,buffer,-1,&r,DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT | DT_END_ELLIPSIS,NULL);
|
|---|
| 981 | DeleteObject (SelectObject (memDC, hOldFont));
|
|---|
| 982 | }
|
|---|
| 983 |
|
|---|
| 984 | BitBlt(hdc,rect->left,rect->top,rect->right-rect->left,rect->bottom-rect->top,memDC,0,0,SRCCOPY);
|
|---|
| 985 | SelectObject(memDC,oldBmp);
|
|---|
| 986 | DeleteObject(memBmp);
|
|---|
| 987 | DeleteDC(memDC);
|
|---|
| 988 | }
|
|---|
| 989 | //******************************************************************************
|
|---|
| 990 | //******************************************************************************
|
|---|
| 991 | VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint)
|
|---|
| 992 | {
|
|---|
| 993 | BOOL active = flags & WIN_NCACTIVATED;
|
|---|
| 994 | HDC hdc;
|
|---|
| 995 | RECT rect,rectClip,rfuzz;
|
|---|
| 996 |
|
|---|
| 997 | /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
|
|---|
| 998 | the call to GetDCEx implying that it is allowed not to use it either.
|
|---|
| 999 | However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN)
|
|---|
| 1000 | will cause clipRgn to be deleted after ReleaseDC().
|
|---|
| 1001 | Now, how is the "system" supposed to tell what happened?
|
|---|
| 1002 | */
|
|---|
| 1003 |
|
|---|
| 1004 | dprintf(("DoNCPaint %x %x %d", getWindowHandle(), clip, suppress_menupaint));
|
|---|
| 1005 | DecreaseLogCount();
|
|---|
| 1006 |
|
|---|
| 1007 | if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
|
|---|
| 1008 | ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return;
|
|---|
| 1009 |
|
|---|
| 1010 | rect.top = rect.left = 0;
|
|---|
| 1011 | rect.right = rectWindow.right - rectWindow.left;
|
|---|
| 1012 | rect.bottom = rectWindow.bottom - rectWindow.top;
|
|---|
| 1013 |
|
|---|
| 1014 | if (clip > 1)
|
|---|
| 1015 | {
|
|---|
| 1016 | //only redraw caption
|
|---|
| 1017 | GetRgnBox(clip,&rectClip);
|
|---|
| 1018 | }
|
|---|
| 1019 | else
|
|---|
| 1020 | {
|
|---|
| 1021 | clip = 0;
|
|---|
| 1022 | rectClip = rect;
|
|---|
| 1023 | }
|
|---|
| 1024 |
|
|---|
| 1025 | SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
|
|---|
| 1026 |
|
|---|
| 1027 | if (HAS_BIGFRAME( dwStyle, dwExStyle))
|
|---|
| 1028 | {
|
|---|
| 1029 | DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
|
|---|
| 1030 | }
|
|---|
| 1031 | if (HAS_THICKFRAME( dwStyle, dwExStyle ))
|
|---|
| 1032 | DrawFrame(hdc, &rect, FALSE, active );
|
|---|
| 1033 | else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
|
|---|
| 1034 | DrawFrame( hdc, &rect, TRUE, active );
|
|---|
| 1035 | else if (HAS_THINFRAME( dwStyle ))
|
|---|
| 1036 | {
|
|---|
| 1037 | SelectObject( hdc, GetStockObject(NULL_BRUSH) );
|
|---|
| 1038 | Rectangle( hdc, 0, 0, rect.right, rect.bottom );
|
|---|
| 1039 | }
|
|---|
| 1040 |
|
|---|
| 1041 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
|---|
| 1042 | {
|
|---|
| 1043 | RECT r = rect;
|
|---|
| 1044 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
|---|
| 1045 | {
|
|---|
| 1046 | r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
|
|---|
| 1047 | rect.top += GetSystemMetrics(SM_CYSMCAPTION);
|
|---|
| 1048 | }
|
|---|
| 1049 | else
|
|---|
| 1050 | {
|
|---|
| 1051 | r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
|
|---|
| 1052 | rect.top += GetSystemMetrics(SM_CYCAPTION);
|
|---|
| 1053 | }
|
|---|
| 1054 | if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
|
|---|
| 1055 | DrawCaption(hdc,&r,active);
|
|---|
| 1056 | }
|
|---|
| 1057 |
|
|---|
| 1058 | if (HAS_MENU())
|
|---|
| 1059 | {
|
|---|
| 1060 | RECT r = rect;
|
|---|
| 1061 | r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
|
|---|
| 1062 |
|
|---|
| 1063 | rect.top += MENU_DrawMenuBar(hdc,&r,Win32Hwnd,suppress_menupaint)+1;
|
|---|
| 1064 | }
|
|---|
| 1065 |
|
|---|
| 1066 | if (dwExStyle & WS_EX_CLIENTEDGE)
|
|---|
| 1067 | DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
|---|
| 1068 |
|
|---|
| 1069 | if (dwExStyle & WS_EX_STATICEDGE)
|
|---|
| 1070 | DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
|
|---|
| 1071 |
|
|---|
| 1072 | /* Draw the scroll-bars */
|
|---|
| 1073 | if (dwStyle & WS_VSCROLL)
|
|---|
| 1074 | SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE);
|
|---|
| 1075 | if (dwStyle & WS_HSCROLL)
|
|---|
| 1076 | SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE);
|
|---|
| 1077 |
|
|---|
| 1078 | /* Draw the "size-box" */
|
|---|
| 1079 | if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
|
|---|
| 1080 | {
|
|---|
| 1081 | RECT r = rect;
|
|---|
| 1082 | r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
|
|---|
| 1083 | r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
|
|---|
| 1084 | FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) );
|
|---|
| 1085 | if (!(dwStyle & WS_CHILD))
|
|---|
| 1086 | {
|
|---|
| 1087 | POINT p1,p2;
|
|---|
| 1088 | HPEN penDark = GetSysColorPen(COLOR_3DSHADOW);
|
|---|
| 1089 | HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT);
|
|---|
| 1090 | HPEN oldPen = SelectObject(hdc,penDark);
|
|---|
| 1091 | INT x;
|
|---|
| 1092 |
|
|---|
| 1093 | p1.x = r.right-1;
|
|---|
| 1094 | p1.y = r.bottom;
|
|---|
| 1095 | p2.x = r.right;
|
|---|
| 1096 | p2.y = r.bottom-1;
|
|---|
| 1097 | for (x = 0;x < 3;x++)
|
|---|
| 1098 | {
|
|---|
| 1099 | SelectObject(hdc,penDark);
|
|---|
| 1100 | MoveToEx(hdc,p1.x,p1.y,NULL);
|
|---|
| 1101 | LineTo(hdc,p2.x,p2.y);
|
|---|
| 1102 | p1.x--;
|
|---|
| 1103 | p2.y--;
|
|---|
| 1104 | MoveToEx(hdc,p1.x,p1.y,NULL);
|
|---|
| 1105 | LineTo(hdc,p2.x,p2.y);
|
|---|
| 1106 | SelectObject(hdc,penWhite);
|
|---|
| 1107 | p1.x--;
|
|---|
| 1108 | p2.y--;
|
|---|
| 1109 | MoveToEx(hdc,p1.x,p1.y,NULL);
|
|---|
| 1110 | LineTo(hdc,p2.x,p2.y);
|
|---|
| 1111 | p1.x -= 2;
|
|---|
| 1112 | p2.y -= 2;
|
|---|
| 1113 | }
|
|---|
| 1114 |
|
|---|
| 1115 | SelectObject(hdc,oldPen);
|
|---|
| 1116 | }
|
|---|
| 1117 | }
|
|---|
| 1118 |
|
|---|
| 1119 | ReleaseDC(Win32Hwnd,hdc);
|
|---|
| 1120 | IncreaseLogCount();
|
|---|
| 1121 | dprintf(("**DoNCPaint %x DONE", getWindowHandle()));
|
|---|
| 1122 | }
|
|---|
| 1123 | //******************************************************************************
|
|---|
| 1124 | //******************************************************************************
|
|---|
| 1125 | LONG Win32BaseWindow::HandleNCPaint(HRGN clip)
|
|---|
| 1126 | {
|
|---|
| 1127 | //CB: ignore it for now (SetWindowPos in WM_CREATE)
|
|---|
| 1128 | // if (!(dwStyle & WS_VISIBLE)) return 0;
|
|---|
| 1129 |
|
|---|
| 1130 | if (dwStyle & WS_MINIMIZE) return 0;
|
|---|
| 1131 |
|
|---|
| 1132 | DoNCPaint(clip,FALSE);
|
|---|
| 1133 |
|
|---|
| 1134 | return 0;
|
|---|
| 1135 | }
|
|---|
| 1136 | /***********************************************************************
|
|---|
| 1137 | * NC_HandleNCLButtonDblClk
|
|---|
| 1138 | *
|
|---|
| 1139 | * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
|
|---|
| 1140 | */
|
|---|
| 1141 | LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)
|
|---|
| 1142 | {
|
|---|
| 1143 | /*
|
|---|
| 1144 | * if this is an icon, send a restore since we are handling
|
|---|
| 1145 | * a double click
|
|---|
| 1146 | */
|
|---|
| 1147 | if (dwStyle & WS_MINIMIZE)
|
|---|
| 1148 | {
|
|---|
| 1149 | SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
|
|---|
| 1150 | return 0;
|
|---|
| 1151 | }
|
|---|
| 1152 |
|
|---|
| 1153 | switch(wParam) /* Hit test */
|
|---|
| 1154 | {
|
|---|
| 1155 | case HTCAPTION:
|
|---|
| 1156 | /* stop processing if WS_MAXIMIZEBOX is missing */
|
|---|
| 1157 | if (dwStyle & WS_MAXIMIZEBOX)
|
|---|
| 1158 | SendInternalMessageA(WM_SYSCOMMAND,
|
|---|
| 1159 | (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
|
|---|
| 1160 | lParam);
|
|---|
| 1161 | break;
|
|---|
| 1162 |
|
|---|
| 1163 | case HTSYSMENU:
|
|---|
| 1164 | if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
|
|---|
| 1165 | SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
|
|---|
| 1166 | break;
|
|---|
| 1167 |
|
|---|
| 1168 | case HTHSCROLL:
|
|---|
| 1169 | SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
|
|---|
| 1170 | break;
|
|---|
| 1171 |
|
|---|
| 1172 | case HTVSCROLL:
|
|---|
| 1173 | SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
|
|---|
| 1174 | break;
|
|---|
| 1175 | }
|
|---|
| 1176 |
|
|---|
| 1177 | return 0;
|
|---|
| 1178 | }
|
|---|
| 1179 | //******************************************************************************
|
|---|
| 1180 | //******************************************************************************
|
|---|
| 1181 | LONG Win32BaseWindow::HandleNCRButtonUp(WPARAM wParam,LPARAM lParam)
|
|---|
| 1182 | {
|
|---|
| 1183 | switch(wParam)
|
|---|
| 1184 | {
|
|---|
| 1185 | case HTCAPTION:
|
|---|
| 1186 | if (GetActiveWindow() != Win32Hwnd)
|
|---|
| 1187 | SetActiveWindow();
|
|---|
| 1188 |
|
|---|
| 1189 | if (((GetActiveWindow() == Win32Hwnd) || isMDIChild()) && (dwStyle & WS_SYSMENU))
|
|---|
| 1190 | {
|
|---|
| 1191 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTCAPTION,lParam);
|
|---|
| 1192 | }
|
|---|
| 1193 | break;
|
|---|
| 1194 |
|
|---|
| 1195 | default:
|
|---|
| 1196 | break;
|
|---|
| 1197 | }
|
|---|
| 1198 |
|
|---|
| 1199 | return 0;
|
|---|
| 1200 | }
|
|---|
| 1201 | /***********************************************************************
|
|---|
| 1202 | * NC_HandleSysCommand
|
|---|
| 1203 | *
|
|---|
| 1204 | * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
|
|---|
| 1205 | *
|
|---|
| 1206 | */
|
|---|
| 1207 | LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam,POINT *pt32)
|
|---|
| 1208 | {
|
|---|
| 1209 | UINT uCommand = wParam & 0xFFF0;
|
|---|
| 1210 |
|
|---|
| 1211 | switch (uCommand)
|
|---|
| 1212 | {
|
|---|
| 1213 |
|
|---|
| 1214 | case SC_SIZE:
|
|---|
| 1215 | {
|
|---|
| 1216 | DWORD flags;
|
|---|
| 1217 |
|
|---|
| 1218 | if (dwStyle & WS_MAXIMIZE) break;
|
|---|
| 1219 |
|
|---|
| 1220 | switch ((wParam & 0xF)+2)
|
|---|
| 1221 | {
|
|---|
| 1222 | case HTLEFT:
|
|---|
| 1223 | flags = TFOS_LEFT;
|
|---|
| 1224 | break;
|
|---|
| 1225 |
|
|---|
| 1226 | case HTRIGHT:
|
|---|
| 1227 | flags = TFOS_RIGHT;
|
|---|
| 1228 | break;
|
|---|
| 1229 |
|
|---|
| 1230 | case HTTOP:
|
|---|
| 1231 | flags = TFOS_TOP;
|
|---|
| 1232 | break;
|
|---|
| 1233 |
|
|---|
| 1234 | case HTTOPLEFT:
|
|---|
| 1235 | flags = TFOS_TOP | TFOS_LEFT;
|
|---|
| 1236 | break;
|
|---|
| 1237 |
|
|---|
| 1238 | case HTTOPRIGHT:
|
|---|
| 1239 | flags = TFOS_TOP | TFOS_RIGHT;
|
|---|
| 1240 | break;
|
|---|
| 1241 |
|
|---|
| 1242 | case HTBOTTOM:
|
|---|
| 1243 | flags = TFOS_BOTTOM;
|
|---|
| 1244 | break;
|
|---|
| 1245 |
|
|---|
| 1246 | case HTBOTTOMLEFT:
|
|---|
| 1247 | flags = TFOS_BOTTOM | TFOS_LEFT;
|
|---|
| 1248 | break;
|
|---|
| 1249 |
|
|---|
| 1250 | case HTBOTTOMRIGHT:
|
|---|
| 1251 | flags = TFOS_BOTTOM | TFOS_RIGHT;
|
|---|
| 1252 | break;
|
|---|
| 1253 |
|
|---|
| 1254 | default:
|
|---|
| 1255 | flags = TFOS_BOTTOM | TFOS_RIGHT;
|
|---|
| 1256 | break;
|
|---|
| 1257 | }
|
|---|
| 1258 | if (flags) FrameTrackFrame(this,flags);
|
|---|
| 1259 | break;
|
|---|
| 1260 | }
|
|---|
| 1261 |
|
|---|
| 1262 | case SC_MOVE:
|
|---|
| 1263 | if (dwStyle & WS_MAXIMIZE) break;
|
|---|
| 1264 | FrameTrackFrame(this,TFOS_MOVE);
|
|---|
| 1265 | break;
|
|---|
| 1266 |
|
|---|
| 1267 | case SC_MINIMIZE:
|
|---|
| 1268 | ShowWindow(SW_MINIMIZE);
|
|---|
| 1269 | break;
|
|---|
| 1270 |
|
|---|
| 1271 | case SC_MAXIMIZE:
|
|---|
| 1272 | ShowWindow(SW_MAXIMIZE);
|
|---|
| 1273 | break;
|
|---|
| 1274 |
|
|---|
| 1275 | case SC_RESTORE:
|
|---|
| 1276 | ShowWindow(SW_RESTORE);
|
|---|
| 1277 | break;
|
|---|
| 1278 |
|
|---|
| 1279 | case SC_CLOSE:
|
|---|
| 1280 | return SendInternalMessageA(WM_CLOSE,0,0);
|
|---|
| 1281 |
|
|---|
| 1282 | case SC_VSCROLL:
|
|---|
| 1283 | case SC_HSCROLL:
|
|---|
| 1284 | TrackScrollBar(wParam,*pt32);
|
|---|
| 1285 | break;
|
|---|
| 1286 |
|
|---|
| 1287 | case SC_MOUSEMENU:
|
|---|
| 1288 | MENU_TrackMouseMenuBar(Win32Hwnd,wParam & 0x000F,*pt32);
|
|---|
| 1289 | break;
|
|---|
| 1290 |
|
|---|
| 1291 | case SC_KEYMENU:
|
|---|
| 1292 | MENU_TrackKbdMenuBar(Win32Hwnd,wParam,pt32->x);
|
|---|
| 1293 | break;
|
|---|
| 1294 |
|
|---|
| 1295 | case SC_TASKLIST:
|
|---|
| 1296 | OSLibWinShowTaskList(getOS2FrameWindowHandle());
|
|---|
| 1297 | break;
|
|---|
| 1298 |
|
|---|
| 1299 | case SC_SCREENSAVE:
|
|---|
| 1300 | if (wParam == SC_ABOUTODIN) {
|
|---|
| 1301 | if(ShellAboutA == 0) {
|
|---|
| 1302 | HINSTANCE hShell32 = LoadLibraryA("SHELL32");
|
|---|
| 1303 | if(hShell32 == 0)
|
|---|
| 1304 | break;
|
|---|
| 1305 | *(VOID **)&ShellAboutA = (VOID *)GetProcAddress(hShell32, "ShellAboutA");
|
|---|
| 1306 | }
|
|---|
| 1307 | ShellAboutA(Win32Hwnd,"Odin","Odin alpha release compiled with IBM VAC++",0);
|
|---|
| 1308 | }
|
|---|
| 1309 | else
|
|---|
| 1310 | if (wParam == SC_PUTMARK)
|
|---|
| 1311 | dprintf(("Mark requested by user\n"));
|
|---|
| 1312 | break;
|
|---|
| 1313 |
|
|---|
| 1314 | case SC_HOTKEY:
|
|---|
| 1315 | case SC_ARRANGE:
|
|---|
| 1316 | case SC_NEXTWINDOW:
|
|---|
| 1317 | case SC_PREVWINDOW:
|
|---|
| 1318 | break;
|
|---|
| 1319 | }
|
|---|
| 1320 | return 0;
|
|---|
| 1321 | }
|
|---|
| 1322 | /*****************************************************************************
|
|---|
| 1323 | * Name : VOID WIN32API DrawCaption
|
|---|
| 1324 | * Purpose : The DrawCaption function draws a window caption.
|
|---|
| 1325 | * Parameters: HDC hdc handle of device context
|
|---|
| 1326 | * LPRECT lprc address of bounding rectangle coordinates
|
|---|
| 1327 | * HFONT hfont handle of font for caption
|
|---|
| 1328 | * HICON hicon handle of icon in caption
|
|---|
| 1329 | * LPSTR lpszText address of caption string
|
|---|
| 1330 | * WORD wFlags drawing options
|
|---|
| 1331 | * Variables :
|
|---|
| 1332 | * Result :
|
|---|
| 1333 | * Remark :
|
|---|
| 1334 | * Status : UNTESTED STUB
|
|---|
| 1335 | *
|
|---|
| 1336 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1337 | *****************************************************************************/
|
|---|
| 1338 |
|
|---|
| 1339 | BOOL WIN32API DrawCaption (HWND hwnd,
|
|---|
| 1340 | HDC hdc,
|
|---|
| 1341 | const RECT *lprc,
|
|---|
| 1342 | UINT wFlags)
|
|---|
| 1343 | {
|
|---|
| 1344 | dprintf(("USER32:DrawCaption (%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
|---|
| 1345 | hwnd,
|
|---|
| 1346 | hdc,
|
|---|
| 1347 | lprc,
|
|---|
| 1348 | wFlags));
|
|---|
| 1349 |
|
|---|
| 1350 | return FALSE;
|
|---|
| 1351 | }
|
|---|
| 1352 | /***********************************************************************
|
|---|
| 1353 | * DrawCaptionTemp32A [USER32.599]
|
|---|
| 1354 | *
|
|---|
| 1355 | * PARAMS
|
|---|
| 1356 | *
|
|---|
| 1357 | * RETURNS
|
|---|
| 1358 | * Success:
|
|---|
| 1359 | * Failure:
|
|---|
| 1360 | */
|
|---|
| 1361 |
|
|---|
| 1362 | BOOL WIN32API DrawCaptionTempA(HWND hwnd,
|
|---|
| 1363 | HDC hdc,
|
|---|
| 1364 | const RECT *rect,
|
|---|
| 1365 | HFONT hFont,
|
|---|
| 1366 | HICON hIcon,
|
|---|
| 1367 | LPCSTR str,
|
|---|
| 1368 | UINT uFlags)
|
|---|
| 1369 | {
|
|---|
| 1370 | RECT rc = *rect;
|
|---|
| 1371 |
|
|---|
| 1372 | dprintf(("USER32: DrawCaptionTempA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
|
|---|
| 1373 | hwnd,
|
|---|
| 1374 | hdc,
|
|---|
| 1375 | rect,
|
|---|
| 1376 | hFont,
|
|---|
| 1377 | hIcon,
|
|---|
| 1378 | str,
|
|---|
| 1379 | uFlags));
|
|---|
| 1380 |
|
|---|
| 1381 | /* drawing background */
|
|---|
| 1382 | if (uFlags & DC_INBUTTON)
|
|---|
| 1383 | {
|
|---|
| 1384 | O32_FillRect (hdc,
|
|---|
| 1385 | &rc,
|
|---|
| 1386 | GetSysColorBrush (COLOR_3DFACE));
|
|---|
| 1387 |
|
|---|
| 1388 | if (uFlags & DC_ACTIVE)
|
|---|
| 1389 | {
|
|---|
| 1390 | HBRUSH hbr = O32_SelectObject (hdc,
|
|---|
| 1391 | GetSysColorBrush (COLOR_ACTIVECAPTION));
|
|---|
| 1392 | O32_PatBlt (hdc,
|
|---|
| 1393 | rc.left,
|
|---|
| 1394 | rc.top,
|
|---|
| 1395 | rc.right - rc.left,
|
|---|
| 1396 | rc.bottom - rc.top,
|
|---|
| 1397 | 0xFA0089);
|
|---|
| 1398 |
|
|---|
| 1399 | O32_SelectObject (hdc,
|
|---|
| 1400 | hbr);
|
|---|
| 1401 | }
|
|---|
| 1402 | }
|
|---|
| 1403 | else
|
|---|
| 1404 | {
|
|---|
| 1405 | O32_FillRect (hdc,
|
|---|
| 1406 | &rc,
|
|---|
| 1407 | GetSysColorBrush ((uFlags & DC_ACTIVE) ?
|
|---|
| 1408 | COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
|
|---|
| 1409 | }
|
|---|
| 1410 |
|
|---|
| 1411 |
|
|---|
| 1412 | /* drawing icon */
|
|---|
| 1413 | if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP))
|
|---|
| 1414 | {
|
|---|
| 1415 | POINT pt;
|
|---|
| 1416 |
|
|---|
| 1417 | pt.x = rc.left + 2;
|
|---|
| 1418 | pt.y = (rc.bottom + rc.top - O32_GetSystemMetrics(SM_CYSMICON)) / 2;
|
|---|
| 1419 |
|
|---|
| 1420 | if (hIcon)
|
|---|
| 1421 | {
|
|---|
| 1422 | DrawIconEx (hdc,
|
|---|
| 1423 | pt.x,
|
|---|
| 1424 | pt.y,
|
|---|
| 1425 | hIcon,
|
|---|
| 1426 | O32_GetSystemMetrics(SM_CXSMICON),
|
|---|
| 1427 | O32_GetSystemMetrics(SM_CYSMICON),
|
|---|
| 1428 | 0,
|
|---|
| 1429 | 0,
|
|---|
| 1430 | DI_NORMAL);
|
|---|
| 1431 | }
|
|---|
| 1432 | else
|
|---|
| 1433 | {
|
|---|
| 1434 | /* @@@PH 1999/06/08 not ported yet, just don't draw any icon
|
|---|
| 1435 | WND *wndPtr = WIN_FindWndPtr(hwnd);
|
|---|
| 1436 | HICON hAppIcon = 0;
|
|---|
| 1437 |
|
|---|
| 1438 | if (wndPtr->class->hIconSm)
|
|---|
| 1439 | hAppIcon = wndPtr->class->hIconSm;
|
|---|
| 1440 | else
|
|---|
| 1441 | if (wndPtr->class->hIcon)
|
|---|
| 1442 | hAppIcon = wndPtr->class->hIcon;
|
|---|
| 1443 |
|
|---|
| 1444 | DrawIconEx (hdc,
|
|---|
| 1445 | pt.x,
|
|---|
| 1446 | pt.y,
|
|---|
| 1447 | hAppIcon,
|
|---|
| 1448 | GetSystemMetrics(SM_CXSMICON),
|
|---|
| 1449 | GetSystemMetrics(SM_CYSMICON),
|
|---|
| 1450 | 0,
|
|---|
| 1451 | 0,
|
|---|
| 1452 | DI_NORMAL);
|
|---|
| 1453 |
|
|---|
| 1454 | WIN_ReleaseWndPtr(wndPtr);
|
|---|
| 1455 | */
|
|---|
| 1456 | }
|
|---|
| 1457 |
|
|---|
| 1458 | rc.left += (rc.bottom - rc.top);
|
|---|
| 1459 | }
|
|---|
| 1460 |
|
|---|
| 1461 | /* drawing text */
|
|---|
| 1462 | if (uFlags & DC_TEXT)
|
|---|
| 1463 | {
|
|---|
| 1464 | HFONT hOldFont;
|
|---|
| 1465 |
|
|---|
| 1466 | if (uFlags & DC_INBUTTON)
|
|---|
| 1467 | O32_SetTextColor (hdc,
|
|---|
| 1468 | O32_GetSysColor (COLOR_BTNTEXT));
|
|---|
| 1469 | else
|
|---|
| 1470 | if (uFlags & DC_ACTIVE)
|
|---|
| 1471 | O32_SetTextColor (hdc,
|
|---|
| 1472 | O32_GetSysColor (COLOR_CAPTIONTEXT));
|
|---|
| 1473 | else
|
|---|
| 1474 | O32_SetTextColor (hdc,
|
|---|
| 1475 | O32_GetSysColor (COLOR_INACTIVECAPTIONTEXT));
|
|---|
| 1476 |
|
|---|
| 1477 | O32_SetBkMode (hdc,
|
|---|
| 1478 | TRANSPARENT);
|
|---|
| 1479 |
|
|---|
| 1480 | if (hFont)
|
|---|
| 1481 | hOldFont = O32_SelectObject (hdc,
|
|---|
| 1482 | hFont);
|
|---|
| 1483 | else
|
|---|
| 1484 | {
|
|---|
| 1485 | NONCLIENTMETRICSA nclm;
|
|---|
| 1486 | HFONT hNewFont;
|
|---|
| 1487 |
|
|---|
| 1488 | nclm.cbSize = sizeof(NONCLIENTMETRICSA);
|
|---|
| 1489 | O32_SystemParametersInfo (SPI_GETNONCLIENTMETRICS,
|
|---|
| 1490 | 0,
|
|---|
| 1491 | &nclm,
|
|---|
| 1492 | 0);
|
|---|
| 1493 | hNewFont = O32_CreateFontIndirect ((uFlags & DC_SMALLCAP) ?
|
|---|
| 1494 | &nclm.lfSmCaptionFont : &nclm.lfCaptionFont);
|
|---|
| 1495 | hOldFont = O32_SelectObject (hdc,
|
|---|
| 1496 | hNewFont);
|
|---|
| 1497 | }
|
|---|
| 1498 |
|
|---|
| 1499 | if (str)
|
|---|
| 1500 | DrawTextA (hdc,
|
|---|
| 1501 | str,
|
|---|
| 1502 | -1,
|
|---|
| 1503 | &rc,
|
|---|
| 1504 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
|
|---|
| 1505 | else
|
|---|
| 1506 | {
|
|---|
| 1507 | CHAR szText[128];
|
|---|
| 1508 | INT nLen;
|
|---|
| 1509 |
|
|---|
| 1510 | nLen = O32_GetWindowText (Win32BaseWindow::Win32ToOS2FrameHandle(hwnd),
|
|---|
| 1511 | szText,
|
|---|
| 1512 | 128);
|
|---|
| 1513 |
|
|---|
| 1514 | DrawTextA (hdc,
|
|---|
| 1515 | szText,
|
|---|
| 1516 | nLen,
|
|---|
| 1517 | &rc,
|
|---|
| 1518 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
|
|---|
| 1519 | }
|
|---|
| 1520 |
|
|---|
| 1521 | if (hFont)
|
|---|
| 1522 | O32_SelectObject (hdc,
|
|---|
| 1523 | hOldFont);
|
|---|
| 1524 | else
|
|---|
| 1525 | O32_DeleteObject (O32_SelectObject (hdc,
|
|---|
| 1526 | hOldFont));
|
|---|
| 1527 | }
|
|---|
| 1528 |
|
|---|
| 1529 | /* drawing focus ??? */
|
|---|
| 1530 | if (uFlags & 0x2000)
|
|---|
| 1531 | {
|
|---|
| 1532 | dprintf(("USER32: DrawCaptionTempA undocumented flag (0x2000)!\n"));
|
|---|
| 1533 | }
|
|---|
| 1534 |
|
|---|
| 1535 | return 0;
|
|---|
| 1536 | }
|
|---|
| 1537 | /***********************************************************************
|
|---|
| 1538 | * DrawCaptionTemp32W [USER32.602]
|
|---|
| 1539 | *
|
|---|
| 1540 | * PARAMS
|
|---|
| 1541 | *
|
|---|
| 1542 | * RETURNS
|
|---|
| 1543 | * Success:
|
|---|
| 1544 | * Failure:
|
|---|
| 1545 | */
|
|---|
| 1546 |
|
|---|
| 1547 | BOOL WIN32API DrawCaptionTempW (HWND hwnd,
|
|---|
| 1548 | HDC hdc,
|
|---|
| 1549 | const RECT *rect,
|
|---|
| 1550 | HFONT hFont,
|
|---|
| 1551 | HICON hIcon,
|
|---|
| 1552 | LPCWSTR str,
|
|---|
| 1553 | UINT uFlags)
|
|---|
| 1554 | {
|
|---|
| 1555 | LPSTR strAscii = UnicodeToAsciiString((LPWSTR)str);
|
|---|
| 1556 |
|
|---|
| 1557 | BOOL res = DrawCaptionTempA (hwnd,
|
|---|
| 1558 | hdc,
|
|---|
| 1559 | rect,
|
|---|
| 1560 | hFont,
|
|---|
| 1561 | hIcon,
|
|---|
| 1562 | strAscii,
|
|---|
| 1563 | uFlags);
|
|---|
| 1564 |
|
|---|
| 1565 | FreeAsciiString(strAscii);
|
|---|
| 1566 |
|
|---|
| 1567 | return res;
|
|---|
| 1568 | }
|
|---|
| 1569 |
|
|---|