STL-ification patch for wxMSW and wxGTK.
[wxWidgets.git] / src / msw / frame.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msw/frame.cpp
3 // Purpose: wxFrame
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "frame.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/frame.h"
33 #include "wx/app.h"
34 #include "wx/menu.h"
35 #include "wx/utils.h"
36 #include "wx/dialog.h"
37 #include "wx/settings.h"
38 #include "wx/dcclient.h"
39 #include "wx/mdi.h"
40 #include "wx/panel.h"
41 #endif // WX_PRECOMP
42
43 #include "wx/msw/private.h"
44
45 #if wxUSE_STATUSBAR
46 #include "wx/statusbr.h"
47 #include "wx/generic/statusbr.h"
48 #endif // wxUSE_STATUSBAR
49
50 #if wxUSE_TOOLBAR
51 #include "wx/toolbar.h"
52 #endif // wxUSE_TOOLBAR
53
54 #include "wx/menuitem.h"
55 #include "wx/log.h"
56
57 #ifdef __WXUNIVERSAL__
58 #include "wx/univ/theme.h"
59 #include "wx/univ/colschem.h"
60 #endif // __WXUNIVERSAL__
61
62 // ----------------------------------------------------------------------------
63 // globals
64 // ----------------------------------------------------------------------------
65
66 #if wxUSE_MENUS_NATIVE
67 extern wxMenu *wxCurrentPopupMenu;
68 #endif // wxUSE_MENUS_NATIVE
69
70 // ----------------------------------------------------------------------------
71 // event tables
72 // ----------------------------------------------------------------------------
73
74 BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
75 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
76 END_EVENT_TABLE()
77
78 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
79
80 // ============================================================================
81 // implementation
82 // ============================================================================
83
84 // ----------------------------------------------------------------------------
85 // static class members
86 // ----------------------------------------------------------------------------
87
88 #if wxUSE_STATUSBAR
89 #if wxUSE_NATIVE_STATUSBAR
90 bool wxFrame::m_useNativeStatusBar = TRUE;
91 #else
92 bool wxFrame::m_useNativeStatusBar = FALSE;
93 #endif
94 #endif // wxUSE_NATIVE_STATUSBAR
95
96 // ----------------------------------------------------------------------------
97 // creation/destruction
98 // ----------------------------------------------------------------------------
99
100 void wxFrame::Init()
101 {
102 #if wxUSE_TOOLTIPS
103 m_hwndToolTip = 0;
104 #endif
105
106 // Data to save/restore when calling ShowFullScreen
107 m_fsStatusBarFields = 0;
108 m_fsStatusBarHeight = 0;
109 m_fsToolBarHeight = 0;
110
111 m_wasMinimized = FALSE;
112 }
113
114 bool wxFrame::Create(wxWindow *parent,
115 wxWindowID id,
116 const wxString& title,
117 const wxPoint& pos,
118 const wxSize& size,
119 long style,
120 const wxString& name)
121 {
122 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
123 return FALSE;
124
125 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
126
127 wxModelessWindows.Append(this);
128
129 return TRUE;
130 }
131
132 wxFrame::~wxFrame()
133 {
134 m_isBeingDeleted = TRUE;
135
136 DeleteAllBars();
137 }
138
139 // ----------------------------------------------------------------------------
140 // wxFrame client size calculations
141 // ----------------------------------------------------------------------------
142
143 void wxFrame::DoSetClientSize(int width, int height)
144 {
145 // leave enough space for the status bar if we have (and show) it
146 #if wxUSE_STATUSBAR
147 wxStatusBar *statbar = GetStatusBar();
148 if ( statbar && statbar->IsShown() )
149 {
150 height += statbar->GetSize().y;
151 }
152 #endif // wxUSE_STATUSBAR
153
154 // call GetClientAreaOrigin() to take the toolbar into account
155 wxPoint pt = GetClientAreaOrigin();
156 width += pt.x;
157 height += pt.y;
158
159 wxTopLevelWindow::DoSetClientSize(width, height);
160 }
161
162 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
163 void wxFrame::DoGetClientSize(int *x, int *y) const
164 {
165 wxTopLevelWindow::DoGetClientSize(x, y);
166
167 // account for the possible toolbar
168 wxPoint pt = GetClientAreaOrigin();
169 if ( x )
170 *x -= pt.x;
171
172 if ( y )
173 *y -= pt.y;
174
175 #if wxUSE_STATUSBAR
176 // adjust client area height to take the status bar into account
177 if ( y )
178 {
179 wxStatusBar *statbar = GetStatusBar();
180 if ( statbar && statbar->IsShown() )
181 {
182 *y -= statbar->GetClientSize().y;
183 }
184 }
185 #endif // wxUSE_STATUSBAR
186 }
187
188 // ----------------------------------------------------------------------------
189 // wxFrame: various geometry-related functions
190 // ----------------------------------------------------------------------------
191
192 void wxFrame::Raise()
193 {
194 ::SetForegroundWindow(GetHwnd());
195 }
196
197 // generate an artificial resize event
198 void wxFrame::SendSizeEvent()
199 {
200 if ( !m_iconized )
201 {
202 RECT r = wxGetWindowRect(GetHwnd());
203
204 (void)::PostMessage(GetHwnd(), WM_SIZE,
205 IsMaximized() ? SIZE_MAXIMIZED : SIZE_RESTORED,
206 MAKELPARAM(r.right - r.left, r.bottom - r.top));
207 }
208 }
209
210 #if wxUSE_STATUSBAR
211 wxStatusBar *wxFrame::OnCreateStatusBar(int number,
212 long style,
213 wxWindowID id,
214 const wxString& name)
215 {
216 wxStatusBar *statusBar = NULL;
217
218 #if wxUSE_NATIVE_STATUSBAR
219 if ( !UsesNativeStatusBar() )
220 {
221 statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style);
222 }
223 else
224 #endif
225 {
226 statusBar = new wxStatusBar(this, id, style, name);
227 }
228
229 statusBar->SetFieldsCount(number);
230
231 return statusBar;
232 }
233
234 void wxFrame::PositionStatusBar()
235 {
236 if ( !m_frameStatusBar || !m_frameStatusBar->IsShown() )
237 return;
238
239 int w, h;
240 GetClientSize(&w, &h);
241 int sw, sh;
242 m_frameStatusBar->GetSize(&sw, &sh);
243
244 // Since we wish the status bar to be directly under the client area,
245 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
246 m_frameStatusBar->SetSize(0, h, w, sh);
247 }
248 #endif // wxUSE_STATUSBAR
249
250 #if wxUSE_MENUS_NATIVE
251
252 void wxFrame::AttachMenuBar(wxMenuBar *menubar)
253 {
254 wxFrameBase::AttachMenuBar(menubar);
255
256 if ( !menubar )
257 {
258 // actually remove the menu from the frame
259 m_hMenu = (WXHMENU)0;
260 InternalSetMenuBar();
261 }
262 else // set new non NULL menu bar
263 {
264 // Can set a menubar several times.
265 if ( menubar->GetHMenu() )
266 {
267 m_hMenu = menubar->GetHMenu();
268 }
269 else // no HMENU yet
270 {
271 m_hMenu = menubar->Create();
272
273 if ( !m_hMenu )
274 {
275 wxFAIL_MSG( _T("failed to create menu bar") );
276 return;
277 }
278 }
279
280 InternalSetMenuBar();
281 }
282 }
283
284 void wxFrame::InternalSetMenuBar()
285 {
286 #ifndef __WXMICROWIN__
287 if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
288 {
289 wxLogLastError(wxT("SetMenu"));
290 }
291 #endif
292 }
293
294 #endif // wxUSE_MENUS_NATIVE
295
296 // Responds to colour changes, and passes event on to children.
297 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
298 {
299 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
300 Refresh();
301
302 #if wxUSE_STATUSBAR
303 if ( m_frameStatusBar )
304 {
305 wxSysColourChangedEvent event2;
306 event2.SetEventObject( m_frameStatusBar );
307 m_frameStatusBar->GetEventHandler()->ProcessEvent(event2);
308 }
309 #endif // wxUSE_STATUSBAR
310
311 // Propagate the event to the non-top-level children
312 wxWindow::OnSysColourChanged(event);
313 }
314
315 // Pass TRUE to show full screen, FALSE to restore.
316 bool wxFrame::ShowFullScreen(bool show, long style)
317 {
318 if ( IsFullScreen() == show )
319 return FALSE;
320
321 if (show)
322 {
323 #if wxUSE_TOOLBAR
324 wxToolBar *theToolBar = GetToolBar();
325 if (theToolBar)
326 theToolBar->GetSize(NULL, &m_fsToolBarHeight);
327
328 // zap the toolbar, menubar, and statusbar
329
330 if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar)
331 {
332 theToolBar->SetSize(-1,0);
333 theToolBar->Show(FALSE);
334 }
335 #endif // wxUSE_TOOLBAR
336
337 #ifndef __WXMICROWIN__
338 if (style & wxFULLSCREEN_NOMENUBAR)
339 SetMenu((HWND)GetHWND(), (HMENU) NULL);
340 #endif
341
342 #if wxUSE_STATUSBAR
343 wxStatusBar *theStatusBar = GetStatusBar();
344 if (theStatusBar)
345 theStatusBar->GetSize(NULL, &m_fsStatusBarHeight);
346
347 // Save the number of fields in the statusbar
348 if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar)
349 {
350 //m_fsStatusBarFields = theStatusBar->GetFieldsCount();
351 //SetStatusBar((wxStatusBar*) NULL);
352 //delete theStatusBar;
353 theStatusBar->Show(FALSE);
354 }
355 else
356 m_fsStatusBarFields = 0;
357 #endif // wxUSE_STATUSBAR
358 }
359 else
360 {
361 #if wxUSE_TOOLBAR
362 wxToolBar *theToolBar = GetToolBar();
363
364 // restore the toolbar, menubar, and statusbar
365 if (theToolBar && (m_fsStyle & wxFULLSCREEN_NOTOOLBAR))
366 {
367 theToolBar->SetSize(-1, m_fsToolBarHeight);
368 theToolBar->Show(TRUE);
369 }
370 #endif // wxUSE_TOOLBAR
371
372 #if wxUSE_STATUSBAR
373 if ( m_fsStyle & wxFULLSCREEN_NOSTATUSBAR )
374 {
375 //CreateStatusBar(m_fsStatusBarFields);
376 if (GetStatusBar())
377 {
378 GetStatusBar()->Show(TRUE);
379 PositionStatusBar();
380 }
381 }
382 #endif // wxUSE_STATUSBAR
383
384 #ifndef __WXMICROWIN__
385 if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0))
386 SetMenu((HWND)GetHWND(), (HMENU)m_hMenu);
387 #endif
388 }
389
390 return wxFrameBase::ShowFullScreen(show, style);
391 }
392
393 // ----------------------------------------------------------------------------
394 // tool/status bar stuff
395 // ----------------------------------------------------------------------------
396
397 #if wxUSE_TOOLBAR
398
399 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
400 {
401 if ( wxFrameBase::CreateToolBar(style, id, name) )
402 {
403 PositionToolBar();
404 }
405
406 return m_frameToolBar;
407 }
408
409 void wxFrame::PositionToolBar()
410 {
411 wxToolBar *toolbar = GetToolBar();
412 if ( toolbar && toolbar->IsShown() )
413 {
414 // don't call our (or even wxTopLevelWindow) version because we want
415 // the real (full) client area size, not excluding the tool/status bar
416 int width, height;
417 wxWindow::DoGetClientSize(&width, &height);
418
419 #if wxUSE_STATUSBAR
420 wxStatusBar *statbar = GetStatusBar();
421 if ( statbar && statbar->IsShown() )
422 {
423 height -= statbar->GetClientSize().y;
424 }
425 #endif // wxUSE_STATUSBAR
426
427 int tw, th;
428 toolbar->GetSize(&tw, &th);
429
430 if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
431 {
432 th = height;
433 }
434 else
435 {
436 tw = width;
437 if ( toolbar->GetWindowStyleFlag() & wxTB_FLAT )
438 th -= 3;
439 }
440
441 // use the 'real' MSW position here, don't offset relativly to the
442 // client area origin
443 toolbar->SetSize(0, 0, tw, th, wxSIZE_NO_ADJUSTMENTS);
444 }
445 }
446
447 #endif // wxUSE_TOOLBAR
448
449 // ----------------------------------------------------------------------------
450 // frame state (iconized/maximized/...)
451 // ----------------------------------------------------------------------------
452
453 // propagate our state change to all child frames: this allows us to emulate X
454 // Windows behaviour where child frames float independently of the parent one
455 // on the desktop, but are iconized/restored with it
456 void wxFrame::IconizeChildFrames(bool bIconize)
457 {
458 for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
459 node;
460 node = node->GetNext() )
461 {
462 wxWindow *win = node->GetData();
463
464 // iconizing the frames with this style under Win95 shell puts them at
465 // the bottom of the screen (as the MDI children) instead of making
466 // them appear in the taskbar because they are, by virtue of this
467 // style, not managed by the taskbar - instead leave Windows take care
468 // of them
469 #ifdef __WIN95__
470 if ( win->GetWindowStyle() & wxFRAME_TOOL_WINDOW )
471 continue;
472 #endif // Win95
473
474 // the child MDI frames are a special case and should not be touched by
475 // the parent frame - instead, they are managed by the user
476 wxFrame *frame = wxDynamicCast(win, wxFrame);
477 if ( frame
478 #if wxUSE_MDI_ARCHITECTURE
479 && !wxDynamicCast(frame, wxMDIChildFrame)
480 #endif // wxUSE_MDI_ARCHITECTURE
481 )
482 {
483 // we don't want to restore the child frames which had been
484 // iconized even before we were iconized, so save the child frame
485 // status when iconizing the parent frame and check it when
486 // restoring it
487 if ( bIconize )
488 {
489 // note that we shouldn't touch the hidden frames neither
490 // because iconizing/restoring them would show them as a side
491 // effect
492 frame->m_wasMinimized = frame->IsIconized() || !frame->IsShown();
493 }
494
495 // this test works for both iconizing and restoring
496 if ( !frame->m_wasMinimized )
497 frame->Iconize(bIconize);
498 }
499 }
500 }
501
502 WXHICON wxFrame::GetDefaultIcon() const
503 {
504 // we don't have any standard icons (any more)
505 return (WXHICON)0;
506 }
507
508 // ===========================================================================
509 // message processing
510 // ===========================================================================
511
512 // ---------------------------------------------------------------------------
513 // preprocessing
514 // ---------------------------------------------------------------------------
515
516 bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
517 {
518 if ( wxWindow::MSWTranslateMessage(pMsg) )
519 return TRUE;
520
521 #if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
522 // try the menu bar accels
523 wxMenuBar *menuBar = GetMenuBar();
524 if ( !menuBar )
525 return FALSE;
526
527 const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
528 return acceleratorTable.Translate(this, pMsg);
529 #else
530 return FALSE;
531 #endif // wxUSE_MENUS && wxUSE_ACCEL
532 }
533
534 // ---------------------------------------------------------------------------
535 // our private (non virtual) message handlers
536 // ---------------------------------------------------------------------------
537
538 bool wxFrame::HandlePaint()
539 {
540 RECT rect;
541 if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
542 {
543 #ifndef __WXMICROWIN__
544 if ( m_iconized )
545 {
546 const wxIcon& icon = GetIcon();
547 HICON hIcon = icon.Ok() ? GetHiconOf(icon)
548 : (HICON)GetDefaultIcon();
549
550 // Hold a pointer to the dc so long as the OnPaint() message
551 // is being processed
552 PAINTSTRUCT ps;
553 HDC hdc = ::BeginPaint(GetHwnd(), &ps);
554
555 // Erase background before painting or we get white background
556 MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L);
557
558 if ( hIcon )
559 {
560 RECT rect;
561 ::GetClientRect(GetHwnd(), &rect);
562
563 // FIXME: why hardcoded?
564 static const int icon_width = 32;
565 static const int icon_height = 32;
566
567 int icon_x = (int)((rect.right - icon_width)/2);
568 int icon_y = (int)((rect.bottom - icon_height)/2);
569
570 ::DrawIcon(hdc, icon_x, icon_y, hIcon);
571 }
572
573 ::EndPaint(GetHwnd(), &ps);
574
575 return TRUE;
576 }
577 else
578 #endif
579 {
580 return wxWindow::HandlePaint();
581 }
582 }
583 else
584 {
585 // nothing to paint - processed
586 return TRUE;
587 }
588 }
589
590 bool wxFrame::HandleSize(int x, int y, WXUINT id)
591 {
592 bool processed = FALSE;
593 #ifndef __WXMICROWIN__
594
595 switch ( id )
596 {
597 case SIZENORMAL:
598 // only do it it if we were iconized before, otherwise resizing the
599 // parent frame has a curious side effect of bringing it under it's
600 // children
601 if ( !m_iconized )
602 break;
603
604 // restore all child frames too
605 IconizeChildFrames(FALSE);
606
607 (void)SendIconizeEvent(FALSE);
608
609 // fall through
610
611 case SIZEFULLSCREEN:
612 m_iconized = FALSE;
613 break;
614
615 case SIZEICONIC:
616 // iconize all child frames too
617 IconizeChildFrames(TRUE);
618
619 (void)SendIconizeEvent();
620
621 m_iconized = TRUE;
622 break;
623 }
624 #endif
625
626 if ( !m_iconized )
627 {
628 #if wxUSE_STATUSBAR
629 PositionStatusBar();
630 #endif // wxUSE_STATUSBAR
631
632 #if wxUSE_TOOLBAR
633 PositionToolBar();
634 #endif // wxUSE_TOOLBAR
635
636 processed = wxWindow::HandleSize(x, y, id);
637 }
638
639 return processed;
640 }
641
642 bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
643 {
644 if ( control )
645 {
646 // In case it's e.g. a toolbar.
647 wxWindow *win = wxFindWinFromHandle(control);
648 if ( win )
649 return win->MSWCommand(cmd, id);
650 }
651
652 // handle here commands from menus and accelerators
653 if ( cmd == 0 || cmd == 1 )
654 {
655 #if wxUSE_MENUS_NATIVE
656 if ( wxCurrentPopupMenu )
657 {
658 wxMenu *popupMenu = wxCurrentPopupMenu;
659 wxCurrentPopupMenu = NULL;
660
661 return popupMenu->MSWCommand(cmd, id);
662 }
663 #endif // wxUSE_MENUS_NATIVE
664
665 if ( ProcessCommand(id) )
666 {
667 return TRUE;
668 }
669 }
670
671 return FALSE;
672 }
673
674 bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
675 {
676 int item;
677 if ( flags == 0xFFFF && hMenu == 0 )
678 {
679 // menu was removed from screen
680 item = -1;
681 }
682 #ifndef __WXMICROWIN__
683 else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) )
684 {
685 item = nItem;
686 }
687 #endif
688 else
689 {
690 // don't give hints for separators (doesn't make sense) nor for the
691 // items opening popup menus (they don't have them anyhow) but do clear
692 // the status line - otherwise, we would be left with the help message
693 // for the previous item which doesn't apply any more
694 DoGiveHelp(wxEmptyString, FALSE);
695
696 return FALSE;
697 }
698
699 wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
700 event.SetEventObject(this);
701
702 return GetEventHandler()->ProcessEvent(event);
703 }
704
705 bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup)
706 {
707 // we don't have the menu id here, so we use the id to specify if the event
708 // was from a popup menu or a normal one
709 wxMenuEvent event(evtType, isPopup ? -1 : 0);
710 event.SetEventObject(this);
711
712 return GetEventHandler()->ProcessEvent(event);
713 }
714
715 // ---------------------------------------------------------------------------
716 // the window proc for wxFrame
717 // ---------------------------------------------------------------------------
718
719 long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
720 {
721 long rc = 0;
722 bool processed = FALSE;
723
724 switch ( message )
725 {
726 case WM_CLOSE:
727 // if we can't close, tell the system that we processed the
728 // message - otherwise it would close us
729 processed = !Close();
730 break;
731
732 case WM_SIZE:
733 processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
734 break;
735
736 case WM_COMMAND:
737 {
738 WORD id, cmd;
739 WXHWND hwnd;
740 UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam,
741 &id, &hwnd, &cmd);
742
743 processed = HandleCommand(id, cmd, (WXHWND)hwnd);
744 }
745 break;
746
747 case WM_PAINT:
748 processed = HandlePaint();
749 break;
750
751 #ifndef __WXMICROWIN__
752 case WM_MENUSELECT:
753 {
754 WXWORD item, flags;
755 WXHMENU hmenu;
756 UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
757
758 processed = HandleMenuSelect(item, flags, hmenu);
759 }
760 break;
761
762 case WM_INITMENU:
763 processed = HandleInitMenu();
764 break;
765
766 case WM_EXITMENULOOP:
767 processed = HandleMenuLoop(wxEVT_MENU_CLOSE, wParam);
768 break;
769
770 case WM_QUERYDRAGICON:
771 {
772 const wxIcon& icon = GetIcon();
773 HICON hIcon = icon.Ok() ? GetHiconOf(icon)
774 : (HICON)GetDefaultIcon();
775 rc = (long)hIcon;
776 processed = rc != 0;
777 }
778 break;
779 #endif // !__WXMICROWIN__
780 }
781
782 if ( !processed )
783 rc = wxFrameBase::MSWWindowProc(message, wParam, lParam);
784
785 return rc;
786 }
787
788 // handle WM_INITMENU message
789 bool wxFrame::HandleInitMenu()
790 {
791 wxMenuEvent event(wxEVT_MENU_OPEN, 0);
792 event.SetEventObject(this);
793
794 return GetEventHandler()->ProcessEvent(event);
795 }
796
797