ReactOS  0.4.13-dev-455-g28ed234
nonclient.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS uxtheme.dll
4  * FILE: dll/win32/uxtheme/nonclient.c
5  * PURPOSE: uxtheme non client area management
6  * PROGRAMMER: Giannis Adamopoulos
7  */
8 
9 #include "uxthemep.h"
10 
11 static BOOL
13 {
14  BOOL ret;
15 
16  if (ExStyle & WS_EX_MDICHILD)
17  {
19  if (ret)
21  }
22  else
23  {
24  ret = (GetForegroundWindow() == hWnd);
25  }
26 
27  return ret;
28 }
29 
30 BOOL
32 {
33  SCROLLBARINFO sbi = {sizeof(SCROLLBARINFO)};
34  if(!GetScrollBarInfo(hWnd, hBar, &sbi))
35  return FALSE;
36 
37  return !(sbi.rgstate[0] & STATE_SYSTEM_OFFSCREEN);
38 }
39 
40 static BOOL
42 {
43  if (Style & WS_MINIMIZE)
44  return TRUE;
46  return TRUE;
48  return FALSE;
49  if (Style & WS_THICKFRAME)
50  return TRUE;
51  Style &= WS_CAPTION;
52  if (Style == WS_DLGFRAME || Style == WS_CAPTION)
53  return TRUE;
54  return FALSE;
55 }
56 
57 static HICON
59 {
60  HICON hIcon = NULL;
61 
62  SendMessageTimeout(pcontext->hWnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
63 
64  if (!hIcon)
65  SendMessageTimeout(pcontext->hWnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
66 
67  if (!hIcon)
68  SendMessageTimeout(pcontext->hWnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
69 
70  if (!hIcon)
72 
73  if (!hIcon)
74  hIcon = (HICON)GetClassLongPtr(pcontext->hWnd, GCLP_HICON);
75 
76  // See also win32ss/user/ntuser/nonclient.c!NC_IconForWindow
77  if (!hIcon && !(pcontext->wi.dwExStyle & WS_EX_DLGMODALFRAME))
79 
80  return hIcon;
81 }
82 
83 HRESULT WINAPI ThemeDrawCaptionText(PDRAW_CONTEXT pcontext, RECT* pRect, int iPartId, int iStateId)
84 {
85  HRESULT hr;
86  HFONT hFont = NULL;
87  HGDIOBJ oldFont = NULL;
88  LOGFONTW logfont;
89  COLORREF textColor;
90  COLORREF oldTextColor;
91  int align = CA_LEFT;
92  int drawStyles = DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS;
93 
94  WCHAR buffer[50];
95  WCHAR *pszText = buffer;
96  INT len;
97 
98  len = InternalGetWindowText(pcontext->hWnd, NULL, 0);
99  if (!len)
100  return S_OK;
101 
102  len++; /* From now on this is the size of the buffer so include the null */
103 
104  if (len > ARRAYSIZE(buffer))
105  {
106  pszText = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
107  if (!pszText)
108  return E_OUTOFMEMORY;
109  }
110 
111  InternalGetWindowText(pcontext->hWnd, pszText, len);
112 
113  hr = GetThemeSysFont(0,TMT_CAPTIONFONT,&logfont);
114  if(SUCCEEDED(hr))
115  hFont = CreateFontIndirectW(&logfont);
116 
117  if(hFont)
118  oldFont = SelectObject(pcontext->hDC, hFont);
119 
120  if (!pcontext->Active)
122  else
123  textColor = GetSysColor(COLOR_CAPTIONTEXT);
124 
125  GetThemeEnumValue(pcontext->theme, iPartId, iStateId, TMT_CONTENTALIGNMENT, &align);
126  if (align == CA_CENTER)
127  drawStyles |= DT_CENTER;
128  else if (align == CA_RIGHT)
129  drawStyles |= DT_RIGHT;
130 
131  oldTextColor = SetTextColor(pcontext->hDC, textColor);
132  DrawThemeText(pcontext->theme,
133  pcontext->hDC,
134  iPartId,
135  iStateId,
136  pszText,
137  len - 1,
138  drawStyles,
139  0,
140  pRect);
141  SetTextColor(pcontext->hDC, oldTextColor);
142 
143  if (hFont)
144  {
145  SelectObject(pcontext->hDC, oldFont);
147  }
148  if (pszText != buffer)
149  {
150  HeapFree(GetProcessHeap(), 0, pszText);
151  }
152  return S_OK;
153 }
154 
155 void
157  HWND hWnd,
158  HRGN hRgn)
159 {
160  pcontext->wi.cbSize = sizeof(pcontext->wi);
161  GetWindowInfo(hWnd, &pcontext->wi);
162  pcontext->hWnd = hWnd;
163  pcontext->Active = IsWindowActive(hWnd, pcontext->wi.dwExStyle);
164  pcontext->theme = GetNCCaptionTheme(hWnd, pcontext->wi.dwStyle);
165  pcontext->scrolltheme = GetNCScrollbarTheme(hWnd, pcontext->wi.dwStyle);
166 
167  pcontext->CaptionHeight = pcontext->wi.cyWindowBorders;
169 
170  if(hRgn <= (HRGN)1)
171  {
172  hRgn = CreateRectRgnIndirect(&pcontext->wi.rcWindow);
173  }
174  pcontext->hRgn = hRgn;
175 
177 }
178 
179 void
181 {
182  ReleaseDC(pcontext->hWnd ,pcontext->hDC);
183 
184  if(pcontext->hRgn != NULL)
185  {
186  DeleteObject(pcontext->hRgn);
187  }
188 }
189 
190 static void
192 {
193  HBITMAP hbmp;
194 
195  pcontext->hDCScreen = pcontext->hDC;
196  pcontext->hDC = CreateCompatibleDC(pcontext->hDCScreen);
197  hbmp = CreateCompatibleBitmap(pcontext->hDCScreen, cx, cy);
198  pcontext->hbmpOld = (HBITMAP)SelectObject(pcontext->hDC, hbmp);
199 }
200 
201 static void
202 ThemeEndBufferedPaint(PDRAW_CONTEXT pcontext, int x, int y, int cx, int cy)
203 {
204  HBITMAP hbmp;
205  BitBlt(pcontext->hDCScreen, 0, 0, cx, cy, pcontext->hDC, x, y, SRCCOPY);
206  hbmp = (HBITMAP) SelectObject(pcontext->hDC, pcontext->hbmpOld);
207  DeleteObject(pcontext->hDC);
209 
210  pcontext->hDC = pcontext->hDCScreen;
211 }
212 
214 {
215  PWND_DATA pwndData;
216  DWORD style;
217  INT ButtonWidth, ButtonHeight, iPartId, i;
218  WINDOWINFO wi = {sizeof(wi)};
219  RECT rcCurrent;
220  SIZE ButtonSize;
221 
222  /* First of all check if we have something to do here */
224  if((style & (WS_CAPTION | WS_SYSMENU)) != (WS_CAPTION | WS_SYSMENU))
225  return;
226 
227  /* Get theme data for this window */
228  pwndData = ThemeGetWndData(hWnd);
229  if (pwndData == NULL)
230  return;
231 
232  if (!htheme)
233  {
234  htheme = GetNCCaptionTheme(hWnd, style);
235  if (!htheme)
236  return;
237  }
238 
239  if(!GetWindowInfo(hWnd, &wi))
240  return;
241 
242  /* Calculate the area of the caption */
243  rcCurrent.top = rcCurrent.left = 0;
244  rcCurrent.right = wi.rcWindow.right - wi.rcWindow.left;
245  rcCurrent.bottom = wi.rcWindow.bottom - wi.rcWindow.top;
246 
247  /* Add a padding around the objects of the caption */
248  InflateRect(&rcCurrent, -(int)wi.cyWindowBorders-BUTTON_GAP_SIZE,
250 
252 
253  GetThemePartSize(htheme, NULL, iPartId, 0, NULL, TS_MIN, &ButtonSize);
254 
256  ButtonWidth = MulDiv(ButtonSize.cx, ButtonHeight, ButtonSize.cy);
257 
258  ButtonHeight -= 4;
259  ButtonWidth -= 4;
260 
261  for (i = CLOSEBUTTON; i <= HELPBUTTON; i++)
262  {
263  SetRect(&pwndData->rcCaptionButtons[i],
264  rcCurrent.right - ButtonWidth,
265  rcCurrent.top,
266  rcCurrent.right,
267  rcCurrent.top + ButtonHeight);
268 
269  rcCurrent.right -= ButtonWidth + BUTTON_GAP_SIZE;
270  }
271 }
272 
273 static void
275  RECT* prcCurrent,
276  CAPTIONBUTTON buttonId,
277  INT iStateId)
278 {
279  INT iPartId;
280  PWND_DATA pwndData = ThemeGetWndData(pcontext->hWnd);
281  if (!pwndData)
282  return;
283 
284  switch(buttonId)
285  {
286  case CLOSEBUTTON:
288  break;
289 
290  case MAXBUTTON:
291  if (!(pcontext->wi.dwStyle & WS_MAXIMIZEBOX))
292  {
293  if (!(pcontext->wi.dwStyle & WS_MINIMIZEBOX))
294  return;
295  else
296  iStateId = (pcontext->Active ? BUTTON_DISABLED : BUTTON_INACTIVE_DISABLED);
297  }
298 
299  iPartId = pcontext->wi.dwStyle & WS_MAXIMIZE ? WP_RESTOREBUTTON : WP_MAXBUTTON;
300  break;
301 
302  case MINBUTTON:
303  if (!(pcontext->wi.dwStyle & WS_MINIMIZEBOX))
304  {
305  if (!(pcontext->wi.dwStyle & WS_MAXIMIZEBOX))
306  return;
307  else
308  iStateId = (pcontext->Active ? BUTTON_DISABLED : BUTTON_INACTIVE_DISABLED);
309  }
310 
311  iPartId = pcontext->wi.dwStyle & WS_MINIMIZE ? WP_RESTOREBUTTON : WP_MINBUTTON;
312  break;
313 
314  default:
315  //FIXME: Implement Help Button
316  return;
317  }
318 
319  if (prcCurrent)
320  prcCurrent->right = pwndData->rcCaptionButtons[buttonId].left;
321 
322  DrawThemeBackground(pcontext->theme, pcontext->hDC, iPartId, iStateId, &pwndData->rcCaptionButtons[buttonId], NULL);
323 }
324 
325 static DWORD
326 ThemeGetButtonState(DWORD htCurrect, DWORD htHot, DWORD htDown, BOOL Active)
327 {
328  if (htHot == htCurrect)
330  if (htDown == htCurrect)
332 
333  return (Active ? BUTTON_NORMAL : BUTTON_INACTIVE);
334 }
335 
336 /* Used only from mouse event handlers */
337 static void
339 {
340  /* Draw the buttons */
342  ThemeGetButtonState(HTCLOSE, htHot, htDown, pcontext->Active));
344  ThemeGetButtonState(HTMAXBUTTON, htHot, htDown, pcontext->Active));
346  ThemeGetButtonState(HTMINBUTTON, htHot, htDown, pcontext->Active));
348  ThemeGetButtonState(HTHELP, htHot, htDown, pcontext->Active));
349 }
350 
351 /* Used from WM_NCPAINT and WM_NCACTIVATE handlers */
352 static void
353 ThemeDrawCaption(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
354 {
355  RECT rcPart;
356  int iPart, iState;
357  HICON hIcon;
358 
359  // See also win32ss/user/ntuser/nonclient.c!UserDrawCaptionBar
360  // and win32ss/user/ntuser/nonclient.c!UserDrawCaption
361  if ((pcontext->wi.dwStyle & WS_SYSMENU) && !(pcontext->wi.dwExStyle & WS_EX_TOOLWINDOW))
362  hIcon = UserGetWindowIcon(pcontext);
363  else
364  hIcon = NULL;
365 
366  /* Get the caption part and state id */
367  if (pcontext->wi.dwStyle & WS_MINIMIZE)
368  iPart = WP_MINCAPTION;
369  else if (pcontext->wi.dwExStyle & WS_EX_TOOLWINDOW)
370  iPart = WP_SMALLCAPTION;
371  else if (pcontext->wi.dwStyle & WS_MAXIMIZE)
372  iPart = WP_MAXCAPTION;
373  else
374  iPart = WP_CAPTION;
375 
376  iState = pcontext->Active ? FS_ACTIVE : FS_INACTIVE;
377 
378  /* Draw the caption background */
379  rcPart = *prcCurrent;
380  rcPart.bottom = rcPart.top + pcontext->CaptionHeight;
381  prcCurrent->top = rcPart.bottom;
382  DrawThemeBackground(pcontext->theme, pcontext->hDC,iPart,iState,&rcPart,NULL);
383 
384  /* Add a padding around the objects of the caption */
385  InflateRect(&rcPart, -(int)pcontext->wi.cyWindowBorders-BUTTON_GAP_SIZE,
386  -(int)pcontext->wi.cyWindowBorders-BUTTON_GAP_SIZE);
387 
388  /* Draw the caption buttons */
389  if (pcontext->wi.dwStyle & WS_SYSMENU)
390  {
391  iState = pcontext->Active ? BUTTON_NORMAL : BUTTON_INACTIVE;
392 
393  ThemeDrawCaptionButton(pcontext, &rcPart, CLOSEBUTTON, iState);
394  ThemeDrawCaptionButton(pcontext, &rcPart, MAXBUTTON, iState);
395  ThemeDrawCaptionButton(pcontext, &rcPart, MINBUTTON, iState);
396  ThemeDrawCaptionButton(pcontext, &rcPart, HELPBUTTON, iState);
397  }
398 
399  rcPart.top += 3 ;
400 
401  /* Draw the icon */
402  if (hIcon)
403  {
404  int IconHeight = GetSystemMetrics(SM_CYSMICON);
405  int IconWidth = GetSystemMetrics(SM_CXSMICON);
406  DrawIconEx(pcontext->hDC, rcPart.left, rcPart.top , hIcon, IconWidth, IconHeight, 0, NULL, DI_NORMAL);
407  rcPart.left += IconWidth + 4;
408  }
409 
410  rcPart.right -= 4;
411 
412  /* Draw the caption */
413  ThemeDrawCaptionText(pcontext, &rcPart, iPart, iState);
414 }
415 
416 static void
417 ThemeDrawBorders(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
418 {
419  RECT rcPart;
420  int iState = pcontext->Active ? FS_ACTIVE : FS_INACTIVE;
421 
422  /* Draw the bottom border */
423  rcPart = *prcCurrent;
424  rcPart.top = rcPart.bottom - pcontext->wi.cyWindowBorders;
425  prcCurrent->bottom = rcPart.top;
426  DrawThemeBackground(pcontext->theme, pcontext->hDC, WP_FRAMEBOTTOM, iState, &rcPart, NULL);
427 
428  /* Draw the left border */
429  rcPart = *prcCurrent;
430  rcPart.right = rcPart.left + pcontext->wi.cxWindowBorders ;
431  prcCurrent->left = rcPart.right;
432  DrawThemeBackground(pcontext->theme, pcontext->hDC,WP_FRAMELEFT, iState, &rcPart, NULL);
433 
434  /* Draw the right border */
435  rcPart = *prcCurrent;
436  rcPart.left = rcPart.right - pcontext->wi.cxWindowBorders;
437  prcCurrent->right = rcPart.left;
438  DrawThemeBackground(pcontext->theme, pcontext->hDC,WP_FRAMERIGHT, iState, &rcPart, NULL);
439 }
440 
441 static void
443 {
444  /* Draw outer edge */
445  if (UserHasWindowEdge(context->wi.dwStyle, context->wi.dwExStyle))
446  {
447  DrawEdge(context->hDC, prcCurrent, EDGE_RAISED, BF_RECT | BF_ADJUST);
448  }
449  else if (context->wi.dwExStyle & WS_EX_STATICEDGE)
450  {
451  DrawEdge(context->hDC, prcCurrent, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
452  }
453 
454  /* Firstly the "thick" frame */
455  if ((context->wi.dwStyle & WS_THICKFRAME) && !(context->wi.dwStyle & WS_MINIMIZE))
456  {
457  INT Width =
460  INT Height =
463 
466 
467  /* Draw frame */
468  PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
469  prcCurrent->right - prcCurrent->left, Height, PATCOPY);
470  PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
471  Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
472  PatBlt(context->hDC, prcCurrent->left, prcCurrent->bottom - 1,
473  prcCurrent->right - prcCurrent->left, -Height, PATCOPY);
474  PatBlt(context->hDC, prcCurrent->right - 1, prcCurrent->top,
475  -Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
476 
477  InflateRect(prcCurrent, -Width, -Height);
478  }
479 
480  /* Now the other bit of the frame */
481  if (context->wi.dwStyle & (WS_DLGFRAME | WS_BORDER) || (context->wi.dwExStyle & WS_EX_DLGMODALFRAME))
482  {
484  INT Height = GetSystemMetrics(SM_CYBORDER);
485 
487  (context->wi.dwExStyle & (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE)) ? COLOR_3DFACE :
488  (context->wi.dwExStyle & WS_EX_STATICEDGE) ? COLOR_WINDOWFRAME :
489  (context->wi.dwStyle & (WS_DLGFRAME | WS_THICKFRAME)) ? COLOR_3DFACE :
491 
492  /* Draw frame */
493  PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
494  prcCurrent->right - prcCurrent->left, Height, PATCOPY);
495  PatBlt(context->hDC, prcCurrent->left, prcCurrent->top,
496  Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
497  PatBlt(context->hDC, prcCurrent->left, prcCurrent->bottom - 1,
498  prcCurrent->right - prcCurrent->left, -Height, PATCOPY);
499  PatBlt(context->hDC, prcCurrent->right - 1, prcCurrent->top,
500  -Width, prcCurrent->bottom - prcCurrent->top, PATCOPY);
501 
502  InflateRect(prcCurrent, -Width, -Height);
503  }
504 }
505 
506 static void ThemeDrawMenuBar(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
507 {
508  /* Let the window manager paint the menu */
509  prcCurrent->top += PaintMenuBar(pcontext->hWnd,
510  pcontext->hDC,
511  pcontext->wi.cxWindowBorders,
512  pcontext->wi.cxWindowBorders,
513  prcCurrent->top,
514  pcontext->Active);
515 }
516 
517 static void ThemeDrawScrollBarsGrip(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
518 {
519  RECT rcPart;
521  RECT ParentClientRect;
522  DWORD ParentStyle;
523 
524  rcPart = *prcCurrent;
525 
526  if (pcontext->wi.dwExStyle & WS_EX_LEFTSCROLLBAR)
527  rcPart.right = rcPart.left + GetSystemMetrics(SM_CXVSCROLL);
528  else
529  rcPart.left = rcPart.right - GetSystemMetrics(SM_CXVSCROLL);
530 
531  rcPart.top = rcPart.bottom - GetSystemMetrics(SM_CYHSCROLL);
532 
533  FillRect(pcontext->hDC, &rcPart, GetSysColorBrush(COLOR_BTNFACE));
534 
535  hwndParent = GetParent(pcontext->hWnd);
536  GetClientRect(hwndParent, &ParentClientRect);
537  ParentStyle = GetWindowLongW(hwndParent, GWL_STYLE);
538 
539  if (HASSIZEGRIP(pcontext->wi.dwStyle, pcontext->wi.dwExStyle, ParentStyle, pcontext->wi.rcWindow, ParentClientRect))
540  {
541  int iState;
542  if (pcontext->wi.dwExStyle & WS_EX_LEFTSCROLLBAR)
543  iState = pcontext->wi.dwExStyle & WS_EX_LEFTSCROLLBAR;
544  else
545  iState = SZB_RIGHTALIGN;
546  DrawThemeBackground(pcontext->scrolltheme, pcontext->hDC, SBP_SIZEBOX, iState, &rcPart, NULL);
547  }
548 }
549 
550 static void
551 ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent, BOOL bDoDoubleBuffering)
552 {
553  if(!(pcontext->wi.dwStyle & WS_VISIBLE))
554  return;
555 
556  if((pcontext->wi.dwStyle & WS_CAPTION)==WS_CAPTION)
557  {
558  if (bDoDoubleBuffering)
559  ThemeStartBufferedPaint(pcontext, prcCurrent->right, pcontext->CaptionHeight);
560  ThemeDrawCaption(pcontext, prcCurrent);
561  if (bDoDoubleBuffering)
562  ThemeEndBufferedPaint(pcontext, 0, 0, prcCurrent->right, pcontext->CaptionHeight);
563  ThemeDrawBorders(pcontext, prcCurrent);
564  }
565  else
566  {
567  DrawClassicFrame(pcontext, prcCurrent);
568  }
569 
570  if(pcontext->wi.dwStyle & WS_MINIMIZE)
571  return;
572 
573  if(HAS_MENU(pcontext->hWnd, pcontext->wi.dwStyle))
574  ThemeDrawMenuBar(pcontext, prcCurrent);
575 
576  if (pcontext->wi.dwExStyle & WS_EX_CLIENTEDGE)
577  DrawEdge(pcontext->hDC, prcCurrent, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
578 
579  if((pcontext->wi.dwStyle & WS_HSCROLL) && IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL))
580  ThemeDrawScrollBar(pcontext, SB_HORZ , NULL);
581 
582  if((pcontext->wi.dwStyle & WS_VSCROLL) && IsScrollBarVisible(pcontext->hWnd, OBJID_VSCROLL))
583  ThemeDrawScrollBar(pcontext, SB_VERT, NULL);
584 
585  if((pcontext->wi.dwStyle & (WS_HSCROLL|WS_VSCROLL)) == (WS_HSCROLL|WS_VSCROLL) &&
586  IsScrollBarVisible(pcontext->hWnd, OBJID_HSCROLL) &&
588  {
589  ThemeDrawScrollBarsGrip(pcontext, prcCurrent);
590  }
591 }
592 
593 /*
594  * Message handlers
595  */
596 
597 static LRESULT
599 {
601  RECT rcCurrent;
602 
604 
605  rcCurrent = context.wi.rcWindow;
606  OffsetRect( &rcCurrent, -context.wi.rcWindow.left, -context.wi.rcWindow.top);
607 
608  ThemePaintWindow(&context, &rcCurrent, TRUE);
610 
611  return 0;
612 }
613 
614 static LRESULT
616 {
618  TRACKMOUSEEVENT tme;
619  DWORD style;
620  PWND_DATA pwndData;
621 
622  /* First of all check if we have something to do here */
625  return 0;
626 
627  /* Get theme data for this window */
628  pwndData = ThemeGetWndData(hWnd);
629  if (pwndData == NULL)
630  return 0;
631 
632  /* Begin tracking in the non client area if we are not tracking yet */
633  tme.cbSize = sizeof(TRACKMOUSEEVENT);
634  tme.dwFlags = TME_QUERY;
635  tme.hwndTrack = hWnd;
636  TrackMouseEvent(&tme);
637  if (tme.dwFlags != (TME_LEAVE | TME_NONCLIENT))
638  {
639  tme.hwndTrack = hWnd;
641  TrackMouseEvent(&tme);
642  }
643 
645  if (context.wi.dwStyle & WS_SYSMENU)
646  {
647  if (HT_ISBUTTON(ht) || HT_ISBUTTON(pwndData->lastHitTest))
649  }
650 
651  if (context.wi.dwStyle & WS_HSCROLL)
652  {
653  if (ht == HTHSCROLL || pwndData->lastHitTest == HTHSCROLL)
655  }
656 
657  if (context.wi.dwStyle & WS_VSCROLL)
658  {
659  if (ht == HTVSCROLL || pwndData->lastHitTest == HTVSCROLL)
661  }
663 
664  pwndData->lastHitTest = ht;
665 
666  return 0;
667 }
668 
669 static LRESULT
671 {
673  DWORD style;
674  PWND_DATA pwndData;
675 
676  /* First of all check if we have something to do here */
679  return 0;
680 
681  /* Get theme data for this window */
682  pwndData = ThemeGetWndData(hWnd);
683  if (pwndData == NULL)
684  return 0;
685 
687  if (context.wi.dwStyle & WS_SYSMENU && HT_ISBUTTON(pwndData->lastHitTest))
689 
690  if (context.wi.dwStyle & WS_HSCROLL && pwndData->lastHitTest == HTHSCROLL)
692 
693  if (context.wi.dwStyle & WS_VSCROLL && pwndData->lastHitTest == HTVSCROLL)
695 
697 
698  pwndData->lastHitTest = HTNOWHERE;
699 
700  return 0;
701 }
702 
703 static VOID
705 {
706  MSG Msg;
707  BOOL Pressed = TRUE;
708  WPARAM SCMsg, ht;
709  ULONG Style;
711  PWND_DATA pwndData;
712 
714  if (!((Style & WS_CAPTION) && (Style & WS_SYSMENU)))
715  return ;
716 
717  switch (wParam)
718  {
719  case HTCLOSE:
720  SCMsg = SC_CLOSE;
721  break;
722  case HTMINBUTTON:
723  if (!(Style & WS_MINIMIZEBOX))
724  return;
725  SCMsg = ((Style & WS_MINIMIZE) ? SC_RESTORE : SC_MINIMIZE);
726  break;
727  case HTMAXBUTTON:
728  if (!(Style & WS_MAXIMIZEBOX))
729  return;
730  SCMsg = ((Style & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE);
731  break;
732  default :
733  return;
734  }
735 
736  /* Get theme data for this window */
737  pwndData = ThemeGetWndData(hWnd);
738  if (pwndData == NULL)
739  return;
740 
743  pwndData->lastHitTest = wParam;
744 
745  SetCapture(hWnd);
746 
747  ht = wParam;
748 
749  for (;;)
750  {
751  if (GetMessageW(&Msg, 0, WM_MOUSEFIRST, WM_MOUSELAST) <= 0)
752  break;
753 
754  if (Msg.message == WM_LBUTTONUP)
755  break;
756 
757  if (Msg.message != WM_MOUSEMOVE)
758  continue;
759 
760  ht = SendMessage(hWnd, WM_NCHITTEST, 0, MAKELPARAM(Msg.pt.x, Msg.pt.y));
761  Pressed = (ht == wParam);
762 
763  /* Only draw the buttons if the hit test changed */
764  if (ht != pwndData->lastHitTest &&
765  (HT_ISBUTTON(ht) || HT_ISBUTTON(pwndData->lastHitTest)))
766  {
767  ThemeDrawCaptionButtons(&context, 0, Pressed ? wParam: 0);
768  pwndData->lastHitTest = ht;
769  }
770  }
771 
774 
775  ReleaseCapture();
776 
777  if (Pressed)
778  SendMessageW(hWnd, WM_SYSCOMMAND, SCMsg, 0);
779 }
780 
781 
782 static LRESULT
784 {
785  RECT WindowRect;
786  POINT ClientPoint;
787  WINDOWINFO wi;
788 
789  wi.cbSize = sizeof(wi);
790  GetWindowInfo(hWnd, &wi);
791 
792  if (!PtInRect(&wi.rcWindow, Point))
793  {
794  return HTNOWHERE;
795  }
796  WindowRect = wi.rcWindow;
797 
798  if (UserHasWindowEdge(wi.dwStyle, wi.dwExStyle))
799  {
800  LONG XSize, YSize;
801 
802  InflateRect(&WindowRect, -(int)wi.cxWindowBorders, -(int)wi.cyWindowBorders);
805  if (!PtInRect(&WindowRect, Point))
806  {
807  BOOL ThickFrame;
808 
809  ThickFrame = (wi.dwStyle & WS_THICKFRAME);
810  if (Point.y < WindowRect.top)
811  {
812  if(wi.dwStyle & WS_MINIMIZE)
813  return HTCAPTION;
814  if(!ThickFrame)
815  return HTBORDER;
816  if (Point.x < (WindowRect.left + XSize))
817  return HTTOPLEFT;
818  if (Point.x >= (WindowRect.right - XSize))
819  return HTTOPRIGHT;
820  return HTTOP;
821  }
822  if (Point.y >= WindowRect.bottom)
823  {
824  if(wi.dwStyle & WS_MINIMIZE)
825  return HTCAPTION;
826  if(!ThickFrame)
827  return HTBORDER;
828  if (Point.x < (WindowRect.left + XSize))
829  return HTBOTTOMLEFT;
830  if (Point.x >= (WindowRect.right - XSize))
831  return HTBOTTOMRIGHT;
832  return HTBOTTOM;
833  }
834  if (Point.x < WindowRect.left)
835  {
836  if(wi.dwStyle & WS_MINIMIZE)
837  return HTCAPTION;
838  if(!ThickFrame)
839  return HTBORDER;
840  if (Point.y < (WindowRect.top + YSize))
841  return HTTOPLEFT;
842  if (Point.y >= (WindowRect.bottom - YSize))
843  return HTBOTTOMLEFT;
844  return HTLEFT;
845  }
846  if (Point.x >= WindowRect.right)
847  {
848  if(wi.dwStyle & WS_MINIMIZE)
849  return HTCAPTION;
850  if(!ThickFrame)
851  return HTBORDER;
852  if (Point.y < (WindowRect.top + YSize))
853  return HTTOPRIGHT;
854  if (Point.y >= (WindowRect.bottom - YSize))
855  return HTBOTTOMRIGHT;
856  return HTRIGHT;
857  }
858  }
859  }
860  else
861  {
862  if (wi.dwExStyle & WS_EX_STATICEDGE)
865  if (!PtInRect(&WindowRect, Point))
866  return HTBORDER;
867  }
868 
869  if ((wi.dwStyle & WS_CAPTION) == WS_CAPTION)
870  {
871  if (wi.dwExStyle & WS_EX_TOOLWINDOW)
872  WindowRect.top += GetSystemMetrics(SM_CYSMCAPTION);
873  else
874  WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
875 
876  if (!PtInRect(&WindowRect, Point))
877  {
878  if (wi.dwStyle & WS_SYSMENU)
879  {
880  PWND_DATA pwndData = ThemeGetWndData(hWnd);
881 
882  if (!(wi.dwExStyle & WS_EX_TOOLWINDOW))
883  {
884  // if(!(wi.dwExStyle & WS_EX_DLGMODALFRAME))
885  // FIXME: The real test should check whether there is
886  // an icon for the system window, and if so, do the
887  // rect.left increase.
888  // See win32ss/user/user32/windows/nonclient.c!DefWndNCHitTest
889  // and win32ss/user/ntuser/nonclient.c!GetNCHitEx which does
890  // the test better.
891  WindowRect.left += GetSystemMetrics(SM_CXSMICON);
892  }
893 
894  if (pwndData)
895  {
896  POINT pt = {Point.x - wi.rcWindow.left, Point.y - wi.rcWindow.top};
897  if (PtInRect(&pwndData->rcCaptionButtons[CLOSEBUTTON], pt))
898  return HTCLOSE;
899  if (PtInRect(&pwndData->rcCaptionButtons[MAXBUTTON], pt))
900  return HTMAXBUTTON;
901  if (PtInRect(&pwndData->rcCaptionButtons[MINBUTTON], pt))
902  return HTMINBUTTON;
903  }
904  }
905  if (Point.x < WindowRect.left)
906  return HTSYSMENU;
907  return HTCAPTION;
908  }
909  }
910 
911  if(!(wi.dwStyle & WS_MINIMIZE))
912  {
913  HMENU menu;
914 
915  ClientPoint = Point;
916  ScreenToClient(hWnd, &ClientPoint);
918 
919  if (PtInRect(&wi.rcClient, ClientPoint))
920  {
921  return HTCLIENT;
922  }
923 
924  if ((menu = GetMenu(hWnd)) && !(wi.dwStyle & WS_CHILD))
925  {
926  if (Point.x > 0 && Point.x < WindowRect.right && ClientPoint.y < 0)
927  return HTMENU;
928  }
929 
930  if (wi.dwExStyle & WS_EX_CLIENTEDGE)
931  {
932  InflateRect(&WindowRect, -2 * GetSystemMetrics(SM_CXBORDER),
934  }
935 
936  if ((wi.dwStyle & WS_VSCROLL) && (wi.dwStyle & WS_HSCROLL) &&
937  (WindowRect.bottom - WindowRect.top) > GetSystemMetrics(SM_CYHSCROLL))
938  {
939  RECT ParentRect, TempRect = WindowRect, TempRect2 = WindowRect;
941 
942  TempRect.bottom -= GetSystemMetrics(SM_CYHSCROLL);
943  if ((wi.dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
944  TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
945  else
946  TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
947  if (PtInRect(&TempRect, Point))
948  return HTVSCROLL;
949 
950  TempRect2.top = TempRect2.bottom - GetSystemMetrics(SM_CYHSCROLL);
951  if ((wi.dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
952  TempRect2.left += GetSystemMetrics(SM_CXVSCROLL);
953  else
954  TempRect2.right -= GetSystemMetrics(SM_CXVSCROLL);
955  if (PtInRect(&TempRect2, Point))
956  return HTHSCROLL;
957 
958  TempRect.top = TempRect2.top;
959  TempRect.bottom = TempRect2.bottom;
960  if(Parent)
961  GetClientRect(Parent, &ParentRect);
962  if (PtInRect(&TempRect, Point) && HASSIZEGRIP(wi.dwStyle, wi.dwExStyle,
963  GetWindowLongW(Parent, GWL_STYLE), wi.rcWindow, ParentRect))
964  {
965  if ((wi.dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
966  return HTBOTTOMLEFT;
967  else
968  return HTBOTTOMRIGHT;
969  }
970  }
971  else
972  {
973  if (wi.dwStyle & WS_VSCROLL)
974  {
975  RECT TempRect = WindowRect;
976 
977  if ((wi.dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
978  TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
979  else
980  TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
981  if (PtInRect(&TempRect, Point))
982  return HTVSCROLL;
983  }
984  else if (wi.dwStyle & WS_HSCROLL)
985  {
986  RECT TempRect = WindowRect;
987  TempRect.top = TempRect.bottom - GetSystemMetrics(SM_CYHSCROLL);
988  if (PtInRect(&TempRect, Point))
989  return HTHSCROLL;
990  }
991  }
992  }
993 
994  return HTNOWHERE;
995 }
996 
999 {
1000  switch(Msg)
1001  {
1002  case WM_NCPAINT:
1003  return ThemeHandleNCPaint(hWnd, (HRGN)wParam);
1004  //
1005  // WM_NCUAHDRAWCAPTION : wParam are DC_* flags.
1006  //
1007  case WM_NCUAHDRAWCAPTION:
1008  //
1009  // WM_NCUAHDRAWFRAME : wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1010  //
1011  case WM_NCUAHDRAWFRAME:
1012  case WM_NCACTIVATE:
1013 
1015  return TRUE;
1016 
1017  ThemeHandleNCPaint(hWnd, (HRGN)1);
1018  return TRUE;
1019  case WM_NCMOUSEMOVE:
1020  {
1021  POINT Point;
1025  }
1026  case WM_NCMOUSELEAVE:
1027  return ThemeHandleNcMouseLeave(hWnd);
1028  case WM_NCLBUTTONDOWN:
1029  switch (wParam)
1030  {
1031  case HTMINBUTTON:
1032  case HTMAXBUTTON:
1033  case HTCLOSE:
1034  {
1036  return 0;
1037  }
1038  default:
1039  return DefWndProc(hWnd, Msg, wParam, lParam);
1040  }
1041  case WM_NCHITTEST:
1042  {
1043  POINT Point;
1046  return DefWndNCHitTest(hWnd, Point);
1047  }
1048  case WM_SYSCOMMAND:
1049  {
1050  if((wParam & 0xfff0) == SC_VSCROLL ||
1051  (wParam & 0xfff0) == SC_HSCROLL)
1052  {
1053  POINT Pt;
1054  Pt.x = (short)LOWORD(lParam);
1055  Pt.y = (short)HIWORD(lParam);
1057  return 0;
1058  }
1059  else
1060  {
1061  return DefWndProc(hWnd, Msg, wParam, lParam);
1062  }
1063  }
1064  default:
1065  return DefWndProc(hWnd, Msg, wParam, lParam);
1066  }
1067 }
1068 
1070  DWORD DNCP_Flag,
1071  LPRECT prcPreview,
1072  LPCWSTR pszThemeFileName,
1073  LPCWSTR pszColorName,
1074  LPCWSTR pszSizeName,
1075  PNONCLIENTMETRICSW pncMetrics,
1076  COLORREF* lpaRgbValues)
1077 {
1078  WNDCLASSEXW DummyPreviewWindowClass;
1079  HWND hwndDummy;
1080  HRESULT hres;
1081  HTHEMEFILE hThemeFile;
1083  RECT rcCurrent;
1084 
1085  /* FIXME: We also need to implement drawing the rest of the preview windows
1086  * and make use of the ncmetrics and colors passed as parameters */
1087 
1088  /* Create a dummy window that will be used to trick the paint funtions */
1089  memset(&DummyPreviewWindowClass, 0, sizeof(DummyPreviewWindowClass));
1090  DummyPreviewWindowClass.cbSize = sizeof(DummyPreviewWindowClass);
1091  DummyPreviewWindowClass.lpszClassName = L"DummyPreviewWindowClass";
1092  DummyPreviewWindowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
1093  DummyPreviewWindowClass.hInstance = hDllInst;
1094  DummyPreviewWindowClass.lpfnWndProc = DefWindowProcW;
1095  if (!RegisterClassExW(&DummyPreviewWindowClass))
1096  return E_FAIL;
1097 
1098  hwndDummy = CreateWindowExW(0, L"DummyPreviewWindowClass", L"Active window", WS_OVERLAPPEDWINDOW,30,30,300,150,0,0,hDllInst,NULL);
1099  if (!hwndDummy)
1100  return E_FAIL;
1101 
1102  hres = OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, &hThemeFile,0);
1103  if (FAILED(hres))
1104  return hres;
1105 
1106  /* Initialize the special draw context for the preview */
1107  context.hDC = hDC;
1108  context.hWnd = hwndDummy;
1109  context.theme = OpenThemeDataFromFile(hThemeFile, hwndDummy, L"WINDOW", 0);
1110  if (!context.theme)
1111  return E_FAIL;
1112  context.scrolltheme = OpenThemeDataFromFile(hThemeFile, hwndDummy, L"SCROLLBAR", 0);
1113  if (!context.scrolltheme)
1114  return E_FAIL;
1115  context.Active = TRUE;
1116  context.wi.cbSize = sizeof(context.wi);
1117  if (!GetWindowInfo(hwndDummy, &context.wi))
1118  return E_FAIL;
1119  context.wi.dwStyle |= WS_VISIBLE;
1120  context.CaptionHeight = context.wi.cyWindowBorders;
1121  context.CaptionHeight += GetSystemMetrics(context.wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMCAPTION : SM_CYCAPTION );
1122  context.hRgn = CreateRectRgnIndirect(&context.wi.rcWindow);
1123 
1124  /* Paint the window on the preview hDC */
1125  rcCurrent = context.wi.rcWindow;
1126  OffsetRect( &rcCurrent, -context.wi.rcWindow.left, -context.wi.rcWindow.top);
1127  SetViewportOrgEx(hDC, context.wi.rcWindow.left, context.wi.rcWindow.top, NULL);
1128  ThemeCalculateCaptionButtonsPos(hwndDummy, context.theme);
1129  ThemePaintWindow(&context, &rcCurrent, FALSE);
1130  SetViewportOrgEx(hDC, 0, 0, NULL);
1131 
1132  context.hDC = NULL;
1133  CloseThemeData (context.theme);
1134  CloseThemeData (context.scrolltheme);
1136 
1137  /* Cleanup */
1138  DestroyWindow(hwndDummy);
1139  UnregisterClassW(L"DummyPreviewWindowClass", hDllInst);
1140 
1141  return S_OK;
1142 }
#define BF_FLAT
Definition: winuser.h:471
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
HRESULT WINAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *psz)
Definition: draw.c:1777
#define HTMAXBUTTON
Definition: winuser.h:2438
HTHEME GetNCCaptionTheme(HWND hWnd, DWORD style)
Definition: themehooks.c:88
#define HTTOP
Definition: winuser.h:2444
#define WS_THICKFRAME
Definition: pedump.c:630
#define HTLEFT
Definition: winuser.h:2441
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
return
Definition: dirsup.c:529
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
static HICON
Definition: imagelist.c:84
#define HTHSCROLL
Definition: winuser.h:2435
#define SM_CYHSCROLL
Definition: winuser.h:952
#define TRUE
Definition: types.h:120
DWORD cbSize
Definition: winuser.h:3708
#define TME_NONCLIENT
Definition: commctrl.h:4953
#define COLOR_WINDOWFRAME
Definition: winuser.h:909
#define STATE_SYSTEM_OFFSCREEN
Definition: winuser.h:2831
#define WM_MOUSEFIRST
Definition: winuser.h:1750
#define SM_CYSIZE
Definition: winuser.h:982
#define SC_RESTORE
Definition: winuser.h:2552
long y
Definition: polytest.cpp:48
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static void DrawClassicFrame(PDRAW_CONTEXT context, RECT *prcCurrent)
Definition: nonclient.c:442
HINSTANCE hDllInst
Definition: system.c:45
long x
Definition: polytest.cpp:48
Definition: http.c:6587
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define SB_VERT
Definition: winuser.h:553
static void ThemeEndBufferedPaint(PDRAW_CONTEXT pcontext, int x, int y, int cx, int cy)
Definition: nonclient.c:202
static void ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext, RECT *prcCurrent, CAPTIONBUTTON buttonId, INT iStateId)
Definition: nonclient.c:274
#define pt(x, y)
Definition: drawing.c:79
DWORD dwStyle
Definition: winuser.h:3711
HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int *piVal)
Definition: property.c:63
UINT cxWindowBorders
Definition: winuser.h:3714
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SB_HORZ
Definition: winuser.h:552
void ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext)
Definition: nonclient.c:180
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:292
HANDLE HWND
Definition: compat.h:13
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
void ThemeInitDrawContext(PDRAW_CONTEXT pcontext, HWND hWnd, HRGN hRgn)
Definition: nonclient.c:156
#define COLOR_INACTIVEBORDER
Definition: winuser.h:914
static HRGN hRgn
Definition: mapping.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define WS_DLGFRAME
Definition: pedump.c:626
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
UINT cyWindowBorders
Definition: winuser.h:3715
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define COLOR_CAPTIONTEXT
Definition: winuser.h:912
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint buffer
Definition: glext.h:5915
#define SM_CYSMICON
Definition: winuser.h:1003
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define HT_ISBUTTON(ht)
Definition: uxthemep.h:214
#define HTBOTTOMLEFT
Definition: winuser.h:2448
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static LRESULT ThemeHandleNcMouseMove(HWND hWnd, DWORD ht, POINT *pt)
Definition: nonclient.c:615
#define WM_NCHITTEST
Definition: winuser.h:1668
UINT_PTR WPARAM
Definition: windef.h:207
#define HTRIGHT
Definition: winuser.h:2443
#define WS_CHILD
Definition: pedump.c:617
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:716
#define DT_RIGHT
Definition: winuser.h:538
int align(int length, int align)
Definition: dsound8.c:36
LONG left
Definition: windef.h:291
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
HBITMAP hbmpOld
Definition: uxthemep.h:187
static void ThemeDrawBorders(PDRAW_CONTEXT pcontext, RECT *prcCurrent)
Definition: nonclient.c:417
LONG right
Definition: windef.h:293
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DestroyWindow(_In_ HWND)
#define HTNOWHERE
Definition: winuser.h:2428
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:416
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:56
#define HTMINBUTTON
Definition: winuser.h:2437
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
#define DCX_INTERSECTRGN
Definition: winuser.h:2083
HFONT hFont
Definition: main.c:53
#define SMTO_ABORTIFHUNG
Definition: winuser.h:1209
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HTTOPLEFT
Definition: winuser.h:2445
#define DCX_WINDOW
Definition: winuser.h:2074
#define BF_ADJUST
Definition: winuser.h:470
BOOL WINAPI TrackMouseEvent(_Inout_ LPTRACKMOUSEEVENT)
static void ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT *prcCurrent, BOOL bDoDoubleBuffering)
Definition: nonclient.c:551
struct @1571 Msg[]
#define ICON_SMALL
Definition: tnclass.cpp:48
#define WM_NCPAINT
Definition: winuser.h:1669
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
static HICON UserGetWindowIcon(PDRAW_CONTEXT pcontext)
Definition: nonclient.c:58
#define BF_RECT
Definition: winuser.h:462
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
static void ThemeDrawScrollBarsGrip(PDRAW_CONTEXT pcontext, RECT *prcCurrent)
Definition: nonclient.c:517
#define TMT_CAPTIONFONT
Definition: vssym32.h:164
static BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:41
static LRESULT DefWndNCHitTest(HWND hWnd, POINT Point)
Definition: nonclient.c:783
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define COLOR_3DFACE
Definition: winuser.h:919
#define HTSYSMENU
Definition: winuser.h:2431
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define BDR_SUNKENINNER
Definition: winuser.h:445
#define WM_NCACTIVATE
Definition: winuser.h:1670
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
Definition: metric.c:91
long LONG
Definition: pedump.c:60
HTHEME scrolltheme
Definition: uxthemep.h:178
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define SM_CYDLGFRAME
Definition: winuser.h:958
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SC_MAXIMIZE
Definition: winuser.h:2542
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define DT_END_ELLIPSIS
Definition: winuser.h:529
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:66
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
static HWND hwndParent
Definition: cryptui.c:300
LONG cx
Definition: windef.h:319
LONG_PTR LPARAM
Definition: windef.h:208
void ThemeDrawScrollBar(PDRAW_CONTEXT pcontext, INT nBar, POINT *pt)
Definition: ncscrollbar.c:276
Definition: sacdrv.h:287
RECT rcWindow
Definition: winuser.h:3709
#define DT_VCENTER
Definition: winuser.h:543
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
BOOL WINAPI GetScrollBarInfo(_In_ HWND, _In_ LONG, _Inout_ PSCROLLBARINFO)
LPCWSTR lpszClassName
Definition: winuser.h:3179
WINDOWINFO wi
Definition: uxthemep.h:180
HBITMAP hbmp
static LRESULT ThemeHandleNCPaint(HWND hWnd, HRGN hRgn)
Definition: nonclient.c:598
DWORD rgstate[CCHILDREN_SCROLLBAR+1]
Definition: winuser.h:3696
#define WS_CAPTION
Definition: pedump.c:624
#define SM_CYSMSIZE
Definition: winuser.h:1006
#define GCLP_HICONSM
Definition: winuser.h:670
DWORD dwExStyle
Definition: winuser.h:3712
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:395
#define HTTOPRIGHT
Definition: winuser.h:2446
#define SM_CYCAPTION
Definition: winuser.h:953
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const DWORD Style
Definition: appswitch.c:71
#define OBJID_HSCROLL
Definition: winable.h:21
BOOL WINAPI PaintMenuBar(HWND hWnd, HDC hDC, ULONG left, ULONG right, ULONG top, BOOL bActive)
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997
HBRUSH hbrBackground
Definition: winuser.h:3177
LONG HRESULT
Definition: typedefs.h:77
#define SendMessageTimeout
Definition: winuser.h:5711
UINT cbSize
Definition: winuser.h:3169
#define SM_CXDLGFRAME
Definition: winuser.h:956
DWORD COLORREF
Definition: windef.h:285
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:45
#define WM_MOUSELAST
Definition: winuser.h:1777
void NC_TrackScrollBar(HWND hwnd, WPARAM wParam, POINT pt)
Definition: ncscrollbar.c:665
#define WINAPI
Definition: msvc.h:8
#define IDI_WINLOGO
Definition: winuser.h:704
#define COLOR_ACTIVEBORDER
Definition: winuser.h:913
#define TME_QUERY
Definition: commctrl.h:4954
int WINAPI GetSystemMetrics(_In_ int)
#define HTBOTTOM
Definition: winuser.h:2447
unsigned long DWORD
Definition: ntddk_ex.h:95
HTHEME GetNCScrollbarTheme(HWND hWnd, DWORD style)
Definition: themehooks.c:118
ULONG_PTR * PDWORD_PTR
Definition: basetsd.h:184
static void ThemeStartBufferedPaint(PDRAW_CONTEXT pcontext, int cx, int cy)
Definition: nonclient.c:191
#define OBJID_VSCROLL
Definition: winable.h:20
UINT lastHitTest
Definition: uxthemep.h:155
#define WS_HSCROLL
Definition: pedump.c:628
void ThemeCalculateCaptionButtonsPos(HWND hWnd, HTHEME htheme)
Definition: nonclient.c:213
HINSTANCE hInstance
Definition: winuser.h:3174
#define SM_CXSMICON
Definition: winuser.h:1002
#define WM_MDIGETACTIVE
Definition: winuser.h:1797
#define HTCLOSE
Definition: winuser.h:2453
#define SM_CYBORDER
Definition: winuser.h:955
int ret
struct Point Point
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
#define GCLP_HICON
Definition: winuser.h:669
#define COLOR_BTNFACE
Definition: winuser.h:918
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:924
#define SM_CXBORDER
Definition: winuser.h:954
#define DI_NORMAL
Definition: wingdi.h:72
GLenum GLsizei len
Definition: glext.h:6722
int CaptionHeight
Definition: uxthemep.h:183
BOOL IsScrollBarVisible(HWND hWnd, INT hBar)
Definition: nonclient.c:31
#define HTBOTTOMRIGHT
Definition: winuser.h:2449
LRESULT CALLBACK ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
Definition: nonclient.c:998
#define GetClassLongPtr
Definition: winuser.h:5648
static void ThemeDrawCaptionButtons(PDRAW_CONTEXT pcontext, DWORD htHot, DWORD htDown)
Definition: nonclient.c:338
#define BUTTON_GAP_SIZE
Definition: uxthemep.h:224
WNDPROC lpfnWndProc
Definition: winuser.h:3171
#define PATCOPY
Definition: wingdi.h:334
#define EDGE_RAISED
Definition: winuser.h:450
#define SC_MINIMIZE
Definition: winuser.h:2540
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define HTCAPTION
Definition: winuser.h:2430
#define GWL_STYLE
Definition: winuser.h:846
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:886
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DT_SINGLELINE
Definition: winuser.h:540
HWND WINAPI GetParent(_In_ HWND)
RECT rcCaptionButtons[4]
Definition: uxthemep.h:154
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define S_OK
Definition: intsafe.h:59
#define WS_BORDER
Definition: pedump.c:625
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:222
BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO)
static DWORD ThemeGetButtonState(DWORD htCurrect, DWORD htHot, DWORD htDown, BOOL Active)
Definition: nonclient.c:326
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_MINIMIZEBOX
Definition: pedump.c:631
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)
HICON hIcon
Definition: msconfig.c:44
#define HTMENU
Definition: winuser.h:2434
HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName, LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile, DWORD unknown)
Definition: system.c:1101
#define TME_LEAVE
Definition: commctrl.h:4952
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1753
static BOOL IsWindowActive(HWND hWnd, DWORD ExStyle)
Definition: nonclient.c:12
#define HTBORDER
Definition: winuser.h:2451
struct tagSCROLLBARINFO SCROLLBARINFO
static const struct newhuff ht[]
Definition: huffman.h:296
static LRESULT ThemeHandleNcMouseLeave(HWND hWnd)
Definition: nonclient.c:670
HTHEME theme
Definition: uxthemep.h:177
unsigned int UINT
Definition: ndis.h:50
#define WM_MOUSEMOVE
Definition: winuser.h:1751
#define WS_VSCROLL
Definition: pedump.c:627
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define HTHELP
Definition: winuser.h:2454
#define SM_CXVSCROLL
Definition: winuser.h:951
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
static void ThemeDrawMenuBar(PDRAW_CONTEXT pcontext, RECT *prcCurrent)
Definition: nonclient.c:506
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define HTVSCROLL
Definition: winuser.h:2436
static void ThemeDrawCaption(PDRAW_CONTEXT pcontext, RECT *prcCurrent)
Definition: nonclient.c:353
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
_Out_opt_ int * cx
Definition: commctrl.h:570
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define SC_CLOSE
Definition: winuser.h:2546
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:46
#define SendMessage
Definition: winuser.h:5709
HRESULT WINAPI DrawNCPreview(HDC hDC, DWORD DNCP_Flag, LPRECT prcPreview, LPCWSTR pszThemeFileName, LPCWSTR pszColorName, LPCWSTR pszSizeName, PNONCLIENTMETRICSW pncMetrics, COLORREF *lpaRgbValues)
Definition: nonclient.c:1069
#define SM_CXSIZE
Definition: winuser.h:981
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: nonclient.c:34
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
LONG bottom
Definition: windef.h:294
#define WM_NCMOUSELEAVE
Definition: winuser.h:1818
#define DT_CENTER
Definition: winuser.h:527
#define EDGE_SUNKEN
Definition: winuser.h:451
PWND_DATA ThemeGetWndData(HWND hWnd)
Definition: themehooks.c:17
static HBITMAP
Definition: button.c:44
RECT rcClient
Definition: winuser.h:3710
#define HTCLIENT
Definition: winuser.h:2429
static VOID ThemeHandleButton(HWND hWnd, WPARAM wParam)
Definition: nonclient.c:704
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LONG_PTR LRESULT
Definition: windef.h:209
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WS_SYSMENU
Definition: pedump.c:629
#define memset(x, y, z)
Definition: compat.h:39
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WM_SYSCOMMAND
Definition: winuser.h:1717
#define SM_CYSMCAPTION
Definition: winuser.h:1004
#define SC_VSCROLL
Definition: winuser.h:2547
LONG cy
Definition: windef.h:320
#define WS_EX_STATICEDGE
Definition: winuser.h:403
LPARAM lParam
Definition: combotst.c:139
HTHEME WINAPI OpenThemeDataFromFile(HTHEMEFILE hThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:827
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
#define SRCCOPY
Definition: wingdi.h:332
#define WM_NCMOUSEMOVE
Definition: winuser.h:1673
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
#define TMT_CONTENTALIGNMENT
Definition: vssym32.h:358
CAPTIONBUTTON
Definition: uxthemep.h:190
HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect)
Definition: draw.c:1377
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define ICON_BIG
Definition: tnclass.cpp:51
const DWORD ExStyle
Definition: appswitch.c:72
HRESULT WINAPI ThemeDrawCaptionText(PDRAW_CONTEXT pcontext, RECT *pRect, int iPartId, int iStateId)
Definition: nonclient.c:83
#define WS_MAXIMIZE
Definition: pedump.c:623
#define SC_HSCROLL
Definition: winuser.h:2548