ReactOS 0.4.15-dev-7788-g1ad9096
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
55Window::WindowMap Window::s_wnd_map;
56
57Window::CREATORFUNC Window::s_window_creator = NULL;
58const void* Window::s_new_info = NULL;
59
60HHOOK 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
87HWND 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;
96
97 return CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
98 x, y, w, h,
99 hwndParent, hMenu, g_Globals._hInstance, 0/*lpParam*/);
100}
101
102HWND 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;
111
112 return CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle,
113 x, y, w, h,
114 hwndParent, hMenu, g_Globals._hInstance, 0/*lpParam*/);
115}
116
117
118Window* 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
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/*
162Window* 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;
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
285int Window::Command(int id, int code)
286{
287 return 1; // no command handler found
288}
289
290int 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
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
369ChildWindow* 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;
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
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)
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;
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
480 switch(LOWORD(wparam)) {
481 case ID_GO_BACK:
482 if (!_url_history.empty()) {
484
485 if (jump_to_int(url))
486 set_url(url);
487
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) {
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
577WindowSet Window::s_pretranslate_windows;
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
607WindowSet Window::s_dialogs;
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
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
701int 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;
707
709
711}
712
713int 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;
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
765int 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)
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
883static RECT s_MyDrawText_Rect = {0, 0, 0, 0};
884
886{
888 return TRUE;
889}
890
891void 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
921void 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)
972
973 POINT imagePos;
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;
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.
1013 } else
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
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)
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;
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.
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;
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
1197HyperlinkCtrl::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;
1231 }
1232
1233 HDC hdc = (HDC) wparam;
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
1274ListSort::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) {
1302 }
1303}
1304
1305
1306PropSheetPage::PropSheetPage(UINT nid, Window::CREATORFUNC dlg_creator)
1307 : _dlg_creator(dlg_creator)
1308{
1309 PROPSHEETPAGE::dwSize = sizeof(PROPSHEETPAGE);
1310 PROPSHEETPAGE::dwFlags = 0;
1311 PROPSHEETPAGE::hInstance = g_Globals._hInstance;
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{
1327 PROPSHEETHEADER::dwSize = sizeof(PROPSHEETHEADER);
1328 PROPSHEETHEADER::dwFlags = PSH_PROPSHEETPAGE | PSH_MODELESS;
1329 PROPSHEETHEADER::hwndParent = owner;
1330 PROPSHEETHEADER::hInstance = g_Globals._hInstance;
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 {
1365 if (Window::pretranslate_msg(&msg))
1366 continue;
1367
1368 if (PropSheet_IsDialogMessage(hwndPropSheet, &msg))
1369 continue;
1370
1371 if (Window::dispatch_dialog_msg(&msg))
1372 continue;
1373
1375
1376 try {
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}
static HFONT hfont
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
static struct myctx * mcs
Definition: adnstest.c:53
Arabic default style
Definition: afstyles.h:94
static int state
Definition: maze.c:121
#define msg(x)
Definition: auth_time.c:54
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
Definition: _map.h:210
iterator end()
Definition: _map.h:165
void erase(iterator __pos)
Definition: _map.h:203
_Rep_type::const_iterator const_iterator
Definition: _map.h:86
Definition: _set.h:50
void erase(iterator __pos)
Definition: _set.h:182
iterator end()
Definition: _set.h:152
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
bool empty() const
Definition: _stack.h:82
reference top()
Definition: _stack.h:84
void push(const value_type &__x)
Definition: _stack.h:86
void pop()
Definition: _stack.h:87
BOOL WINAPI _TrackMouseEvent(TRACKMOUSEEVENT *ptme)
Definition: commctrl.c:1207
static HWND hwndParent
Definition: cryptui.c:300
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR start_page[]
Definition: general.c:38
unsigned int idx
Definition: utils.c:41
HANDLE HWND
Definition: compat.h:19
#define CALLBACK
Definition: compat.h:35
#define assert(x)
Definition: debug.h:53
#define pt(x, y)
Definition: drawing.c:79
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
r parent
Definition: btrfs.c:3010
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLenum mode
Definition: glext.h:6217
GLint left
Definition: glext.h:7726
GLbitfield flags
Definition: glext.h:7161
GLfloat param
Definition: glext.h:5796
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLuint id
Definition: glext.h:5910
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TEXT(s)
Definition: k32.h:26
#define e
Definition: ke_i.h:82
GLint dy
Definition: linetemp.h:97
if(dx< 0)
Definition: linetemp.h:194
GLint dx
Definition: linetemp.h:97
NOTIFYICONDATA nid
Definition: magnifier.c:44
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define ID_GO_UP
Definition: resource.h:210
#define ID_GO_HOME
Definition: resource.h:208
#define ID_GO_FORWARD
Definition: resource.h:207
#define ID_GO_BACK
Definition: resource.h:206
void MoveVisible(HWND hwnd)
Definition: utility.cpp:72
#define BUFFER_LEN
Definition: utility.h:97
#define GET_WINDOW(CLASS, hwnd)
Definition: window.h:88
#define PM_TRANSLATE_MSG
Definition: window.h:266
#define SPLIT_WIDTH
Definition: window.h:269
#define PM_SETSTATUSTEXT
Definition: window.h:340
#define PM_JUMP_TO_URL
Definition: window.h:390
#define NFR_CURRENT
Definition: window.h:144
#define COLOR_SPLITBAR
Definition: window.h:271
#define PM_DISPATCH_CTLCOLOR
Definition: window.h:593
#define PM_DISPATCH_COMMAND
Definition: window.h:265
@ MOVE_RIGHT
Definition: window.h:457
@ MOVE_TOP
Definition: window.h:458
@ MOVE_BOTTOM
Definition: window.h:459
@ MOVE_LEFT
Definition: window.h:456
#define DEFAULT_SPLIT_POS
Definition: window.h:270
int ListView_FindItemPara(HWND list_ctrl, LPARAM param)
Definition: window.h:928
#define PM_DISPATCH_DRAWITEM
Definition: window.h:621
void DrawGrayText(HDC hdc, LPRECT pRect, LPCTSTR text, int dt_flags)
Definition: window.cpp:891
#define PM_URL_CHANGED
Definition: window.h:391
int ListView_GetItemData(HWND list_ctrl, int idx)
Definition: window.h:915
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static HWND hwndparent
Definition: listview.c:56
static const WCHAR url[]
Definition: encode.c:1432
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static HWND child
Definition: cursoricon.c:298
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define WS_POPUP
Definition: pedump.c:616
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_MODELESS
Definition: prsht.h:50
#define PropSheet_IsDialogMessage(d, m)
Definition: prsht.h:347
#define PropertySheet
Definition: prsht.h:400
#define LPCPROPSHEETPAGE
Definition: prsht.h:391
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define PropSheet_GetCurrentPageHwnd(d)
Definition: prsht.h:345
#define PROPSHEETPAGE
Definition: prsht.h:389
static char title[]
Definition: ps.c:92
#define TME_CANCEL
Definition: commctrl.h:4984
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define TME_LEAVE
Definition: commctrl.h:4981
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TOOLTIPS_CLASS
Definition: commctrl.h:1710
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2703
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define WM_MOUSELEAVE
Definition: commctrl.h:4975
#define TTS_NOPREFIX
Definition: commctrl.h:1758
int(CALLBACK * PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM)
Definition: commctrl.h:2700
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2519
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
#define DefMDIChildProc
Definition: ros2win.h:33
WCHAR classname[128]
Definition: startup.c:15
#define memset(x, y, z)
Definition: compat.h:39
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
RECT textRect
Definition: startmenu.cpp:1392
& rect
Definition: startmenu.cpp:1413
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
Exception with context information.
Definition: shellclasses.h:114
int _split_pos
Definition: window.h:328
HWND _hwndFrame
Definition: window.h:331
bool go_to(LPCTSTR url)
Definition: window.cpp:553
String _statusText
Definition: window.h:332
int _last_split
Definition: window.h:329
stack< String > _url_history
Definition: window.h:335
WindowHandle _left_hwnd
Definition: window.h:324
int _focus_pane
Definition: window.h:326
WindowHandle _right_hwnd
Definition: window.h:325
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:388
virtual void resize_children(int cx, int cy)
Definition: window.cpp:527
virtual String jump_to_int(LPCTSTR url)=0
String _url
Definition: window.h:333
void set_url(LPCTSTR url)
Definition: window.cpp:567
static ChildWindow * create(const ChildWndInfo &info, const RECT &rect, CREATORFUNC_INFO creator, LPCTSTR classname, LPCTSTR title=NULL, DWORD style=0)
Definition: window.cpp:369
ChildWindow(HWND hwnd, const ChildWndInfo &info)
Definition: window.cpp:359
information structure for creation of a MDI child window
Definition: window.h:45
Definition: window.h:372
Dialog(HWND)
Definition: window.cpp:690
~Dialog()
Definition: window.cpp:696
static int DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent=0)
Definition: window.cpp:701
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:760
int Command(int id, int code)
Definition: window.cpp:765
HINSTANCE _hInstance
Definition: globals.h:270
COLORREF _activeColor
Definition: window.h:707
bool _active
Definition: window.h:708
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:1119
virtual void DrawItem(LPDRAWITEMSTRUCT dis)
Definition: window.cpp:1050
COLORREF _textColor
Definition: window.h:706
bool LaunchLink()
Definition: window.h:837
HCURSOR _crsr_link
Definition: window.h:831
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:1222
COLORREF _textColor
Definition: window.h:828
String _cmd
Definition: window.h:825
void init()
Definition: window.cpp:1208
COLORREF _colorVisited
Definition: window.h:829
HyperlinkCtrl(HWND hwnd, COLORREF colorLink=RGB(0, 0, 255), COLORREF colorVisited=RGB(128, 0, 128))
Definition: window.cpp:1186
HFONT _hfont
Definition: window.h:830
IconWindowClass(LPCTSTR classname, UINT nid, UINT style=0, WNDPROC wndproc=Window::WindowWndProc)
Definition: window.cpp:47
BYTE lfUnderline
Definition: dimm.idl:48
bool _direction
Definition: window.h:959
void toggle_sort(int idx)
Definition: window.cpp:1282
ListSort(HWND hwndListview, PFNLVCOMPARE compare_fct)
Definition: window.cpp:1274
void sort()
Definition: window.cpp:1292
PFNLVCOMPARE _compare_fct
Definition: window.h:962
int _sort_crit
Definition: window.h:958
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:865
virtual void DrawItem(LPDRAWITEMSTRUCT dis)=0
HBITMAP _hBmp
Definition: window.h:757
bool _flat
Definition: window.h:763
HICON _hIcon
Definition: window.h:756
virtual void DrawItem(LPDRAWITEMSTRUCT dis)
Definition: window.cpp:965
HBRUSH _hBrush
Definition: window.h:758
PreTranslateWindow(HWND)
Definition: window.cpp:678
Property Sheet Page (inner dialog)
Definition: window.h:426
int Command(int id, int code)
Definition: window.cpp:1451
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:1411
PropSheetPageDlg(HWND)
Definition: window.cpp:1406
PropSheetPage(UINT nid, Window::CREATORFUNC dlg_creator)
Definition: window.cpp:1306
Window::CREATORFUNC _dlg_creator
Definition: window.h:403
int DoModal(int start_page=0)
Definition: window.cpp:1338
void add(PropSheetPage &psp)
Definition: window.cpp:1333
PropertySheetDialog(HWND owner)
Definition: window.cpp:1324
convenient loading of standard (32x32) icon resources
Definition: globals.h:310
convenient loading of string resources
Definition: globals.h:304
structure to assign RESIZE_FLAGS to dialogs control
Definition: window.h:472
void Resize(int dx, int dy)
Definition: window.cpp:847
SIZE _last_size
Definition: window.h:510
HWND _hwnd
Definition: window.h:509
SIZE _min_wnd_size
Definition: window.h:506
ResizeManager(HWND hwnd)
Definition: window.cpp:776
void HandleSize(int cx, int cy)
Definition: window.cpp:788
convenient loading of small (16x16) icon resources
Definition: globals.h:321
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
virtual int Command(int id, int code)
Definition: window.cpp:348
SubclassedWindow(HWND)
Definition: window.cpp:301
WNDPROC _orgWndProc
Definition: window.h:183
static LRESULT CALLBACK SubclassedWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:310
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:343
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:353
WindowHandle super
Definition: window.h:852
void activate(BOOL active=TRUE)
Definition: window.h:856
ToolTip(HWND owner)
Definition: window.cpp:1265
WindowClass(LPCTSTR classname, UINT style=0, WNDPROC wndproc=Window::WindowWndProc)
Definition: window.cpp:31
ATOM _atomClass
Definition: window.h:244
structure for managing critical sections as static class information in struct Window
Definition: window.h:124
Definition: window.c:28
static HHOOK s_hcbtHook
Definition: window.h:133
static void CancelModes()
Definition: window.cpp:295
static LRESULT CALLBACK MDICBTHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:142
Window(HWND hwnd)
Definition: window.cpp:71
virtual ~Window()
Definition: window.cpp:79
static void register_dialog(HWND hwnd)
Definition: window.cpp:609
static CREATORFUNC s_window_creator
Definition: window.h:120
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:725
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:280
Window *(* CREATORFUNC_INFO)(HWND, const void *)
Definition: window.h:67
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
static StaticWindowData & GetStaticWindowData()
Definition: window.cpp:63
LRESULT SendParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
Definition: window.cpp:657
static const void * s_new_info
Definition: window.h:119
static void unregister_dialog(HWND hwnd)
Definition: window.cpp:614
static Window * create_mdi_child(const ChildWndInfo &info, const MDICREATESTRUCT &mcs, CREATORFUNC_INFO creator)
Definition: window.cpp:118
static int MessageLoop()
Definition: window.cpp:629
static void register_pretranslate(HWND hwnd)
Definition: window.cpp:579
static WindowMap s_wnd_map
Definition: window.h:117
virtual int Command(int id, int code)
Definition: window.cpp:285
static WindowSet s_dialogs
Definition: window.h:138
static Window * create_controller(HWND hwnd)
create controller for a new window
Definition: window.cpp:220
LRESULT PostParent(UINT nmsg, WPARAM wparam=0, LPARAM lparam=0)
Definition: window.cpp:667
Window *(* CREATORFUNC)(HWND)
Definition: window.h:66
static BOOL pretranslate_msg(LPMSG pmsg)
Definition: window.cpp:589
static void unregister_pretranslate(HWND hwnd)
Definition: window.cpp:584
static LRESULT CALLBACK WindowWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:247
static WindowSet s_pretranslate_windows
Definition: window.h:137
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
static Window * get_window(HWND hwnd)
get window controller from window handle
Definition: window.cpp:203
static BOOL dispatch_dialog_msg(LPMSG pmsg)
Definition: window.cpp:619
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:290
static LRESULT CALLBACK PropSheetCBTHookProc(int code, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:185
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
HINSTANCE hInstance
Definition: winuser.h:3206
HCURSOR hCursor
Definition: winuser.h:3208
HICON hIconSm
Definition: winuser.h:3212
UINT style
Definition: winuser.h:3202
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HICON hIcon
Definition: winuser.h:3207
HBRUSH hbrBackground
Definition: winuser.h:3209
Definition: inflate.c:139
POINT ptMaxTrackSize
Definition: winuser.h:3631
UINT message
Definition: winuser.h:3115
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
Definition: _vector.h:379
size_type size() const
Definition: _vector.h:192
rwlock_t lock
Definition: tcpcore.h:0
#define SetWindowLongPtr
Definition: treelist.c:70
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
#define HIWORD(l)
Definition: typedefs.h:247
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
static RECT s_MyDrawText_Rect
Definition: window.cpp:883
static BOOL CALLBACK MyDrawText(HDC hdc, LPARAM data, int cnt)
Definition: window.cpp:885
void DrawGrayText(HDC hdc, LPRECT pRect, LPCTSTR title, int dt_flags)
Definition: window.cpp:891
#define PropSheet_GetResult(hDlg)
Definition: window.cpp:1320
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define GetStockBrush(i)
Definition: windowsx.h:307
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define SelectFont(hdc, hfont)
Definition: windowsx.h:516
#define SelectBrush(hdc, hbr)
Definition: windowsx.h:515
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define GetWindowStyle(hwnd)
Definition: windowsx.h:315
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define DI_NORMAL
Definition: wingdi.h:72
#define TRANSPARENT
Definition: wingdi.h:950
#define HOLLOW_BRUSH
Definition: wingdi.h:899
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define GetObject
Definition: wingdi.h:4468
#define CreateFontIndirect
Definition: wingdi.h:4444
#define WM_PAINT
Definition: winuser.h:1620
#define ODS_DISABLED
Definition: winuser.h:2547
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define CreateWindowEx
Definition: winuser.h:5755
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2545
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define COLOR_BTNTEXT
Definition: winuser.h:933
#define GrayString
Definition: winuser.h:5802
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_GRAYTEXT
Definition: winuser.h:932
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define DT_CENTER
Definition: winuser.h:527
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define WM_MDICREATE
Definition: winuser.h:1812
#define CallWindowProc
Definition: winuser.h:5735
#define IsDialogMessage
Definition: winuser.h:5809
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define WM_CREATE
Definition: winuser.h:1608
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_SIZE
Definition: winuser.h:1611
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define HWND_BROADCAST
Definition: winuser.h:1204
#define WM_CANCELMODE
Definition: winuser.h:1635
#define DT_SINGLELINE
Definition: winuser.h:540
#define SWP_NOMOVE
Definition: winuser.h:1244
#define WM_COMMAND
Definition: winuser.h:1740
#define DFCS_INACTIVE
Definition: winuser.h:502
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2670
#define WM_NCHITTEST
Definition: winuser.h:1686
#define DFC_BUTTON
Definition: winuser.h:476
#define BS_BOTTOM
Definition: winuser.h:259
#define EDGE_ETCHED
Definition: winuser.h:452
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_MOUSEMOVE
Definition: winuser.h:1775
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define SIZE_MINIMIZED
Definition: winuser.h:2506
#define DialogBoxParam
Definition: winuser.h:5764
#define WM_INITDIALOG
Definition: winuser.h:1739
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
#define WH_CBT
Definition: winuser.h:35
BOOL WINAPI MessageBeep(_In_ UINT uType)
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define SetWindowsHookEx
Definition: winuser.h:5856
#define WM_MDIACTIVATE
Definition: winuser.h:1814
#define WM_GETFONT
Definition: winuser.h:1651
#define BF_FLAT
Definition: winuser.h:471
#define HCBT_CREATEWND
Definition: winuser.h:58
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DrawText
Definition: winuser.h:5771
#define GetMessage
Definition: winuser.h:5790
#define WM_SYSCHAR
Definition: winuser.h:1721
#define WM_GETMINMAXINFO
Definition: winuser.h:1640
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define BS_FLAT
Definition: winuser.h:280
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:2028
BOOL WINAPI UpdateWindow(_In_ HWND)
#define HTCLIENT
Definition: winuser.h:2475
#define SendMessage
Definition: winuser.h:5843
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LoadCursor
Definition: winuser.h:5812
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5719
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define WM_CHAR
Definition: winuser.h:1717
#define GetWindowText
Definition: winuser.h:5798
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define DT_VCENTER
Definition: winuser.h:543
#define PostMessage
Definition: winuser.h:5832
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define WM_NCDESTROY
Definition: winuser.h:1684
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define ODS_GRAYED
Definition: winuser.h:2546
#define WM_SETCURSOR
Definition: winuser.h:1636
struct tagMINMAXINFO * LPMINMAXINFO
int WINAPI GetDlgCtrlID(_In_ HWND)
#define IDC_HAND
Definition: winuser.h:698
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define BN_CLICKED
Definition: winuser.h:1925
#define WM_KEYDOWN
Definition: winuser.h:1715
#define DispatchMessage
Definition: winuser.h:5765
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define SWP_NOZORDER
Definition: winuser.h:1247
#define DT_CALCRECT
Definition: winuser.h:526
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:935
#define BF_RECT
Definition: winuser.h:462
#define IDC_SIZEWE
Definition: winuser.h:694
#define VK_ESCAPE
Definition: winuser.h:2214
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define EDGE_RAISED
Definition: winuser.h:450
#define DFCS_PUSHED
Definition: winuser.h:503
#define ODS_FOCUS
Definition: winuser.h:2549
#define WM_SYSKEYDOWN
Definition: winuser.h:1719
#define COLOR_BTNFACE
Definition: winuser.h:928
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HDWP WINAPI BeginDeferWindowPos(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
static clock_t begin
Definition: xmllint.c:458
char TCHAR
Definition: xmlstorage.h:189
const CHAR * LPCTSTR
Definition: xmlstorage.h:193