ReactOS  0.4.13-dev-482-ge57f103
window.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2003, 2004, 2005 Martin Fuchs
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 
20  //
21  // Explorer clone
22  //
23  // window.cpp
24  //
25  // Martin Fuchs, 23.07.2003
26  //
27 
28 
29 #include <precomp.h>
30 
32 {
33  memset(this, 0, sizeof(WNDCLASSEX));
34 
35  cbSize = sizeof(WNDCLASSEX);
36  style = style_;
39  this->hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
41  lpfnWndProc = wndproc;
42 
43  _atomClass = 0;
44 }
45 
46 
48  : WindowClass(classname, style, wndproc)
49 {
50  hIcon = ResIcon(nid);
52 }
53 
54 
56 
58 const void* Window::s_new_info = NULL;
59 
60 HHOOK Window::s_hcbtHook = 0;
61 
62 
64 {
65  static StaticWindowData s_initialized_data;
66 
67  return s_initialized_data;
68 }
69 
70 
72  : WindowHandle(hwnd)
73 {
74  Lock lock(GetStaticWindowData()._map_crit_sect); // protect access to s_wnd_map
75 
76  s_wnd_map[_hwnd] = this;
77 }
78 
80 {
81  Lock lock(GetStaticWindowData()._map_crit_sect); // protect access to s_wnd_map
82 
83  s_wnd_map.erase(_hwnd);
84 }
85 
86 
87 HWND Window::Create(CREATORFUNC creator, DWORD dwExStyle,
88  LPCTSTR lpClassName, LPCTSTR lpWindowName,
89  DWORD dwStyle, int x, int y, int w, int h,
90  HWND hwndParent, HMENU hMenu/*, LPVOID lpParam*/)
91 {
92  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
93 
94  s_window_creator = creator;
95  s_new_info = NULL;
96 
97  return CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
98  x, y, w, h,
99  hwndParent, hMenu, g_Globals._hInstance, 0/*lpParam*/);
100 }
101 
102 HWND Window::Create(CREATORFUNC_INFO creator, const void* info, DWORD dwExStyle,
103  LPCTSTR lpClassName, LPCTSTR lpWindowName,
104  DWORD dwStyle, int x, int y, int w, int h,
105  HWND hwndParent, HMENU hMenu/*, LPVOID lpParam*/)
106 {
107  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
108 
109  s_window_creator = (CREATORFUNC) creator;
110  s_new_info = info;
111 
112  return CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
113  x, y, w, h,
114  hwndParent, hMenu, g_Globals._hInstance, 0/*lpParam*/);
115 }
116 
117 
118 Window* Window::create_mdi_child(const ChildWndInfo& info, const MDICREATESTRUCT& mcs, CREATORFUNC_INFO creator)
119 {
120  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
121 
122  s_window_creator = (CREATORFUNC) creator;
123  s_new_info = &info;
124 
126 
127  HWND hwnd = (HWND) SendMessage(info._hmdiclient, WM_MDICREATE, 0, (LPARAM)&mcs);
128 
129  // end hook in case it's not already done
130  if (s_hcbtHook)
132 
134  s_new_info = NULL;
135 
136  if (child && (!hwnd || !child->_hwnd))
137  child = NULL;
138 
139  return child;
140 }
141 
143 {
144  if (code == HCBT_CREATEWND) {
145  UnhookWindowsHookEx(s_hcbtHook); // use the hook only for the first created window
146  s_hcbtHook = 0;
147 
148  HWND hwnd = (HWND)wparam;
149 
150  // create Window controller and associate it with the window handle
152 
153  if (!child)
155  }
156 
158 }
159 
160 
161 /*
162 Window* Window::create_property_sheet(PropertySheetDialog* ppsd, CREATORFUNC creator, const void* info)
163 {
164  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
165 
166  s_window_creator = creator;
167  s_new_info = info;
168 
169  s_hcbtHook = SetWindowsHookEx(WH_CBT, PropSheetCBTHookProc, 0, GetCurrentThreadId());
170 
171  HWND hwnd = (HWND) PropertySheet(ppsd);
172 
173  UnhookWindowsHookEx(s_hcbtHook);
174 
175  Window* child = get_window(hwnd);
176  s_new_info = NULL;
177 
178  if (child && (!hwnd || !child->_hwnd))
179  child = NULL;
180 
181  return child;
182 }
183 */
184 
186 {
187  if (code == HCBT_CREATEWND) {
188  HWND hwnd = (HWND)wparam;
189 
190  // create Window controller and associate it with the window handle
192 
193  if (!child)
195  }
196 
198 }
199 
200 
202 
204 {
205  {
206  Lock lock(GetStaticWindowData()._map_crit_sect); // protect access to s_wnd_map
207 
209 
210  if (found!=s_wnd_map.end())
211  return found->second;
212  }
213 
214  return NULL;
215 }
216 
217 
219 
221 {
222  if (s_window_creator) { // protect for recursion and create the window object only for the first window
223  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
224 
225  const void* info = s_new_info;
226  s_new_info = NULL;
227 
228  CREATORFUNC window_creator = s_window_creator;
230 
231  if (info)
232  return CREATORFUNC_INFO(window_creator)(hwnd, info);
233  else
234  return CREATORFUNC(window_creator)(hwnd);
235  }
236 
237  return NULL;
238 }
239 
240 
242 {
243  return 0;
244 }
245 
246 
248 {
249  Window* pThis = get_window(hwnd);
250 
251  if (!pThis)
252  pThis = create_controller(hwnd);
253 
254  if (pThis) {
255  switch(nmsg) {
256  case WM_COMMAND:
257  return pThis->Command(LOWORD(wparam), HIWORD(wparam));
258 
259  case WM_NOTIFY:
260  return pThis->Notify(wparam, (NMHDR*)lparam);
261 
262  case WM_NOTIFYFORMAT:
263  return NFR_CURRENT;
264 
265  case WM_CREATE:
266  return pThis->Init((LPCREATESTRUCT)lparam);
267 
268  case WM_NCDESTROY:
269  delete pThis;
270  return 0;
271 
272  default:
273  return pThis->WndProc(nmsg, wparam, lparam);
274  }
275  }
276  else
277  return DefWindowProc(hwnd, nmsg, wparam, lparam);
278 }
279 
281 {
282  return DefWindowProc(_hwnd, nmsg, wparam, lparam);
283 }
284 
285 int Window::Command(int id, int code)
286 {
287  return 1; // no command handler found
288 }
289 
290 int Window::Notify(int id, NMHDR* pnmh)
291 {
292  return 0;
293 }
294 
296 {
298 }
299 
300 
302  : super(hwnd)
303 {
305 
306  if (!_orgWndProc)
307  delete this;
308 }
309 
311 {
313  assert(pThis);
314 
315  if (pThis) {
316  switch(nmsg) {
317  case WM_COMMAND:
318  if (!pThis->Command(LOWORD(wparam), HIWORD(wparam)))
319  return 0;
320  break;
321 
322  case WM_NOTIFY:
323  return pThis->Notify(wparam, (NMHDR*)lparam);
324 
325  case WM_NOTIFYFORMAT:
326  return NFR_CURRENT;
327 
328  case WM_CREATE:
329  return pThis->Init((LPCREATESTRUCT)lparam);
330 
331  case WM_NCDESTROY:
332  delete pThis;
333  return 0;
334 
335  default:
336  return pThis->WndProc(nmsg, wparam, lparam);
337  }
338  }
339 
340  return CallWindowProc(pThis->_orgWndProc, hwnd, nmsg, wparam, lparam);
341 }
342 
344 {
345  return CallWindowProc(_orgWndProc, _hwnd, nmsg, wparam, lparam);
346 }
347 
349 {
350  return 1; // no command handler found
351 }
352 
353 int SubclassedWindow::Notify(int id, NMHDR* pnmh)
354 {
355  return CallWindowProc(_orgWndProc, _hwnd, WM_NOTIFY, id, (LPARAM)pnmh);
356 }
357 
358 
360  : super(hwnd),
361  _hwndFrame(GetParent(info._hmdiclient))
362 {
363  _focus_pane = 0;
366 }
367 
368 
369 ChildWindow* ChildWindow::create(const ChildWndInfo& info, const RECT& rect, CREATORFUNC_INFO creator,
371 {
373 
374  mcs.szClass = classname;
375  mcs.szTitle = title;
376  mcs.hOwner = g_Globals._hInstance;
377  mcs.x = rect.left,
378  mcs.y = rect.top;
379  mcs.cx = rect.right - rect.left;
380  mcs.cy = rect.bottom - rect.top;
381  mcs.style = style;
382  mcs.lParam = 0;
383 
384  return static_cast<ChildWindow*>(create_mdi_child(info, mcs, creator));
385 }
386 
387 
389 {
390  switch(nmsg) {
391  case WM_PAINT: {
392  RECT rc;
393  PaintCanvas canvas(_hwnd);
394  ClientRect rt(_hwnd);
395  rt.left = _split_pos-SPLIT_WIDTH/2;
396  rt.right = _split_pos+SPLIT_WIDTH/2+1;
397  HBRUSH lastBrush = SelectBrush(canvas, GetStockBrush(COLOR_SPLITBAR));
398  Rectangle(canvas, rt.left, rt.top-1, rt.right, rt.bottom+1);
399  SetRect(&rc, rt.left, rt.top-1, rt.right, rt.bottom+1);
400  DrawEdge(canvas, &rc, EDGE_RAISED, BF_RECT);
401  SelectObject(canvas, lastBrush);
402  break;}
403 
404  case WM_SETCURSOR:
405  if (LOWORD(lparam) == HTCLIENT) {
406  POINT pt;
407  GetCursorPos(&pt);
408  ScreenToClient(_hwnd, &pt);
409 
410  if (pt.x>=_split_pos-SPLIT_WIDTH/2 && pt.x<_split_pos+SPLIT_WIDTH/2+1) {
412  return TRUE;
413  }
414  }
415  goto def;
416 
417  case WM_SIZE:
418  if (wparam != SIZE_MINIMIZED)
420  goto def;
421 
422  case WM_GETMINMAXINFO:
423  DefMDIChildProc(_hwnd, nmsg, wparam, lparam);
424 
425  {LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam;
426 
427  lpmmi->ptMaxTrackSize.x <<= 1; // 2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
428  lpmmi->ptMaxTrackSize.y <<= 1; // 2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN
429  break;}
430 
431  case WM_LBUTTONDOWN: {
432  int x = GET_X_LPARAM(lparam);
433 
434  ClientRect rt(_hwnd);
435 
438  SetCapture(_hwnd);
439  }
440 
441  break;}
442 
443  case WM_LBUTTONUP:
444  if (GetCapture() == _hwnd)
445  ReleaseCapture();
446  break;
447 
448  case WM_KEYDOWN:
449  if (wparam == VK_ESCAPE)
450  if (GetCapture() == _hwnd) {
452  ClientRect rt(_hwnd);
453  resize_children(rt.right, rt.bottom);
454  _last_split = -1;
455  ReleaseCapture();
457  }
458  break;
459 
460  case WM_MOUSEMOVE:
461  if (GetCapture() == _hwnd) {
462  int x = GET_X_LPARAM(lparam);
463 
464  ClientRect rt(_hwnd);
465 
466  if (x>=0 && x<rt.right) {
467  _split_pos = x;
468  resize_children(rt.right, rt.bottom);
469  rt.left = x-SPLIT_WIDTH/2;
470  rt.right = x+SPLIT_WIDTH/2+1;
471  InvalidateRect(_hwnd, &rt, FALSE);
473  UpdateWindow(_hwnd);
475  }
476  }
477  break;
478 
479  case PM_DISPATCH_COMMAND:
480  switch(LOWORD(wparam)) {
481  case ID_GO_BACK:
482  if (!_url_history.empty()) {
483  const String& url = jump_to_int(_url_history.top());
484 
485  if (jump_to_int(url))
486  set_url(url);
487 
488  _url_history.pop();
489  }
490  break;
491 
492  case ID_GO_FORWARD:
493  //@@
494  break;
495 
496  case ID_GO_UP:
498  break;
499 
500  case ID_GO_HOME:
501  //@@
502  break;
503 
504  default:
505  return FALSE;
506  }
507  return TRUE;
508 
509  case WM_MDIACTIVATE:
510  if ((HWND)lparam == _hwnd) {
513  }
514  break;
515 
516  case PM_JUMP_TO_URL:
517  return go_to((LPCTSTR)lparam)? TRUE: FALSE;
518 
519  default: def:
520  return DefMDIChildProc(_hwnd, nmsg, wparam, lparam);
521  }
522 
523  return 0;
524 }
525 
526 
528 {
529  HDWP hdwp = BeginDeferWindowPos(2);
530  RECT rt;
531 
532  rt.left = 0;
533  rt.top = 0;
534  rt.right = cx;
535  rt.bottom = cy;
536 
537  if (_left_hwnd) {
538  cx = _split_pos + SPLIT_WIDTH/2;
539 
541  } else {
542  _split_pos = 0;
543  cx = 0;
544  }
545 
546  if (_right_hwnd)
547  hdwp = DeferWindowPos(hdwp, _right_hwnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
548 
549  EndDeferWindowPos(hdwp);
550 }
551 
552 
554 {
555  const String& url_str = jump_to_int(url);
556 
557  if (!url_str.empty()) {
558  set_url(url_str);
559 
560  _url_history.push(url_str);
561 
562  return true;
563  } else
564  return false;
565 }
566 
568 {
569  if (_url != url) {
570  _url = url;
571 
573  }
574 }
575 
576 
578 
580 {
582 }
583 
585 {
587 }
588 
590 {
591  if ((pmsg->message != WM_KEYDOWN) &&
592  (pmsg->message != WM_SYSKEYDOWN) &&
593  (pmsg->message != WM_SYSCHAR) &&
594  (pmsg->message != WM_CHAR))
595  {
596  return FALSE;
597  }
598 
600  if (SendMessage(*it, PM_TRANSLATE_MSG, 0, (LPARAM)pmsg))
601  return TRUE;
602 
603  return FALSE;
604 }
605 
606 
608 
610 {
612 }
613 
615 {
617 }
618 
620 {
622  if (IsDialogMessage(*it, pmsg))
623  return TRUE;
624 
625  return FALSE;
626 }
627 
628 
630 {
631  MSG msg;
632 
633  while(GetMessage(&msg, 0, 0, 0)) {
634  try {
635  if (pretranslate_msg(&msg))
636  continue;
637 
638  if (dispatch_dialog_msg(&msg))
639  continue;
640 
642 
643  try {
645  } catch(COMException& e) {
646  HandleException(e, 0);
647  }
648  } catch(COMException& e) {
649  HandleException(e, 0);
650  }
651  }
652 
653  return msg.wParam;
654 }
655 
656 
658 {
659  HWND parent = GetParent(_hwnd);
660 
661  if (!parent)
662  return 0;
663 
664  return SendMessage(parent, nmsg, wparam, lparam);
665 }
666 
668 {
669  HWND parent = GetParent(_hwnd);
670 
671  if (!parent)
672  return 0;
673 
674  return PostMessage(parent, nmsg, wparam, lparam);
675 }
676 
677 
679  : super(hwnd)
680 {
682 }
683 
685 {
687 }
688 
689 
691  : super(hwnd)
692 {
694 }
695 
697 {
698  unregister_dialog(_hwnd);
699 }
700 
701 int Dialog::DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent)
702 {
703  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
704 
705  s_window_creator = creator;
706  s_new_info = NULL;
707 
709 
711 }
712 
713 int Dialog::DoModal(UINT nid, CREATORFUNC_INFO creator, const void* info, HWND hwndParent)
714 {
715  Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
716 
717  s_window_creator = (CREATORFUNC) creator;
718  s_new_info = NULL;
719 
721 
723 }
724 
726 {
727  Window* pThis = get_window(hwnd);
728 
729  if (pThis) {
730  switch(nmsg) {
731  case WM_COMMAND:
732  pThis->Command(LOWORD(wparam), HIWORD(wparam));
733  return TRUE; // message has been processed
734 
735  case WM_NOTIFY:
736  pThis->Notify(wparam, (NMHDR*)lparam);
737  return TRUE; // message has been processed
738 
739  case WM_NOTIFYFORMAT:
740  SetWindowLongPtr(hwnd, DWLP_MSGRESULT, NFR_CURRENT); // set return value NFR_CURRENT
741  return TRUE; // message has been processed
742 
743  case WM_NCDESTROY:
744  delete pThis;
745  return TRUE; // message has been processed
746 
747  default:
748  return pThis->WndProc(nmsg, wparam, lparam);
749  }
750  } else if (nmsg == WM_INITDIALOG) {
751  pThis = create_controller(hwnd);
752 
753  if (pThis)
754  return pThis->Init(NULL);
755  }
756 
757  return FALSE; // message has not been processed
758 }
759 
761 {
762  return FALSE; // message has not been processed
763 }
764 
765 int Dialog::Command(int id, int code)
766 {
767  if (code == BN_CLICKED) {
768  EndDialog(_hwnd, id);
769  return 0; // message has been processed
770  }
771 
772  return 1;
773 }
774 
775 
777  : _hwnd(hwnd)
778 {
779  ClientRect clnt(hwnd);
780  _last_size.cx = clnt.right;
781  _last_size.cy = clnt.bottom;
782 
783  WindowRect rect(hwnd);
784  _min_wnd_size.cx = rect.right - rect.left;
785  _min_wnd_size.cy = rect.bottom - rect.top;
786 }
787 
789 {
790  ClientRect clnt_rect(_hwnd);
791  SIZE new_size = {cx, cy};
792 
793  int dx = new_size.cx - _last_size.cx;
794  int dy = new_size.cy - _last_size.cy;
795 
796  if (!dx && !dy)
797  return;
798 
799  _last_size = new_size;
800 
801  HDWP hDWP = BeginDeferWindowPos(size());
802 
803  for(ResizeManager::const_iterator it=begin(); it!=end(); ++it) {
804  const ResizeEntry& e = *it;
805  RECT move = {0};
806 
807  if (e._flags & MOVE_LEFT)
808  move.left += dx;
809 
810  if (e._flags & MOVE_RIGHT)
811  move.right += dx;
812 
813  if (e._flags & MOVE_TOP)
814  move.top += dy;
815 
816  if (e._flags & MOVE_BOTTOM)
817  move.bottom += dy;
818 
819  UINT flags = 0;
820 
821  if (!move.left && !move.top)
822  flags = SWP_NOMOVE;
823 
824  if (move.right==move.left && move.bottom==move.top)
825  flags |= SWP_NOSIZE;
826 
827  if (flags != (SWP_NOMOVE|SWP_NOSIZE)) {
828  HWND hwnd = GetDlgItem(_hwnd, e._id);
829 
830  if (hwnd) {
831  WindowRect rect(hwnd);
833 
834  rect.left += move.left;
835  rect.right += move.right;
836  rect.top += move.top;
837  rect.bottom += move.bottom;
838 
839  hDWP = DeferWindowPos(hDWP, hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, flags|SWP_NOACTIVATE|SWP_NOZORDER);
840  }
841  }
842  }
843 
844  EndDeferWindowPos(hDWP);
845 }
846 
848 {
851 
852  ClientRect clnt_rect(_hwnd);
853  HandleSize(clnt_rect.right, clnt_rect.bottom);
854 }
855 
856 
858  int id, DWORD flags, DWORD exStyle)
859  : WindowHandle(CreateWindowEx(exStyle, TEXT("BUTTON"), title, flags, left, top, width, height,
860  parent, (HMENU)id, g_Globals._hInstance, 0))
861 {
862 }
863 
864 
866 {
867  if (nmsg == PM_DISPATCH_DRAWITEM) {
869  return TRUE;
870  } else
871  return super::WndProc(nmsg, wparam, lparam);
872 }
873 
874 
876  int id, DWORD flags, DWORD exStyle)
877  : WindowHandle(CreateWindowEx(exStyle, TEXT("STATIC"), title, flags, left, top, width, height,
878  parent, (HMENU)id, g_Globals._hInstance, 0))
879 {
880 }
881 
882 
883 static RECT s_MyDrawText_Rect = {0, 0, 0, 0};
884 
886 {
888  return TRUE;
889 }
890 
891 void DrawGrayText(HDC hdc, LPRECT pRect, LPCTSTR title, int dt_flags)
892 {
894 
895  if (gray) {
896  TextColor lcColor(hdc, GetSysColor(COLOR_BTNHIGHLIGHT));
897  RECT shadowRect = {pRect->left+1, pRect->top+1, pRect->right+1, pRect->bottom+1};
898  DrawText(hdc, title, -1, &shadowRect, dt_flags);
899 
900  SetTextColor(hdc, gray);
901  DrawText(hdc, title, -1, pRect, dt_flags);
902  } else {
903  int old_r = pRect->right;
904  int old_b = pRect->bottom;
905 
906  DrawText(hdc, title, -1, pRect, dt_flags|DT_CALCRECT);
907 
908  int x = pRect->left + (old_r-pRect->right)/2;
909  int y = pRect->top + (old_b-pRect->bottom)/2;
910  int w = pRect->right-pRect->left;
911  int h = pRect->bottom-pRect->top;
914 
916  }
917 }
918 
919 
920 /* not yet used
921 void ColorButton::DrawItem(LPDRAWITEMSTRUCT dis)
922 {
923  UINT state = DFCS_BUTTONPUSH;
924 
925  if (dis->itemState & ODS_DISABLED)
926  state |= DFCS_INACTIVE;
927 
928  RECT textRect = {dis->rcItem.left+2, dis->rcItem.top+2, dis->rcItem.right-4, dis->rcItem.bottom-4};
929 
930  if (dis->itemState & ODS_SELECTED) {
931  state |= DFCS_PUSHED;
932  ++textRect.left; ++textRect.top;
933  ++textRect.right; ++textRect.bottom;
934  }
935 
936  DrawFrameControl(dis->hDC, &dis->rcItem, DFC_BUTTON, state);
937 
938  TCHAR title[BUFFER_LEN];
939  GetWindowText(_hwnd, title, BUFFER_LEN);
940 
941  BkMode bk_mode(dis->hDC, TRANSPARENT);
942 
943  if (dis->itemState & (ODS_DISABLED|ODS_GRAYED))
944  DrawGrayText(dis, &textRect, title, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
945  else {
946  TextColor lcColor(dis->hDC, _textColor);
947  DrawText(dis->hDC, title, -1, &textRect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
948  }
949 
950  if (dis->itemState & ODS_FOCUS) {
951  RECT rect = {
952  dis->rcItem.left+3, dis->rcItem.top+3,
953  dis->rcItem.right-dis->rcItem.left-4, dis->rcItem.bottom-dis->rcItem.top-4
954  };
955  if (dis->itemState & ODS_SELECTED) {
956  ++rect.left; ++rect.top;
957  ++rect.right; ++rect.bottom;
958  }
959  DrawFocusRect(dis->hDC, &rect);
960  }
961 }
962 */
963 
964 
966 {
968  int style = GetWindowStyle(_hwnd);
969 
970  if (dis->itemState & ODS_DISABLED)
971  state |= DFCS_INACTIVE;
972 
973  POINT imagePos;
974  RECT textRect;
975  int dt_flags;
976 
977  if (style & BS_BOTTOM) {
978  // align horizontal centered, vertical floating
979  imagePos.x = (dis->rcItem.left + dis->rcItem.right - _cx) / 2;
980  imagePos.y = dis->rcItem.top + 3;
981 
982  textRect.left = dis->rcItem.left + 2;
983  textRect.top = dis->rcItem.top + _cy + 4;
984  textRect.right = dis->rcItem.right - 4;
985  textRect.bottom = dis->rcItem.bottom - 4;
986 
988  } else {
989  // horizontal floating, vertical centered
990  imagePos.x = dis->rcItem.left + 3;
991  imagePos.y = (dis->rcItem.top + dis->rcItem.bottom - _cy)/2;
992 
993  textRect.left = dis->rcItem.left + _cx + 4;
994  textRect.top = dis->rcItem.top + 2;
995  textRect.right = dis->rcItem.right - 4;
996  textRect.bottom = dis->rcItem.bottom - 4;
997 
998  dt_flags = DT_SINGLELINE|DT_VCENTER/*|DT_CENTER*/;
999  }
1000 
1001  if (dis->itemState & ODS_SELECTED) {
1002  state |= DFCS_PUSHED;
1003  ++imagePos.x; ++imagePos.y;
1004  ++textRect.left; ++textRect.top;
1006  }
1007 
1008  if (_flat) {
1009  FillRect(dis->hDC, &dis->rcItem, _hBrush);
1010 
1011  if (style & BS_FLAT) // Only with BS_FLAT set, there will be drawn a frame without highlight.
1012  DrawEdge(dis->hDC, &dis->rcItem, EDGE_RAISED, BF_RECT|BF_FLAT);
1013  } else
1014  DrawFrameControl(dis->hDC, &dis->rcItem, DFC_BUTTON, state);
1015 
1016  if (_hIcon)
1017  DrawIconEx(dis->hDC, imagePos.x, imagePos.y, _hIcon, _cx, _cy, 0, _hBrush, DI_NORMAL);
1018  else {
1019  MemCanvas mem_dc;
1020  BitmapSelection sel(mem_dc, _hBmp);
1021  BitBlt(dis->hDC, imagePos.x, imagePos.y, _cx, _cy, mem_dc, 0, 0, SRCCOPY);
1022  }
1023 
1025  GetWindowText(_hwnd, title, BUFFER_LEN);
1026 
1027  BkMode bk_mode(dis->hDC, TRANSPARENT);
1028 
1029  if (dis->itemState & (ODS_DISABLED|ODS_GRAYED))
1030  DrawGrayText(dis->hDC, &textRect, title, dt_flags);
1031  else {
1032  TextColor lcColor(dis->hDC, GetSysColor(COLOR_BTNTEXT));
1033  DrawText(dis->hDC, title, -1, &textRect, dt_flags);
1034  }
1035 
1036  if (dis->itemState & ODS_FOCUS) {
1037  RECT rect = {
1038  dis->rcItem.left+3, dis->rcItem.top+3,
1039  dis->rcItem.right-dis->rcItem.left-4, dis->rcItem.bottom-dis->rcItem.top-4
1040  };
1041  if (dis->itemState & ODS_SELECTED) {
1042  ++rect.left; ++rect.top;
1043  ++rect.right; ++rect.bottom;
1044  }
1045  DrawFocusRect(dis->hDC, &rect);
1046  }
1047 }
1048 
1049 
1051 {
1053 
1054  if (dis->itemState & ODS_DISABLED)
1055  style |= DFCS_INACTIVE;
1056 
1057  RECT textRect = {dis->rcItem.left+2, dis->rcItem.top+2, dis->rcItem.right-4, dis->rcItem.bottom-4};
1058 
1059  if (dis->itemState & ODS_SELECTED) {
1060  style |= DFCS_PUSHED;
1061  ++textRect.left; ++textRect.top;
1063  }
1064 
1066 
1067  // highlight the button?
1068  if (_active)
1069  DrawEdge(dis->hDC, &dis->rcItem, EDGE_ETCHED, BF_RECT);
1070  else if (GetWindowStyle(_hwnd) & BS_FLAT) // Only with BS_FLAT there will be drawn a frame to show highlighting.
1071  DrawEdge(dis->hDC, &dis->rcItem, EDGE_RAISED, BF_RECT|BF_FLAT);
1072 
1073  TCHAR txt[BUFFER_LEN];
1074  int txt_len = GetWindowText(_hwnd, txt, BUFFER_LEN);
1075 
1076  if (dis->itemState & (ODS_DISABLED|ODS_GRAYED)) {
1078 
1079  if (gray) {
1080  {
1081  TextColor lcColor(dis->hDC, GetSysColor(COLOR_BTNHIGHLIGHT));
1082  RECT shadowRect = {textRect.left+1, textRect.top+1, textRect.right+1, textRect.bottom+1};
1083  DrawText(dis->hDC, txt, txt_len, &shadowRect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
1084  }
1085 
1086  BkMode mode(dis->hDC, TRANSPARENT);
1087  TextColor lcColor(dis->hDC, gray);
1088  DrawText(dis->hDC, txt, txt_len, &textRect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
1089  } else {
1090  int old_r = textRect.right;
1091  int old_b = textRect.bottom;
1093  int x = textRect.left + (old_r-textRect.right)/2;
1094  int y = textRect.top + (old_b-textRect.bottom)/2;
1095  int w = textRect.right-textRect.left;
1096  int h = textRect.bottom-textRect.top;
1099  GrayString(dis->hDC, GetSysColorBrush(COLOR_GRAYTEXT), MyDrawText, (LPARAM)txt, txt_len, x, y, w, h);
1100  }
1101  } else {
1102  TextColor lcColor(dis->hDC, _active? _activeColor: _textColor);
1103  DrawText(dis->hDC, txt, txt_len, &textRect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
1104  }
1105 
1106  if (dis->itemState & ODS_FOCUS) {
1107  RECT rect = {
1108  dis->rcItem.left+3, dis->rcItem.top+3,
1109  dis->rcItem.right-dis->rcItem.left-4, dis->rcItem.bottom-dis->rcItem.top-4
1110  };
1111  if (dis->itemState & ODS_SELECTED) {
1112  ++rect.left; ++rect.top;
1113  ++rect.right; ++rect.bottom;
1114  }
1115  DrawFocusRect(dis->hDC, &rect);
1116  }
1117 }
1118 
1120 {
1121  switch(nmsg) {
1122  case WM_MOUSEMOVE: {
1123  bool active = false;
1124 
1125  if (IsWindowEnabled(_hwnd)) {
1126  DWORD pid_foreground;
1127  HWND hwnd_foreground = GetForegroundWindow(); //@@ may be better look for WM_ACTIVATEAPP ?
1128  GetWindowThreadProcessId(hwnd_foreground, &pid_foreground);
1129 
1130  if (GetCurrentProcessId() == pid_foreground) {
1132  ClientRect clntRect(_hwnd);
1133 
1134  // highlight the button?
1135  if (pt.x>=clntRect.left && pt.x<clntRect.right && pt.y>=clntRect.top && pt.y<clntRect.bottom)
1136  active = true;
1137  }
1138  }
1139 
1140  if (active != _active) {
1141  _active = active;
1142 
1143  if (active) {
1144  TRACKMOUSEEVENT tme = {sizeof(tme), /*TME_HOVER|*/TME_LEAVE, _hwnd/*, HOVER_DEFAULT*/};
1145  _TrackMouseEvent(&tme);
1146  }
1147 
1148  InvalidateRect(_hwnd, NULL, TRUE);
1149  }
1150 
1151  return 0;}
1152 
1153  case WM_LBUTTONUP: {
1155  ClientRect clntRect(_hwnd);
1156 
1157  // no more in the active rectangle?
1158  if (pt.x<clntRect.left || pt.x>=clntRect.right || pt.y<clntRect.top || pt.y>=clntRect.bottom)
1159  goto cancel_press;
1160 
1161  goto def;}
1162 
1163  case WM_CANCELMODE:
1164  cancel_press: {
1165  TRACKMOUSEEVENT tme = {sizeof(tme), /*TME_HOVER|*/TME_LEAVE|TME_CANCEL, _hwnd/*, HOVER_DEFAULT*/};
1166  _TrackMouseEvent(&tme);
1167  _active = false;
1168  ReleaseCapture();}
1169  // fall through
1170 
1171  case WM_MOUSELEAVE:
1172  if (_active) {
1173  _active = false;
1174 
1175  InvalidateRect(_hwnd, NULL, TRUE);
1176  }
1177 
1178  return 0;
1179 
1180  default: def:
1181  return super::WndProc(nmsg, wparam, lparam);
1182  }
1183 }
1184 
1185 
1187  : super(hwnd),
1188  _cmd(ResString(GetDlgCtrlID(hwnd))),
1189  _textColor(colorLink),
1190  _colorVisited(colorVisited),
1191  _hfont(0),
1192  _crsr_link(0)
1193 {
1194  init();
1195 }
1196 
1197 HyperlinkCtrl::HyperlinkCtrl(HWND owner, int id, COLORREF colorLink, COLORREF colorVisited)
1198  : super(GetDlgItem(owner, id)),
1199  _cmd(ResString(id)),
1200  _textColor(colorLink),
1201  _colorVisited(colorVisited),
1202  _hfont(0),
1203  _crsr_link(0)
1204 {
1205  init();
1206 }
1207 
1209 {
1210  if (_cmd.empty()) {
1211  TCHAR txt[BUFFER_LEN];
1212  _cmd.assign(txt, GetWindowText(_hwnd, txt, BUFFER_LEN));
1213  }
1214 }
1215 
1217 {
1218  if (_hfont)
1220 }
1221 
1223 {
1224  switch(nmsg) {
1225  case PM_DISPATCH_CTLCOLOR: {
1226  if (!_hfont) {
1227  HFONT hfont = (HFONT) SendMessage(_hwnd, WM_GETFONT, 0, 0);
1228  LOGFONT lf; GetObject(hfont, sizeof(lf), &lf);
1229  lf.lfUnderline = TRUE;
1230  _hfont = CreateFontIndirect(&lf);
1231  }
1232 
1233  HDC hdc = (HDC) wparam;
1234  SetTextColor(hdc, _textColor); //@@
1235  SelectFont(hdc, _hfont);
1238  }
1239 
1240  case WM_SETCURSOR:
1241  if (!_crsr_link)
1243 
1244  if (_crsr_link)
1246  return 0;
1247 
1248  case WM_NCHITTEST:
1249  return HTCLIENT; // Aktivierung von Maus-Botschaften
1250 
1251  case WM_LBUTTONDOWN:
1252  if (LaunchLink()) {
1254  InvalidateRect(_hwnd, NULL, FALSE);
1255  } else
1256  MessageBeep(0);
1257  return 0;
1258 
1259  default:
1260  return super::WndProc(nmsg, wparam, lparam);
1261  }
1262 }
1263 
1264 
1268  owner, 0, g_Globals._hInstance, 0))
1269 {
1270  activate();
1271 }
1272 
1273 
1274 ListSort::ListSort(HWND hwndListview, PFNLVCOMPARE compare_fct)
1275  : WindowHandle(hwndListview),
1276  _compare_fct(compare_fct)
1277 {
1278  _sort_crit = 0;
1279  _direction = false;
1280 }
1281 
1283 {
1284  if (_sort_crit == idx)
1286  else {
1287  _sort_crit = idx;
1288  _direction = false;
1289  }
1290 }
1291 
1293 {
1294  int idx = ListView_GetSelectionMark(_hwnd);
1296 
1297  ListView_SortItems(_hwnd, _compare_fct, (LPARAM)this);
1298 
1299  if (idx >= 0) {
1300  idx = ListView_FindItemPara(_hwnd, param);
1301  ListView_EnsureVisible(_hwnd, idx, FALSE);
1302  }
1303 }
1304 
1305 
1307  : _dlg_creator(dlg_creator)
1308 {
1312  PROPSHEETPAGE::pszTemplate = MAKEINTRESOURCE(nid);
1313  PROPSHEETPAGE::pfnDlgProc = PropSheetPageDlg::DialogProc;
1314  PROPSHEETPAGE::lParam = (LPARAM) this;
1315 }
1316 
1317 
1318 #ifndef PSM_GETRESULT // currently (as of 18.01.2004) missing in MinGW headers
1319 #define PSM_GETRESULT (WM_USER + 135)
1320 #define PropSheet_GetResult(hDlg) SNDMSG(hDlg, PSM_GETRESULT, 0, 0)
1321 #endif
1322 
1323 
1325  : _hwnd(0)
1326 {
1331 }
1332 
1334 {
1335  _pages.push_back(psp);
1336 }
1337 
1339 {
1340  PROPSHEETHEADER::ppsp = (LPCPROPSHEETPAGE) &_pages[0];
1341  PROPSHEETHEADER::nPages = _pages.size();
1342  PROPSHEETHEADER::nStartPage = start_page;
1343 /*
1344  Window* pwnd = Window::create_property_sheet(this, WINDOW_CREATOR(PropertySheetDlg), NULL);
1345  if (!pwnd)
1346  return -1;
1347 
1348  HWND hwndPropSheet = *pwnd;
1349 */
1350  int ret = PropertySheet(this);
1351  if (ret == -1)
1352  return -1;
1353 
1354  HWND hwndPropSheet = (HWND) ret;
1355  HWND hwndparent = GetParent(hwndPropSheet);
1356 
1357  if (hwndparent)
1359 
1360  ret = 0;
1361  MSG msg;
1362 
1363  while(GetMessage(&msg, 0, 0, 0)) {
1364  try {
1366  continue;
1367 
1368  if (PropSheet_IsDialogMessage(hwndPropSheet, &msg))
1369  continue;
1370 
1372  continue;
1373 
1375 
1376  try {
1377  DispatchMessage(&msg);
1378  } catch(COMException& e) {
1379  HandleException(e, 0);
1380  }
1381 
1382  if (!PropSheet_GetCurrentPageHwnd(hwndPropSheet)) {
1383  ret = PropSheet_GetResult(hwndPropSheet);
1384  break;
1385  }
1386  } catch(COMException& e) {
1387  HandleException(e, 0);
1388  }
1389  }
1390 
1391  if (hwndparent)
1393 
1394  DestroyWindow(hwndPropSheet);
1395 
1396  return ret;
1397 }
1398 
1400 {
1402  return hdlg;
1403 }
1404 
1405 
1407  : super(hwnd)
1408 {
1409 }
1410 
1412 {
1414 
1415  if (pThis) {
1416  switch(nmsg) {
1417  case WM_COMMAND:
1418  pThis->Command(LOWORD(wparam), HIWORD(wparam));
1419  return TRUE; // message has been processed
1420 
1421  case WM_NOTIFY:
1422  pThis->Notify(wparam, (NMHDR*)lparam);
1423  return TRUE; // message has been processed
1424 
1425  case WM_NOTIFYFORMAT:
1426  SetWindowLongPtr(hwnd, DWLP_MSGRESULT, NFR_CURRENT); // set return value NFR_CURRENT
1427  return TRUE; // message has been processed
1428 
1429  case WM_NCDESTROY:
1430  delete pThis;
1431  return TRUE; // message has been processed
1432 
1433  default:
1434  return pThis->WndProc(nmsg, wparam, lparam);
1435  }
1436  } else if (nmsg == WM_INITDIALOG) {
1438  PropSheetPage* ppsp = (PropSheetPage*) psp->lParam;
1439 
1440  if (ppsp->_dlg_creator) {
1441  pThis = static_cast<PropSheetPageDlg*>(ppsp->_dlg_creator(hwnd));
1442 
1443  if (pThis)
1444  return pThis->Init(NULL);
1445  }
1446  }
1447 
1448  return FALSE; // message has not been processed
1449 }
1450 
1452 {
1453  // override call to EndDialog in Dialog::Command();
1454 
1455  return FALSE;
1456 }
#define BF_FLAT
Definition: winuser.h:471
HGDIOBJ WINAPI GetStockObject(_In_ int)
map< HWND, Window * > WindowMap
Definition: window.h:64
static LRESULT CALLBACK WindowWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:247
#define IDC_SIZEWE
Definition: winuser.h:689
virtual void DrawItem(LPDRAWITEMSTRUCT dis)
Definition: window.cpp:965
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2491
#define CallWindowProc
Definition: winuser.h:5601
WNDPROC _orgWndProc
Definition: window.h:183
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT style
Definition: winuser.h:3155
structure for managing critical sections as static class information in struct Window
Definition: window.h:124
#define MAKEINTRESOURCE
Definition: winuser.h:591
GLint GLint GLsizei width
Definition: gl.h:1546
#define DispatchMessage
Definition: winuser.h:5631
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HICON _hIcon
Definition: window.h:756
static HWND hwndparent
Definition: listview.c:56
HDWP WINAPI BeginDeferWindowPos(_In_ int)
convenient loading of standard (32x32) icon resources
Definition: globals.h:309
HWND _hwnd
Definition: window.h:509
ChildWindow(HWND hwnd, const ChildWndInfo &info)
Definition: window.cpp:359
#define TRUE
Definition: types.h:120
structure to assign RESIZE_FLAGS to dialogs control
Definition: window.h:471
static LRESULT CALLBACK PropSheetCBTHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:185
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define DFC_BUTTON
Definition: winuser.h:476
#define TOOLTIPS_CLASS
Definition: commctrl.h:1682
#define HCBT_CREATEWND
Definition: winuser.h:58
void pop()
Definition: _stack.h:87
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
int _last_split
Definition: window.h:329
bool empty() const
Definition: _stack.h:82
long y
Definition: polytest.cpp:48
rwlock_t lock
Definition: tcpcore.h:1163
#define WM_CHAR
Definition: winuser.h:1693
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
ResizeManager(HWND hwnd)
Definition: window.cpp:776
HCURSOR hCursor
Definition: winuser.h:3161
WNDPROC lpfnWndProc
Definition: winuser.h:3156
#define PropSheet_IsDialogMessage(d, m)
Definition: prsht.h:329
long x
Definition: polytest.cpp:48
#define PropSheet_GetCurrentPageHwnd(d)
Definition: prsht.h:327
static WindowSet s_dialogs
Definition: window.h:138
void MoveVisible(HWND hwnd)
Definition: utility.cpp:72
HWND _hwndFrame
Definition: window.h:331
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
NOTIFYICONDATA nid
Definition: magnifier.c:44
LPCSTR lpszClassName
Definition: winuser.h:3164
WindowHandle _left_hwnd
Definition: window.h:324
#define pt(x, y)
Definition: drawing.c:79
int _focus_pane
Definition: window.h:326
GLint dy
Definition: linetemp.h:97
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
static LRESULT CALLBACK SubclassedWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:310
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
static HDC
Definition: imagelist.c:92
BYTE lfUnderline
Definition: dimm.idl:48
#define DFCS_INACTIVE
Definition: winuser.h:502
#define CALLBACK
Definition: compat.h:27
BOOL WINAPI UpdateWindow(_In_ HWND)
WindowHandle _right_hwnd
Definition: window.h:325
virtual void DrawItem(LPDRAWITEMSTRUCT dis)
Definition: window.cpp:1050
static void register_pretranslate(HWND hwnd)
Definition: window.cpp:579
static CREATORFUNC s_window_creator
Definition: window.h:120
LONG top
Definition: windef.h:292
HBRUSH _hBrush
Definition: window.h:758
HANDLE HWND
Definition: compat.h:13
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ODS_FOCUS
Definition: winuser.h:2503
#define assert(x)
Definition: debug.h:53
COLORREF _textColor
Definition: window.h:706
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:925
PropSheetPageDlg(HWND)
Definition: window.cpp:1406
PropertySheetDialog(HWND owner)
Definition: window.cpp:1324
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
ListSort(HWND hwndListview, PFNLVCOMPARE compare_fct)
Definition: window.cpp:1274
#define PM_URL_CHANGED
Definition: window.h:391
#define WM_NCHITTEST
Definition: winuser.h:1668
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
static WCHAR String[]
Definition: stringtable.c:55
UINT_PTR WPARAM
Definition: windef.h:207
bool _direction
Definition: window.h:959
GLuint GLuint end
Definition: gl.h:1545
String _statusText
Definition: window.h:332
static void CancelModes()
Definition: window.cpp:295
HICON hIconSm
Definition: winuser.h:3165
WCHAR classname[128]
Definition: startup.c:15
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
int32_t INT_PTR
Definition: typedefs.h:62
#define PSH_MODELESS
Definition: prsht.h:50
static Window * create_controller(HWND hwnd)
create controller for a new window
Definition: window.cpp:220
#define IsDialogMessage
Definition: winuser.h:5675
#define VK_ESCAPE
Definition: winuser.h:2168
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
PFNLVCOMPARE _compare_fct
Definition: window.h:962
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
bool LaunchLink()
Definition: window.h:837
#define ID_GO_UP
Definition: resource.h:210
void push(const value_type &__x)
Definition: _stack.h:86
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
static void unregister_dialog(HWND hwnd)
Definition: window.cpp:614
#define PM_TRANSLATE_MSG
Definition: window.h:266
#define SetWindowLongPtr
Definition: treelist.c:70
static HWND child
Definition: cursoricon.c:298
DWORD WINAPI GetSysColor(_In_ int)
_Rep_type::const_iterator const_iterator
Definition: _map.h:86
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define SPLIT_WIDTH
Definition: eventvwr.c:62
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define DrawText
Definition: winuser.h:5637
static Window * create_mdi_child(const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
Definition: window.cpp:118
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define GetWindowText
Definition: winuser.h:5664
#define GetWindowStyle(hwnd)
Definition: windowsx.h:290
struct _test_info info[]
Definition: SetCursorPos.c:19
Exception with context information.
Definition: shellclasses.h:113
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:760
~Dialog()
Definition: window.cpp:696
information structure for creation of a MDI child window
Definition: window.h:44
int WINAPI GetDlgCtrlID(_In_ HWND)
void HandleSize(int cx, int cy)
Definition: window.cpp:788
#define BF_RECT
Definition: winuser.h:462
void DrawGrayText(HDC hdc, LPRECT pRect, LPCTSTR title, int dt_flags)
Definition: window.cpp:891
#define DFCS_PUSHED
Definition: winuser.h:503
String _cmd
Definition: window.h:825
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
Definition: window.c:29
HINSTANCE hInstance
Definition: charmap.c:20
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:865
HINSTANCE hInstance
Definition: winuser.h:3159
#define DT_CALCRECT
Definition: winuser.h:526
COLORREF _colorVisited
Definition: window.h:829
void erase(iterator __pos)
Definition: _set.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
static LRESULT CALLBACK MDICBTHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:142
#define DEFAULT_SPLIT_POS
Definition: window.h:270
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
#define e
Definition: ke_i.h:82
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:512
#define WM_SETCURSOR
Definition: winuser.h:1618
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:1411
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
PreTranslateWindow(HWND)
Definition: window.cpp:678
HWND WINAPI GetCapture(void)
Definition: message.c:2879
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
#define WM_SYSCHAR
Definition: winuser.h:1697
unsigned int idx
Definition: utils.c:41
#define CreateWindowEx
Definition: winuser.h:5621
#define TRANSPARENT
Definition: wingdi.h:949
#define CW_USEDEFAULT
Definition: winuser.h:225
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
static WindowSet s_pretranslate_windows
Definition: window.h:137
RECT textRect
Definition: startmenu.cpp:1392
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
#define PROPSHEETHEADER
Definition: prsht.h:374
static HWND hwndParent
Definition: cryptui.c:300
#define BUFFER_LEN
Definition: utility.h:97
struct tagMINMAXINFO * LPMINMAXINFO
LONG cx
Definition: windef.h:319
#define WM_KEYDOWN
Definition: winuser.h:1691
LONG_PTR LPARAM
Definition: windef.h:208
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:290
UINT cbSize
Definition: winuser.h:3154
static const WCHAR start_page[]
Definition: general.c:38
static HWND Create(CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
Definition: window.cpp:87
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define WH_CBT
Definition: winuser.h:35
#define DT_VCENTER
Definition: winuser.h:543
#define NFR_CURRENT
Definition: window.h:144
void activate(BOOL active=TRUE)
Definition: window.h:856
PropSheetPage(UINT nid, Window::CREATORFUNC dlg_creator)
Definition: window.cpp:1306
static clock_t begin
Definition: xmllint.c:466
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:420
static HFONT hfont
#define DefMDIChildProc
Definition: ros2win.h:33
HBRUSH hbrBackground
Definition: winuser.h:3162
#define DefWindowProc
Definition: ros2win.h:31
HCURSOR _crsr_link
Definition: window.h:831
#define PostMessage
Definition: winuser.h:5698
#define PM_SETSTATUSTEXT
Definition: window.h:340
convenient loading of small (16x16) icon resources
Definition: globals.h:320
void erase(iterator __pos)
Definition: _map.h:203
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
char TCHAR
Definition: xmlstorage.h:189
#define IDC_HAND
Definition: winuser.h:693
int ListView_FindItemPara(HWND list_ctrl, LPARAM param)
Definition: window.h:928
GLsizeiptr size
Definition: glext.h:5919
static HHOOK s_hcbtHook
Definition: window.h:133
COLORREF _textColor
Definition: window.h:828
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
r parent
Definition: btrfs.c:2708
if(!(yy_init))
Definition: macro.lex.yy.c:714
SIZE _min_wnd_size
Definition: window.h:506
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define GetStockBrush(i)
Definition: windowsx.h:282
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
#define WM_SIZE
Definition: winuser.h:1593
#define ODS_DISABLED
Definition: winuser.h:2501
BOOL WINAPI _TrackMouseEvent(TRACKMOUSEEVENT *ptme)
Definition: commctrl.c:1207
static const WCHAR url[]
Definition: encode.c:1432
#define SWP_NOACTIVATE
Definition: winuser.h:1227
DWORD COLORREF
Definition: windef.h:285
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
Definition: _vector.h:376
#define HOLLOW_BRUSH
Definition: wingdi.h:898
#define WM_NCDESTROY
Definition: winuser.h:1666
GLfloat param
Definition: glext.h:5796
#define SetWindowsHookEx
Definition: winuser.h:5722
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HBITMAP _hBmp
Definition: window.h:757
#define COLOR_SPLITBAR
Definition: window.h:271
WindowHandle super
Definition: window.h:852
#define BN_CLICKED
Definition: winuser.h:1886
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL pretranslate_msg(LPMSG pmsg)
Definition: window.cpp:589
GLint left
Definition: glext.h:7726
static void unregister_pretranslate(HWND hwnd)
Definition: window.cpp:584
String _url
Definition: window.h:333
#define SIZE_MINIMIZED
Definition: winuser.h:2460
ATOM _atomClass
Definition: window.h:244
#define LPCPROPSHEETPAGE
Definition: prsht.h:373
#define PM_DISPATCH_CTLCOLOR
Definition: window.h:593
#define GetObject
Definition: wingdi.h:4446
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define EDGE_ETCHED
Definition: winuser.h:452
#define ODS_GRAYED
Definition: winuser.h:2500
static ChildWindow * create(const ChildWndInfo &info, const RECT &rect, CREATORFUNC_INFO creator, LPCTSTR classname, LPCTSTR title=NULL, DWORD style=0)
Definition: window.cpp:369
GLbitfield flags
Definition: glext.h:7161
#define WM_PAINT
Definition: winuser.h:1602
WindowClass(LPCTSTR classname, UINT style=0, WNDPROC wndproc=Window::WindowWndProc)
Definition: window.cpp:31
int _sort_crit
Definition: window.h:958
#define DialogBoxParam
Definition: winuser.h:5630
int ret
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
Definition: _map.h:210
HINSTANCE _hInstance
Definition: globals.h:270
LRESULT PostParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
Definition: window.cpp:667
#define COLOR_GRAYTEXT
Definition: winuser.h:922
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:280
HICON hIcon
Definition: winuser.h:3160
void set_url(LPCTSTR url)
Definition: window.cpp:567
HDC hdc
Definition: main.c:9
Property Sheet Page (inner dialog)
Definition: window.h:425
HyperlinkCtrl(HWND hwnd, COLORREF colorLink=RGB(0, 0, 255), COLORREF colorVisited=RGB(128, 0, 128))
Definition: window.cpp:1186
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define COLOR_BTNFACE
Definition: winuser.h:918
virtual int Command(int id, int code)
Definition: window.cpp:348
bool _flat
Definition: window.h:763
#define PropSheet_GetResult(hDlg)
Definition: window.cpp:1320
static int state
Definition: maze.c:121
#define WM_CANCELMODE
Definition: winuser.h:1617
virtual void DrawItem(LPDRAWITEMSTRUCT dis)=0
#define DI_NORMAL
Definition: wingdi.h:72
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
IconWindowClass(LPCTSTR classname, UINT nid, UINT style=0, WNDPROC wndproc=Window::WindowWndProc)
Definition: window.cpp:47
#define WS_EX_TOPMOST
Definition: pedump.c:647
Window *(* CREATORFUNC_INFO)(HWND, const void *)
Definition: window.h:67
ToolTip(HWND owner)
Definition: window.cpp:1265
int Command(int id, int code)
Definition: window.cpp:1451
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
#define WM_COMMAND
Definition: winuser.h:1716
#define WM_MDIACTIVATE
Definition: winuser.h:1790
virtual ~Window()
Definition: window.cpp:79
GLenum mode
Definition: glext.h:6217
static WindowMap s_wnd_map
Definition: window.h:117
#define LoadCursor
Definition: winuser.h:5678
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define SelectFont(hdc, hfont)
Definition: windowsx.h:486
void sort()
Definition: window.cpp:1292
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define EDGE_RAISED
Definition: winuser.h:450
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:1119
#define BS_FLAT
Definition: winuser.h:280
BOOL WINAPI MessageBeep(_In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1230
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
int Command(int id, int code)
Definition: window.cpp:765
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:886
#define DT_SINGLELINE
Definition: winuser.h:540
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HWND WINAPI SetCapture(_In_ HWND hWnd)
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
static const void * s_new_info
Definition: window.h:119
reference top()
Definition: _stack.h:84
#define TEXT(s)
Definition: k32.h:26
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define GET_WINDOW(CLASS, hwnd)
Definition: window.h:88
#define TME_CANCEL
Definition: commctrl.h:4955
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:388
virtual String jump_to_int(LPCTSTR url)=0
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
Button(HWND parent, LPCTSTR text, int left, int top, int width, int height, int id, DWORD flags=WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON, DWORD exStyle=0)
Definition: window.cpp:857
static void register_dialog(HWND hwnd)
Definition: window.cpp:609
int DoModal(int start_page=0)
Definition: window.cpp:1338
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
Window::CREATORFUNC _dlg_creator
Definition: window.h:403
virtual void resize_children(int cx, int cy)
Definition: window.cpp:527
#define ID_GO_HOME
Definition: resource.h:208
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define TME_LEAVE
Definition: commctrl.h:4952
#define WM_LBUTTONUP
Definition: winuser.h:1753
static int MessageLoop()
Definition: window.cpp:629
int _split_pos
Definition: window.h:328
int(CALLBACK * PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM)
Definition: commctrl.h:2672
#define WS_POPUP
Definition: pedump.c:616
#define CreateFontIndirect
Definition: wingdi.h:4422
unsigned int UINT
Definition: ndis.h:50
#define WM_MOUSEMOVE
Definition: winuser.h:1751
#define BS_BOTTOM
Definition: winuser.h:259
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define GetMessage
Definition: winuser.h:5656
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:725
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
#define WM_MDICREATE
Definition: winuser.h:1788
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
SIZE _last_size
Definition: window.h:510
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:343
bool go_to(LPCTSTR url)
Definition: window.cpp:553
#define msg(x)
Definition: auth_time.c:54
bool _active
Definition: window.h:708
#define IDC_ARROW
Definition: winuser.h:682
_Out_opt_ int * cx
Definition: commctrl.h:570
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define ODS_SELECTED
Definition: winuser.h:2499
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2675
#define SendMessage
Definition: winuser.h:5709
Window *(* CREATORFUNC)(HWND)
Definition: window.h:66
#define PropertySheet
Definition: prsht.h:382
#define WM_CREATE
Definition: winuser.h:1590
#define PM_DISPATCH_DRAWITEM
Definition: window.h:621
static struct myctx * mcs
Definition: adnstest.c:53
#define WM_SYSKEYDOWN
Definition: winuser.h:1695
iterator end()
Definition: _set.h:152
#define ID_GO_FORWARD
Definition: resource.h:207
size_type size() const
Definition: _vector.h:192
#define HIWORD(l)
Definition: typedefs.h:246
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
Definition: window.cpp:701
Static(HWND parent, LPCTSTR text, int left, int top, int width, int height, int id, DWORD flags=WS_VISIBLE|WS_CHILD|SS_SIMPLE, DWORD ex_flags=0)
Definition: window.cpp:875
GLenum GLuint id
Definition: glext.h:5579
LONG bottom
Definition: windef.h:294
#define DT_CENTER
Definition: winuser.h:527
Window(HWND hwnd)
Definition: window.cpp:71
static BOOL dispatch_dialog_msg(LPMSG pmsg)
Definition: window.cpp:619
#define SelectBrush(hdc, hbr)
Definition: windowsx.h:485
#define SWP_NOMOVE
Definition: winuser.h:1229
virtual int Command(int id, int code)
Definition: window.cpp:285
stack< String > _url_history
Definition: window.h:335
#define COLOR_BTNTEXT
Definition: winuser.h:923
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LRESULT SendParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
Definition: window.cpp:657
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:353
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5585
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
COLORREF _activeColor
Definition: window.h:707
POINT ptMaxTrackSize
Definition: winuser.h:3573
convenient loading of string resources
Definition: globals.h:303
#define HTCLIENT
Definition: winuser.h:2429
int ListView_GetItemData(HWND list_ctrl, int idx)
Definition: window.h:915
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2761
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LONG_PTR LRESULT
Definition: windef.h:209
#define GrayString
Definition: winuser.h:5668
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
UINT message
Definition: winuser.h:3068
Arabic default style
Definition: afstyles.h:93
static BOOL CALLBACK MyDrawText(HDC hdc, LPARAM data, int cnt)
Definition: window.cpp:885
HBRUSH WINAPI GetSysColorBrush(_In_ int)
Definition: _set.h:46
#define PM_DISPATCH_COMMAND
Definition: window.h:265
#define memset(x, y, z)
Definition: compat.h:39
Dialog(HWND)
Definition: window.cpp:690
#define HWND_BROADCAST
Definition: winuser.h:1190
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LONG cy
Definition: windef.h:320
#define WM_INITDIALOG
Definition: winuser.h:1715
void add(PropSheetPage &psp)
Definition: window.cpp:1333
LPARAM lParam
Definition: combotst.c:139
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:1222
static RECT s_MyDrawText_Rect
Definition: window.cpp:883
static char title[]
Definition: ps.c:92
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define TTS_NOPREFIX
Definition: commctrl.h:1730
#define LOWORD(l)
Definition: pedump.c:82
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203
#define SRCCOPY
Definition: wingdi.h:332
void init()
Definition: window.cpp:1208
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define PROPSHEETPAGE
Definition: prsht.h:371
#define WM_NOTIFY
Definition: richedit.h:61
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188
HFONT _hfont
Definition: window.h:830
void toggle_sort(int idx)
Definition: window.cpp:1282
static UINT WPARAM wparam
Definition: combo.c:716
void Resize(int dx, int dy)
Definition: window.cpp:847
#define ID_GO_BACK
Definition: resource.h:206
iterator end()
Definition: _map.h:165
#define PM_JUMP_TO_URL
Definition: window.h:390
SubclassedWindow(HWND)
Definition: window.cpp:301