]> git.saurik.com Git - wxWidgets.git/blob - src/common/wincmn.cpp
changed version number
[wxWidgets.git] / src / common / wincmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/window.cpp
3 // Purpose: common (to all ports) wxWindow functions
4 // Author: Julian Smart, Vadim Zeitlin
5 // Modified by:
6 // Created: 13/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "windowbase.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/string.h"
33 #include "wx/log.h"
34 #include "wx/intl.h"
35 #include "wx/frame.h"
36 #include "wx/defs.h"
37 #include "wx/window.h"
38 #include "wx/checkbox.h"
39 #include "wx/radiobut.h"
40 #include "wx/textctrl.h"
41 #include "wx/settings.h"
42 #include "wx/dialog.h"
43 #include "wx/msgdlg.h"
44 #include "wx/statusbr.h"
45 #endif //WX_PRECOMP
46
47 #if wxUSE_CONSTRAINTS
48 #include "wx/layout.h"
49 #include "wx/sizer.h"
50 #endif // wxUSE_CONSTRAINTS
51
52 #if wxUSE_DRAG_AND_DROP
53 #include "wx/dnd.h"
54 #endif // wxUSE_DRAG_AND_DROP
55
56 #if wxUSE_HELP
57 #include "wx/cshelp.h"
58 #endif // wxUSE_HELP
59
60 #if wxUSE_TOOLTIPS
61 #include "wx/tooltip.h"
62 #endif // wxUSE_TOOLTIPS
63
64 #if wxUSE_CARET
65 #include "wx/caret.h"
66 #endif // wxUSE_CARET
67
68 // ----------------------------------------------------------------------------
69 // static data
70 // ----------------------------------------------------------------------------
71
72 int wxWindowBase::ms_lastControlId = -200;
73
74 IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
75
76 // ----------------------------------------------------------------------------
77 // event table
78 // ----------------------------------------------------------------------------
79
80 BEGIN_EVENT_TABLE(wxWindowBase, wxEvtHandler)
81 EVT_SYS_COLOUR_CHANGED(wxWindowBase::OnSysColourChanged)
82 EVT_INIT_DIALOG(wxWindowBase::OnInitDialog)
83 EVT_MIDDLE_DOWN(wxWindowBase::OnMiddleClick)
84
85 #if wxUSE_HELP
86 EVT_HELP(-1, wxWindowBase::OnHelp)
87 #endif // wxUSE_HELP
88
89 END_EVENT_TABLE()
90
91 // ============================================================================
92 // implementation of the common functionality of the wxWindow class
93 // ============================================================================
94
95 // ----------------------------------------------------------------------------
96 // initialization
97 // ----------------------------------------------------------------------------
98
99 // the default initialization
100 void wxWindowBase::InitBase()
101 {
102 // no window yet, no parent nor children
103 m_parent = (wxWindow *)NULL;
104 m_windowId = -1;
105 m_children.DeleteContents( FALSE ); // don't auto delete node data
106
107 // no constraints on the minimal window size
108 m_minWidth =
109 m_minHeight =
110 m_maxWidth =
111 m_maxHeight = -1;
112
113 // window is created enabled but it's not visible yet
114 m_isShown = FALSE;
115 m_isEnabled = TRUE;
116
117 // no client data (yet)
118 m_clientData = NULL;
119 m_clientDataType = ClientData_None;
120
121 // the default event handler is just this window
122 m_eventHandler = this;
123
124 #if wxUSE_VALIDATORS
125 // no validator
126 m_windowValidator = (wxValidator *) NULL;
127 #endif // wxUSE_VALIDATORS
128
129 // use the system default colours
130 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE);
131 m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOWTEXT);
132
133 // don't set the font here for wxMSW as we don't call WM_SETFONT here and
134 // so the font is *not* really set - but calls to SetFont() later won't do
135 // anything because m_font appears to be already set!
136 #ifndef __WXMSW__
137 m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
138 #endif // __WXMSW__
139
140 // no style bits
141 m_exStyle =
142 m_windowStyle = 0;
143
144 // an optimization for the event processing: checking this flag is much
145 // faster than using IsKindOf(CLASSINFO(wxWindow))
146 m_isWindow = TRUE;
147
148 #if wxUSE_CONSTRAINTS
149 // no constraints whatsoever
150 m_constraints = (wxLayoutConstraints *) NULL;
151 m_constraintsInvolvedIn = (wxWindowList *) NULL;
152 m_windowSizer = (wxSizer *) NULL;
153 m_autoLayout = FALSE;
154 #endif // wxUSE_CONSTRAINTS
155
156 #if wxUSE_DRAG_AND_DROP
157 m_dropTarget = (wxDropTarget *)NULL;
158 #endif // wxUSE_DRAG_AND_DROP
159
160 #if wxUSE_TOOLTIPS
161 m_tooltip = (wxToolTip *)NULL;
162 #endif // wxUSE_TOOLTIPS
163
164 #if wxUSE_CARET
165 m_caret = (wxCaret *)NULL;
166 #endif // wxUSE_CARET
167
168 // Whether we're using the current theme for this window (wxGTK only for now)
169 m_themeEnabled = FALSE;
170 }
171
172 // common part of window creation process
173 bool wxWindowBase::CreateBase(wxWindowBase *parent,
174 wxWindowID id,
175 const wxPoint& WXUNUSED(pos),
176 const wxSize& WXUNUSED(size),
177 long style,
178 const wxValidator& validator,
179 const wxString& name)
180 {
181 // m_isWindow is set to TRUE in wxWindowBase::Init() as well as many other
182 // member variables - check that it has been called (will catch the case
183 // when a new ctor is added which doesn't call InitWindow)
184 wxASSERT_MSG( m_isWindow, wxT("Init() must have been called before!") );
185
186 // generate a new id if the user doesn't care about it
187 m_windowId = id == -1 ? NewControlId() : id;
188
189 SetName(name);
190 SetWindowStyleFlag(style);
191 SetParent(parent);
192
193 #if wxUSE_VALIDATORS
194 SetValidator(validator);
195 #endif // wxUSE_VALIDATORS
196
197 // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to
198 // have it too - like this it's possible to set it only in the top level
199 // dialog/frame and all children will inherit it by defult
200 if ( parent && (parent->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) )
201 {
202 SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
203 }
204
205 return TRUE;
206 }
207
208 // ----------------------------------------------------------------------------
209 // destruction
210 // ----------------------------------------------------------------------------
211
212 // common clean up
213 wxWindowBase::~wxWindowBase()
214 {
215 // FIXME if these 2 cases result from programming errors in the user code
216 // we should probably assert here instead of silently fixing them
217
218 // Just in case the window has been Closed, but we're then deleting
219 // immediately: don't leave dangling pointers.
220 wxPendingDelete.DeleteObject(this);
221
222 // Just in case we've loaded a top-level window via LoadNativeDialog but
223 // we weren't a dialog class
224 wxTopLevelWindows.DeleteObject(this);
225
226 wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
227
228 // make sure that there are no dangling pointers left pointing to us
229 wxPanel *panel = wxDynamicCast(GetParent(), wxPanel);
230 if ( panel )
231 {
232 if ( panel->GetLastFocus() == this )
233 {
234 panel->SetLastFocus((wxWindow *)NULL);
235 }
236 }
237
238 #if wxUSE_CARET
239 if ( m_caret )
240 delete m_caret;
241 #endif // wxUSE_CARET
242
243 #if wxUSE_VALIDATORS
244 if ( m_windowValidator )
245 delete m_windowValidator;
246 #endif // wxUSE_VALIDATORS
247
248 // we only delete object data, not untyped
249 if ( m_clientDataType == ClientData_Object )
250 delete m_clientObject;
251
252 #if wxUSE_CONSTRAINTS
253 // Have to delete constraints/sizer FIRST otherwise sizers may try to look
254 // at deleted windows as they delete themselves.
255 DeleteRelatedConstraints();
256
257 if ( m_constraints )
258 {
259 // This removes any dangling pointers to this window in other windows'
260 // constraintsInvolvedIn lists.
261 UnsetConstraints(m_constraints);
262 delete m_constraints;
263 m_constraints = NULL;
264 }
265
266 if ( m_windowSizer )
267 delete m_windowSizer;
268
269 #endif // wxUSE_CONSTRAINTS
270
271 #if wxUSE_DRAG_AND_DROP
272 if ( m_dropTarget )
273 delete m_dropTarget;
274 #endif // wxUSE_DRAG_AND_DROP
275
276 #if wxUSE_TOOLTIPS
277 if ( m_tooltip )
278 delete m_tooltip;
279 #endif // wxUSE_TOOLTIPS
280 }
281
282 bool wxWindowBase::Destroy()
283 {
284 delete this;
285
286 return TRUE;
287 }
288
289 bool wxWindowBase::Close(bool force)
290 {
291 wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
292 event.SetEventObject(this);
293 #if WXWIN_COMPATIBILITY
294 event.SetForce(force);
295 #endif // WXWIN_COMPATIBILITY
296 event.SetCanVeto(!force);
297
298 // return FALSE if window wasn't closed because the application vetoed the
299 // close event
300 return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
301 }
302
303 bool wxWindowBase::DestroyChildren()
304 {
305 wxWindowList::Node *node;
306 for ( ;; )
307 {
308 // we iterate until the list becomes empty
309 node = GetChildren().GetFirst();
310 if ( !node )
311 break;
312
313 wxWindow *child = node->GetData();
314
315 wxASSERT_MSG( child, wxT("children list contains empty nodes") );
316
317 delete child;
318
319 wxASSERT_MSG( !GetChildren().Find(child),
320 wxT("child didn't remove itself using RemoveChild()") );
321 }
322
323 return TRUE;
324 }
325
326 // ----------------------------------------------------------------------------
327 // size/position related methods
328 // ----------------------------------------------------------------------------
329
330 // centre the window with respect to its parent in either (or both) directions
331 void wxWindowBase::Centre(int direction)
332 {
333 // the position/size of the parent window or of the entire screen
334 wxPoint posParent;
335 int widthParent, heightParent;
336
337 wxWindow *parent = NULL;
338
339 if ( !(direction & wxCENTRE_ON_SCREEN) )
340 {
341 // find the parent to centre this window on: it should be the
342 // immediate parent for the controls but the top level parent for the
343 // top level windows (like dialogs)
344 parent = GetParent();
345 if ( IsTopLevel() )
346 {
347 while ( parent && !parent->IsTopLevel() )
348 {
349 parent = parent->GetParent();
350 }
351 }
352
353 // did we find the parent?
354 if ( !parent )
355 {
356 // no other choice
357 direction |= wxCENTRE_ON_SCREEN;
358 }
359 }
360
361 if ( direction & wxCENTRE_ON_SCREEN )
362 {
363 // centre with respect to the whole screen
364 wxDisplaySize(&widthParent, &heightParent);
365 }
366 else
367 {
368 if ( IsTopLevel() )
369 {
370 // centre on the parent
371 parent->GetSize(&widthParent, &heightParent);
372
373 // adjust to the parents position
374 posParent = parent->GetPosition();
375 }
376 else
377 {
378 // centre inside the parents client rectangle
379 parent->GetClientSize(&widthParent, &heightParent);
380 }
381 }
382
383 int width, height;
384 GetSize(&width, &height);
385
386 int xNew = -1,
387 yNew = -1;
388
389 if ( direction & wxHORIZONTAL )
390 xNew = (widthParent - width)/2;
391
392 if ( direction & wxVERTICAL )
393 yNew = (heightParent - height)/2;
394
395 xNew += posParent.x;
396 yNew += posParent.y;
397
398 // Base size of the visible dimensions of the display
399 // to take into account the taskbar
400 wxRect rect = wxGetClientDisplayRect();
401 wxSize size (rect.width,rect.height);
402
403 if (posParent.x >= 0) // if parent is on the main display
404 {
405 if (xNew < 0)
406 xNew = 0;
407 else if (xNew+width > size.x)
408 xNew = size.x-width-1;
409 }
410 if (posParent.y >= 0) // if parent is on the main display
411 {
412 if (yNew+height > size.y)
413 yNew = size.y-height-1;
414
415 // Make certain that the title bar is initially visible
416 // always, even if this would push the bottom of the
417 // dialog of the visible area of the display
418 if (yNew < 0)
419 yNew = 0;
420 }
421
422 // move the window to this position (keeping the old size but using
423 // SetSize() and not Move() to allow xNew and/or yNew to be -1)
424 SetSize(xNew, yNew, width, height, wxSIZE_ALLOW_MINUS_ONE);
425 }
426
427 // fits the window around the children
428 void wxWindowBase::Fit()
429 {
430 if ( GetChildren().GetCount() > 0 )
431 {
432 wxSize size = DoGetBestSize();
433
434 // for compatibility with the old versions and because it really looks
435 // slightly more pretty like this, add a pad
436 size.x += 7;
437 size.y += 14;
438
439 SetClientSize(size);
440 }
441 //else: do nothing if we have no children
442 }
443
444 // return the size best suited for the current window
445 wxSize wxWindowBase::DoGetBestSize() const
446 {
447 if ( GetChildren().GetCount() > 0 )
448 {
449 // our minimal acceptable size is such that all our windows fit inside
450 int maxX = 0,
451 maxY = 0;
452
453 for ( wxWindowList::Node *node = GetChildren().GetFirst();
454 node;
455 node = node->GetNext() )
456 {
457 wxWindow *win = node->GetData();
458 if ( win->IsTopLevel() || wxDynamicCast(win, wxStatusBar) || !win->IsShown())
459 {
460 // dialogs and frames lie in different top level windows -
461 // don't deal with them here; as for the status bars, they
462 // don't lie in the client area at all
463 continue;
464 }
465
466 int wx, wy, ww, wh;
467 win->GetPosition(&wx, &wy);
468
469 // if the window hadn't been positioned yet, assume that it is in
470 // the origin
471 if ( wx == -1 )
472 wx = 0;
473 if ( wy == -1 )
474 wy = 0;
475
476 win->GetSize(&ww, &wh);
477 if ( wx + ww > maxX )
478 maxX = wx + ww;
479 if ( wy + wh > maxY )
480 maxY = wy + wh;
481 }
482
483 return wxSize(maxX, maxY);
484 }
485 else
486 {
487 // for a generic window there is no natural best size - just use the
488 // current one
489 return GetSize();
490 }
491 }
492
493 // set the min/max size of the window
494 void wxWindowBase::SetSizeHints(int minW, int minH,
495 int maxW, int maxH,
496 int WXUNUSED(incW), int WXUNUSED(incH))
497 {
498 m_minWidth = minW;
499 m_maxWidth = maxW;
500 m_minHeight = minH;
501 m_maxHeight = maxH;
502 }
503
504 // ----------------------------------------------------------------------------
505 // show/hide/enable/disable the window
506 // ----------------------------------------------------------------------------
507
508 bool wxWindowBase::Show(bool show)
509 {
510 if ( show != m_isShown )
511 {
512 m_isShown = show;
513
514 return TRUE;
515 }
516 else
517 {
518 return FALSE;
519 }
520 }
521
522 bool wxWindowBase::Enable(bool enable)
523 {
524 if ( enable != m_isEnabled )
525 {
526 m_isEnabled = enable;
527
528 return TRUE;
529 }
530 else
531 {
532 return FALSE;
533 }
534 }
535 // ----------------------------------------------------------------------------
536 // RTTI
537 // ----------------------------------------------------------------------------
538
539 bool wxWindowBase::IsTopLevel() const
540 {
541 return FALSE;
542 }
543
544 // ----------------------------------------------------------------------------
545 // reparenting the window
546 // ----------------------------------------------------------------------------
547
548 void wxWindowBase::AddChild(wxWindowBase *child)
549 {
550 wxCHECK_RET( child, wxT("can't add a NULL child") );
551
552 // this should never happen and it will lead to a crash later if it does
553 // because RemoveChild() will remove only one node from the children list
554 // and the other(s) one(s) will be left with dangling pointers in them
555 wxASSERT_MSG( !GetChildren().Find(child), _T("AddChild() called twice") );
556
557 GetChildren().Append(child);
558 child->SetParent(this);
559 }
560
561 void wxWindowBase::RemoveChild(wxWindowBase *child)
562 {
563 wxCHECK_RET( child, wxT("can't remove a NULL child") );
564
565 GetChildren().DeleteObject(child);
566 child->SetParent((wxWindow *)NULL);
567 }
568
569 bool wxWindowBase::Reparent(wxWindowBase *newParent)
570 {
571 wxWindow *oldParent = GetParent();
572 if ( newParent == oldParent )
573 {
574 // nothing done
575 return FALSE;
576 }
577
578 // unlink this window from the existing parent.
579 if ( oldParent )
580 {
581 oldParent->RemoveChild(this);
582 }
583 else
584 {
585 wxTopLevelWindows.DeleteObject(this);
586 }
587
588 // add it to the new one
589 if ( newParent )
590 {
591 newParent->AddChild(this);
592 }
593 else
594 {
595 wxTopLevelWindows.Append(this);
596 }
597
598 return TRUE;
599 }
600
601 // ----------------------------------------------------------------------------
602 // event handler stuff
603 // ----------------------------------------------------------------------------
604
605 void wxWindowBase::PushEventHandler(wxEvtHandler *handler)
606 {
607 handler->SetNextHandler(GetEventHandler());
608 SetEventHandler(handler);
609 }
610
611 wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler)
612 {
613 wxEvtHandler *handlerA = GetEventHandler();
614 if ( handlerA )
615 {
616 wxEvtHandler *handlerB = handlerA->GetNextHandler();
617 handlerA->SetNextHandler((wxEvtHandler *)NULL);
618 SetEventHandler(handlerB);
619 if ( deleteHandler )
620 {
621 delete handlerA;
622 handlerA = (wxEvtHandler *)NULL;
623 }
624 }
625
626 return handlerA;
627 }
628
629 // ----------------------------------------------------------------------------
630 // cursors, fonts &c
631 // ----------------------------------------------------------------------------
632
633 bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
634 {
635 if ( !colour.Ok() || (colour == m_backgroundColour) )
636 return FALSE;
637
638 m_backgroundColour = colour;
639
640 return TRUE;
641 }
642
643 bool wxWindowBase::SetForegroundColour( const wxColour &colour )
644 {
645 if ( !colour.Ok() || (colour == m_foregroundColour) )
646 return FALSE;
647
648 m_foregroundColour = colour;
649
650 return TRUE;
651 }
652
653 bool wxWindowBase::SetCursor(const wxCursor& cursor)
654 {
655 // setting an invalid cursor is ok, it means that we don't have any special
656 // cursor
657 if ( m_cursor == cursor )
658 {
659 // no change
660 return FALSE;
661 }
662
663 m_cursor = cursor;
664
665 return TRUE;
666 }
667
668 bool wxWindowBase::SetFont(const wxFont& font)
669 {
670 // don't try to set invalid font, always fall back to the default
671 const wxFont& fontOk = font.Ok() ? font : *wxSWISS_FONT;
672
673 if ( fontOk == m_font )
674 {
675 // no change
676 return FALSE;
677 }
678
679 m_font = fontOk;
680
681 return TRUE;
682 }
683
684 #if wxUSE_CARET
685 void wxWindowBase::SetCaret(wxCaret *caret)
686 {
687 if ( m_caret )
688 {
689 delete m_caret;
690 }
691
692 m_caret = caret;
693
694 if ( m_caret )
695 {
696 wxASSERT_MSG( m_caret->GetWindow() == this,
697 wxT("caret should be created associated to this window") );
698 }
699 }
700 #endif // wxUSE_CARET
701
702 #if wxUSE_VALIDATORS
703 // ----------------------------------------------------------------------------
704 // validators
705 // ----------------------------------------------------------------------------
706
707 void wxWindowBase::SetValidator(const wxValidator& validator)
708 {
709 if ( m_windowValidator )
710 delete m_windowValidator;
711
712 m_windowValidator = (wxValidator *)validator.Clone();
713
714 if ( m_windowValidator )
715 m_windowValidator->SetWindow(this) ;
716 }
717 #endif // wxUSE_VALIDATORS
718
719 // ----------------------------------------------------------------------------
720 // update region testing
721 // ----------------------------------------------------------------------------
722
723 bool wxWindowBase::IsExposed(int x, int y) const
724 {
725 return m_updateRegion.Contains(x, y) != wxOutRegion;
726 }
727
728 bool wxWindowBase::IsExposed(int x, int y, int w, int h) const
729 {
730 return m_updateRegion.Contains(x, y, w, h) != wxOutRegion;
731 }
732
733 // ----------------------------------------------------------------------------
734 // find window by id or name
735 // ----------------------------------------------------------------------------
736
737 wxWindow *wxWindowBase::FindWindow( long id )
738 {
739 if ( id == m_windowId )
740 return (wxWindow *)this;
741
742 wxWindowBase *res = (wxWindow *)NULL;
743 wxWindowList::Node *node;
744 for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
745 {
746 wxWindowBase *child = node->GetData();
747 res = child->FindWindow( id );
748 }
749
750 return (wxWindow *)res;
751 }
752
753 wxWindow *wxWindowBase::FindWindow( const wxString& name )
754 {
755 if ( name == m_windowName )
756 return (wxWindow *)this;
757
758 wxWindowBase *res = (wxWindow *)NULL;
759 wxWindowList::Node *node;
760 for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
761 {
762 wxWindow *child = node->GetData();
763 res = child->FindWindow(name);
764 }
765
766 return (wxWindow *)res;
767 }
768
769 // ----------------------------------------------------------------------------
770 // dialog oriented functions
771 // ----------------------------------------------------------------------------
772
773 void wxWindowBase::MakeModal(bool modal)
774 {
775 // Disable all other windows
776 if ( IsTopLevel() )
777 {
778 wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
779 while (node)
780 {
781 wxWindow *win = node->GetData();
782 if (win != this)
783 win->Enable(!modal);
784
785 node = node->GetNext();
786 }
787 }
788 }
789
790 bool wxWindowBase::Validate()
791 {
792 #if wxUSE_VALIDATORS
793 bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
794
795 wxWindowList::Node *node;
796 for ( node = m_children.GetFirst(); node; node = node->GetNext() )
797 {
798 wxWindowBase *child = node->GetData();
799 wxValidator *validator = child->GetValidator();
800 if ( validator && !validator->Validate((wxWindow *)this) )
801 {
802 return FALSE;
803 }
804
805 if ( recurse && !child->Validate() )
806 {
807 return FALSE;
808 }
809 }
810 #endif // wxUSE_VALIDATORS
811
812 return TRUE;
813 }
814
815 bool wxWindowBase::TransferDataToWindow()
816 {
817 #if wxUSE_VALIDATORS
818 bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
819
820 wxWindowList::Node *node;
821 for ( node = m_children.GetFirst(); node; node = node->GetNext() )
822 {
823 wxWindowBase *child = node->GetData();
824 wxValidator *validator = child->GetValidator();
825 if ( validator && !validator->TransferToWindow() )
826 {
827 wxLogWarning(_("Could not transfer data to window"));
828 wxLog::FlushActive();
829
830 return FALSE;
831 }
832
833 if ( recurse )
834 {
835 if ( !child->TransferDataToWindow() )
836 {
837 // warning already given
838 return FALSE;
839 }
840 }
841 }
842 #endif // wxUSE_VALIDATORS
843
844 return TRUE;
845 }
846
847 bool wxWindowBase::TransferDataFromWindow()
848 {
849 #if wxUSE_VALIDATORS
850 bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
851
852 wxWindowList::Node *node;
853 for ( node = m_children.GetFirst(); node; node = node->GetNext() )
854 {
855 wxWindow *child = node->GetData();
856 wxValidator *validator = child->GetValidator();
857 if ( validator && !validator->TransferFromWindow() )
858 {
859 // nop warning here because the application is supposed to give
860 // one itself - we don't know here what might have gone wrongly
861
862 return FALSE;
863 }
864
865 if ( recurse )
866 {
867 if ( !child->TransferDataFromWindow() )
868 {
869 // warning already given
870 return FALSE;
871 }
872 }
873 }
874 #endif // wxUSE_VALIDATORS
875
876 return TRUE;
877 }
878
879 void wxWindowBase::InitDialog()
880 {
881 wxInitDialogEvent event(GetId());
882 event.SetEventObject( this );
883 GetEventHandler()->ProcessEvent(event);
884 }
885
886 // ----------------------------------------------------------------------------
887 // context-sensitive help support
888 // ----------------------------------------------------------------------------
889
890 #if wxUSE_HELP
891
892 // associate this help text with this window
893 void wxWindowBase::SetHelpText(const wxString& text)
894 {
895 wxHelpProvider *helpProvider = wxHelpProvider::Get();
896 if ( helpProvider )
897 {
898 helpProvider->AddHelp(this, text);
899 }
900 }
901
902 // associate this help text with all windows with the same id as this
903 // one
904 void wxWindowBase::SetHelpTextForId(const wxString& text)
905 {
906 wxHelpProvider *helpProvider = wxHelpProvider::Get();
907 if ( helpProvider )
908 {
909 helpProvider->AddHelp(GetId(), text);
910 }
911 }
912
913 // get the help string associated with this window (may be empty)
914 wxString wxWindowBase::GetHelpText() const
915 {
916 wxString text;
917 wxHelpProvider *helpProvider = wxHelpProvider::Get();
918 if ( helpProvider )
919 {
920 text = helpProvider->GetHelp(this);
921 }
922
923 return text;
924 }
925
926 // show help for this window
927 void wxWindowBase::OnHelp(wxHelpEvent& event)
928 {
929 wxHelpProvider *helpProvider = wxHelpProvider::Get();
930 if ( helpProvider )
931 {
932 if ( helpProvider->ShowHelp(this) )
933 {
934 // skip the event.Skip() below
935 return;
936 }
937 }
938
939 event.Skip();
940 }
941
942 #endif // wxUSE_HELP
943
944 // ----------------------------------------------------------------------------
945 // tooltips
946 // ----------------------------------------------------------------------------
947
948 #if wxUSE_TOOLTIPS
949
950 void wxWindowBase::SetToolTip( const wxString &tip )
951 {
952 // don't create the new tooltip if we already have one
953 if ( m_tooltip )
954 {
955 m_tooltip->SetTip( tip );
956 }
957 else
958 {
959 SetToolTip( new wxToolTip( tip ) );
960 }
961
962 // setting empty tooltip text does not remove the tooltip any more - use
963 // SetToolTip((wxToolTip *)NULL) for this
964 }
965
966 void wxWindowBase::DoSetToolTip(wxToolTip *tooltip)
967 {
968 if ( m_tooltip )
969 delete m_tooltip;
970
971 m_tooltip = tooltip;
972 }
973
974 #endif // wxUSE_TOOLTIPS
975
976 // ----------------------------------------------------------------------------
977 // constraints and sizers
978 // ----------------------------------------------------------------------------
979
980 #if wxUSE_CONSTRAINTS
981
982 void wxWindowBase::SetConstraints( wxLayoutConstraints *constraints )
983 {
984 if ( m_constraints )
985 {
986 UnsetConstraints(m_constraints);
987 delete m_constraints;
988 }
989 m_constraints = constraints;
990 if ( m_constraints )
991 {
992 // Make sure other windows know they're part of a 'meaningful relationship'
993 if ( m_constraints->left.GetOtherWindow() && (m_constraints->left.GetOtherWindow() != this) )
994 m_constraints->left.GetOtherWindow()->AddConstraintReference(this);
995 if ( m_constraints->top.GetOtherWindow() && (m_constraints->top.GetOtherWindow() != this) )
996 m_constraints->top.GetOtherWindow()->AddConstraintReference(this);
997 if ( m_constraints->right.GetOtherWindow() && (m_constraints->right.GetOtherWindow() != this) )
998 m_constraints->right.GetOtherWindow()->AddConstraintReference(this);
999 if ( m_constraints->bottom.GetOtherWindow() && (m_constraints->bottom.GetOtherWindow() != this) )
1000 m_constraints->bottom.GetOtherWindow()->AddConstraintReference(this);
1001 if ( m_constraints->width.GetOtherWindow() && (m_constraints->width.GetOtherWindow() != this) )
1002 m_constraints->width.GetOtherWindow()->AddConstraintReference(this);
1003 if ( m_constraints->height.GetOtherWindow() && (m_constraints->height.GetOtherWindow() != this) )
1004 m_constraints->height.GetOtherWindow()->AddConstraintReference(this);
1005 if ( m_constraints->centreX.GetOtherWindow() && (m_constraints->centreX.GetOtherWindow() != this) )
1006 m_constraints->centreX.GetOtherWindow()->AddConstraintReference(this);
1007 if ( m_constraints->centreY.GetOtherWindow() && (m_constraints->centreY.GetOtherWindow() != this) )
1008 m_constraints->centreY.GetOtherWindow()->AddConstraintReference(this);
1009 }
1010 }
1011
1012 // This removes any dangling pointers to this window in other windows'
1013 // constraintsInvolvedIn lists.
1014 void wxWindowBase::UnsetConstraints(wxLayoutConstraints *c)
1015 {
1016 if ( c )
1017 {
1018 if ( c->left.GetOtherWindow() && (c->top.GetOtherWindow() != this) )
1019 c->left.GetOtherWindow()->RemoveConstraintReference(this);
1020 if ( c->top.GetOtherWindow() && (c->top.GetOtherWindow() != this) )
1021 c->top.GetOtherWindow()->RemoveConstraintReference(this);
1022 if ( c->right.GetOtherWindow() && (c->right.GetOtherWindow() != this) )
1023 c->right.GetOtherWindow()->RemoveConstraintReference(this);
1024 if ( c->bottom.GetOtherWindow() && (c->bottom.GetOtherWindow() != this) )
1025 c->bottom.GetOtherWindow()->RemoveConstraintReference(this);
1026 if ( c->width.GetOtherWindow() && (c->width.GetOtherWindow() != this) )
1027 c->width.GetOtherWindow()->RemoveConstraintReference(this);
1028 if ( c->height.GetOtherWindow() && (c->height.GetOtherWindow() != this) )
1029 c->height.GetOtherWindow()->RemoveConstraintReference(this);
1030 if ( c->centreX.GetOtherWindow() && (c->centreX.GetOtherWindow() != this) )
1031 c->centreX.GetOtherWindow()->RemoveConstraintReference(this);
1032 if ( c->centreY.GetOtherWindow() && (c->centreY.GetOtherWindow() != this) )
1033 c->centreY.GetOtherWindow()->RemoveConstraintReference(this);
1034 }
1035 }
1036
1037 // Back-pointer to other windows we're involved with, so if we delete this
1038 // window, we must delete any constraints we're involved with.
1039 void wxWindowBase::AddConstraintReference(wxWindowBase *otherWin)
1040 {
1041 if ( !m_constraintsInvolvedIn )
1042 m_constraintsInvolvedIn = new wxWindowList;
1043 if ( !m_constraintsInvolvedIn->Find(otherWin) )
1044 m_constraintsInvolvedIn->Append(otherWin);
1045 }
1046
1047 // REMOVE back-pointer to other windows we're involved with.
1048 void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin)
1049 {
1050 if ( m_constraintsInvolvedIn )
1051 m_constraintsInvolvedIn->DeleteObject(otherWin);
1052 }
1053
1054 // Reset any constraints that mention this window
1055 void wxWindowBase::DeleteRelatedConstraints()
1056 {
1057 if ( m_constraintsInvolvedIn )
1058 {
1059 wxWindowList::Node *node = m_constraintsInvolvedIn->GetFirst();
1060 while (node)
1061 {
1062 wxWindow *win = node->GetData();
1063 wxLayoutConstraints *constr = win->GetConstraints();
1064
1065 // Reset any constraints involving this window
1066 if ( constr )
1067 {
1068 constr->left.ResetIfWin(this);
1069 constr->top.ResetIfWin(this);
1070 constr->right.ResetIfWin(this);
1071 constr->bottom.ResetIfWin(this);
1072 constr->width.ResetIfWin(this);
1073 constr->height.ResetIfWin(this);
1074 constr->centreX.ResetIfWin(this);
1075 constr->centreY.ResetIfWin(this);
1076 }
1077
1078 wxWindowList::Node *next = node->GetNext();
1079 delete node;
1080 node = next;
1081 }
1082
1083 delete m_constraintsInvolvedIn;
1084 m_constraintsInvolvedIn = (wxWindowList *) NULL;
1085 }
1086 }
1087
1088 void wxWindowBase::SetSizer(wxSizer *sizer)
1089 {
1090 if (m_windowSizer) delete m_windowSizer;
1091
1092 m_windowSizer = sizer;
1093 }
1094
1095 bool wxWindowBase::Layout()
1096 {
1097 // If there is a sizer, use it instead of the constraints
1098 if ( GetSizer() )
1099 {
1100 int w, h;
1101 GetClientSize(&w, &h);
1102
1103 GetSizer()->SetDimension( 0, 0, w, h );
1104 }
1105 else
1106 {
1107 wxLayoutConstraints *constr = GetConstraints();
1108 bool wasOk = constr && constr->AreSatisfied();
1109
1110 ResetConstraints(); // Mark all constraints as unevaluated
1111
1112 // if we're a top level panel (i.e. our parent is frame/dialog), our
1113 // own constraints will never be satisfied any more unless we do it
1114 // here
1115 if ( wasOk )
1116 {
1117 int noChanges = 1;
1118 while ( noChanges > 0 )
1119 {
1120 constr->SatisfyConstraints(this, &noChanges);
1121 }
1122 }
1123
1124 DoPhase(1); // Layout children
1125 DoPhase(2); // Layout grand children
1126 SetConstraintSizes(); // Recursively set the real window sizes
1127 }
1128
1129 return TRUE;
1130 }
1131
1132
1133 // Do a phase of evaluating constraints: the default behaviour. wxSizers may
1134 // do a similar thing, but also impose their own 'constraints' and order the
1135 // evaluation differently.
1136 bool wxWindowBase::LayoutPhase1(int *noChanges)
1137 {
1138 wxLayoutConstraints *constr = GetConstraints();
1139 if ( constr )
1140 {
1141 return constr->SatisfyConstraints(this, noChanges);
1142 }
1143 else
1144 return TRUE;
1145 }
1146
1147 bool wxWindowBase::LayoutPhase2(int *noChanges)
1148 {
1149 *noChanges = 0;
1150
1151 // Layout children
1152 DoPhase(1);
1153 DoPhase(2);
1154 return TRUE;
1155 }
1156
1157 // Do a phase of evaluating child constraints
1158 bool wxWindowBase::DoPhase(int phase)
1159 {
1160 int noIterations = 0;
1161 int maxIterations = 500;
1162 int noChanges = 1;
1163 int noFailures = 0;
1164 wxWindowList succeeded;
1165 while ((noChanges > 0) && (noIterations < maxIterations))
1166 {
1167 noChanges = 0;
1168 noFailures = 0;
1169 wxWindowList::Node *node = GetChildren().GetFirst();
1170 while (node)
1171 {
1172 wxWindow *child = node->GetData();
1173 if ( !child->IsTopLevel() )
1174 {
1175 wxLayoutConstraints *constr = child->GetConstraints();
1176 if ( constr )
1177 {
1178 if ( !succeeded.Find(child) )
1179 {
1180 int tempNoChanges = 0;
1181 bool success = ( (phase == 1) ? child->LayoutPhase1(&tempNoChanges) : child->LayoutPhase2(&tempNoChanges) ) ;
1182 noChanges += tempNoChanges;
1183 if ( success )
1184 {
1185 succeeded.Append(child);
1186 }
1187 }
1188 }
1189 }
1190 node = node->GetNext();
1191 }
1192
1193 noIterations++;
1194 }
1195
1196 return TRUE;
1197 }
1198
1199 void wxWindowBase::ResetConstraints()
1200 {
1201 wxLayoutConstraints *constr = GetConstraints();
1202 if ( constr )
1203 {
1204 constr->left.SetDone(FALSE);
1205 constr->top.SetDone(FALSE);
1206 constr->right.SetDone(FALSE);
1207 constr->bottom.SetDone(FALSE);
1208 constr->width.SetDone(FALSE);
1209 constr->height.SetDone(FALSE);
1210 constr->centreX.SetDone(FALSE);
1211 constr->centreY.SetDone(FALSE);
1212 }
1213
1214 wxWindowList::Node *node = GetChildren().GetFirst();
1215 while (node)
1216 {
1217 wxWindow *win = node->GetData();
1218 if ( !win->IsTopLevel() )
1219 win->ResetConstraints();
1220 node = node->GetNext();
1221 }
1222 }
1223
1224 // Need to distinguish between setting the 'fake' size for windows and sizers,
1225 // and setting the real values.
1226 void wxWindowBase::SetConstraintSizes(bool recurse)
1227 {
1228 wxLayoutConstraints *constr = GetConstraints();
1229 if ( constr && constr->AreSatisfied() )
1230 {
1231 int x = constr->left.GetValue();
1232 int y = constr->top.GetValue();
1233 int w = constr->width.GetValue();
1234 int h = constr->height.GetValue();
1235
1236 if ( (constr->width.GetRelationship() != wxAsIs ) ||
1237 (constr->height.GetRelationship() != wxAsIs) )
1238 {
1239 SetSize(x, y, w, h);
1240 }
1241 else
1242 {
1243 // If we don't want to resize this window, just move it...
1244 Move(x, y);
1245 }
1246 }
1247 else if ( constr )
1248 {
1249 wxLogDebug(wxT("Constraints not satisfied for %s named '%s'."),
1250 GetClassInfo()->GetClassName(),
1251 GetName().c_str());
1252 }
1253
1254 if ( recurse )
1255 {
1256 wxWindowList::Node *node = GetChildren().GetFirst();
1257 while (node)
1258 {
1259 wxWindow *win = node->GetData();
1260 if ( !win->IsTopLevel() )
1261 win->SetConstraintSizes();
1262 node = node->GetNext();
1263 }
1264 }
1265 }
1266
1267 // Only set the size/position of the constraint (if any)
1268 void wxWindowBase::SetSizeConstraint(int x, int y, int w, int h)
1269 {
1270 wxLayoutConstraints *constr = GetConstraints();
1271 if ( constr )
1272 {
1273 if ( x != -1 )
1274 {
1275 constr->left.SetValue(x);
1276 constr->left.SetDone(TRUE);
1277 }
1278 if ( y != -1 )
1279 {
1280 constr->top.SetValue(y);
1281 constr->top.SetDone(TRUE);
1282 }
1283 if ( w != -1 )
1284 {
1285 constr->width.SetValue(w);
1286 constr->width.SetDone(TRUE);
1287 }
1288 if ( h != -1 )
1289 {
1290 constr->height.SetValue(h);
1291 constr->height.SetDone(TRUE);
1292 }
1293 }
1294 }
1295
1296 void wxWindowBase::MoveConstraint(int x, int y)
1297 {
1298 wxLayoutConstraints *constr = GetConstraints();
1299 if ( constr )
1300 {
1301 if ( x != -1 )
1302 {
1303 constr->left.SetValue(x);
1304 constr->left.SetDone(TRUE);
1305 }
1306 if ( y != -1 )
1307 {
1308 constr->top.SetValue(y);
1309 constr->top.SetDone(TRUE);
1310 }
1311 }
1312 }
1313
1314 void wxWindowBase::GetSizeConstraint(int *w, int *h) const
1315 {
1316 wxLayoutConstraints *constr = GetConstraints();
1317 if ( constr )
1318 {
1319 *w = constr->width.GetValue();
1320 *h = constr->height.GetValue();
1321 }
1322 else
1323 GetSize(w, h);
1324 }
1325
1326 void wxWindowBase::GetClientSizeConstraint(int *w, int *h) const
1327 {
1328 wxLayoutConstraints *constr = GetConstraints();
1329 if ( constr )
1330 {
1331 *w = constr->width.GetValue();
1332 *h = constr->height.GetValue();
1333 }
1334 else
1335 GetClientSize(w, h);
1336 }
1337
1338 void wxWindowBase::GetPositionConstraint(int *x, int *y) const
1339 {
1340 wxLayoutConstraints *constr = GetConstraints();
1341 if ( constr )
1342 {
1343 *x = constr->left.GetValue();
1344 *y = constr->top.GetValue();
1345 }
1346 else
1347 GetPosition(x, y);
1348 }
1349
1350 #endif // wxUSE_CONSTRAINTS
1351
1352 // ----------------------------------------------------------------------------
1353 // do Update UI processing for child controls
1354 // ----------------------------------------------------------------------------
1355
1356 // TODO: should this be implemented for the child window rather
1357 // than the parent? Then you can override it e.g. for wxCheckBox
1358 // to do the Right Thing rather than having to assume a fixed number
1359 // of control classes.
1360 void wxWindowBase::UpdateWindowUI()
1361 {
1362 wxUpdateUIEvent event(GetId());
1363 event.m_eventObject = this;
1364
1365 if ( GetEventHandler()->ProcessEvent(event) )
1366 {
1367 if ( event.GetSetEnabled() )
1368 Enable(event.GetEnabled());
1369
1370 if ( event.GetSetText() )
1371 {
1372 wxControl *control = wxDynamicThisCast(this, wxControl);
1373 if ( control )
1374 {
1375 wxTextCtrl *text = wxDynamicCast(control, wxTextCtrl);
1376 if ( text )
1377 text->SetValue(event.GetText());
1378 else
1379 control->SetLabel(event.GetText());
1380 }
1381 }
1382
1383 #if wxUSE_CHECKBOX
1384 wxCheckBox *checkbox = wxDynamicThisCast(this, wxCheckBox);
1385 if ( checkbox )
1386 {
1387 if ( event.GetSetChecked() )
1388 checkbox->SetValue(event.GetChecked());
1389 }
1390 #endif // wxUSE_CHECKBOX
1391
1392 #if wxUSE_RADIOBTN
1393 wxRadioButton *radiobtn = wxDynamicThisCast(this, wxRadioButton);
1394 if ( radiobtn )
1395 {
1396 if ( event.GetSetChecked() )
1397 radiobtn->SetValue(event.GetChecked());
1398 }
1399 #endif // wxUSE_RADIOBTN
1400 }
1401 }
1402
1403 // ----------------------------------------------------------------------------
1404 // dialog units translations
1405 // ----------------------------------------------------------------------------
1406
1407 wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt)
1408 {
1409 int charWidth = GetCharWidth();
1410 int charHeight = GetCharHeight();
1411 wxPoint pt2(-1, -1);
1412 if (pt.x != -1)
1413 pt2.x = (int) ((pt.x * 4) / charWidth) ;
1414 if (pt.y != -1)
1415 pt2.y = (int) ((pt.y * 8) / charHeight) ;
1416
1417 return pt2;
1418 }
1419
1420 wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt)
1421 {
1422 int charWidth = GetCharWidth();
1423 int charHeight = GetCharHeight();
1424 wxPoint pt2(-1, -1);
1425 if (pt.x != -1)
1426 pt2.x = (int) ((pt.x * charWidth) / 4) ;
1427 if (pt.y != -1)
1428 pt2.y = (int) ((pt.y * charHeight) / 8) ;
1429
1430 return pt2;
1431 }
1432
1433 // ----------------------------------------------------------------------------
1434 // client data
1435 // ----------------------------------------------------------------------------
1436
1437 void wxWindowBase::DoSetClientObject( wxClientData *data )
1438 {
1439 wxASSERT_MSG( m_clientDataType != ClientData_Void,
1440 wxT("can't have both object and void client data") );
1441
1442 if ( m_clientObject )
1443 delete m_clientObject;
1444
1445 m_clientObject = data;
1446 m_clientDataType = ClientData_Object;
1447 }
1448
1449 wxClientData *wxWindowBase::DoGetClientObject() const
1450 {
1451 // it's not an error to call GetClientObject() on a window which doesn't
1452 // have client data at all - NULL will be returned
1453 wxASSERT_MSG( m_clientDataType != ClientData_Void,
1454 wxT("this window doesn't have object client data") );
1455
1456 return m_clientObject;
1457 }
1458
1459 void wxWindowBase::DoSetClientData( void *data )
1460 {
1461 wxASSERT_MSG( m_clientDataType != ClientData_Object,
1462 wxT("can't have both object and void client data") );
1463
1464 m_clientData = data;
1465 m_clientDataType = ClientData_Void;
1466 }
1467
1468 void *wxWindowBase::DoGetClientData() const
1469 {
1470 // it's not an error to call GetClientData() on a window which doesn't have
1471 // client data at all - NULL will be returned
1472 wxASSERT_MSG( m_clientDataType != ClientData_Object,
1473 wxT("this window doesn't have void client data") );
1474
1475 return m_clientData;
1476 }
1477
1478 // ----------------------------------------------------------------------------
1479 // event handlers
1480 // ----------------------------------------------------------------------------
1481
1482 // propagate the colour change event to the subwindows
1483 void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
1484 {
1485 wxWindowList::Node *node = GetChildren().GetFirst();
1486 while ( node )
1487 {
1488 // Only propagate to non-top-level windows
1489 wxWindow *win = node->GetData();
1490 if ( !win->IsTopLevel() )
1491 {
1492 wxSysColourChangedEvent event2;
1493 event.m_eventObject = win;
1494 win->GetEventHandler()->ProcessEvent(event2);
1495 }
1496
1497 node = node->GetNext();
1498 }
1499 }
1500
1501 // the default action is to populate dialog with data when it's created
1502 void wxWindowBase::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
1503 {
1504 TransferDataToWindow();
1505 }
1506
1507 // process Ctrl-Alt-mclick
1508 void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
1509 {
1510 if ( event.ControlDown() && event.AltDown() )
1511 {
1512 // don't translate these strings
1513 wxString port;
1514 switch ( wxGetOsVersion() )
1515 {
1516 case wxMOTIF_X: port = _T("Motif"); break;
1517 case wxMACINTOSH: port = _T("Mac"); break;
1518 case wxBEOS: port = _T("BeOS"); break;
1519 case wxGTK:
1520 case wxGTK_WIN32:
1521 case wxGTK_OS2:
1522 case wxGTK_BEOS: port = _T("GTK"); break;
1523 case wxWINDOWS:
1524 case wxPENWINDOWS:
1525 case wxWINDOWS_NT:
1526 case wxWIN32S:
1527 case wxWIN95:
1528 case wxWIN386: port = _T("MS Windows"); break;
1529 case wxMGL_UNIX:
1530 case wxMGL_X:
1531 case wxMGL_WIN32:
1532 case wxMGL_OS2: port = _T("MGL"); break;
1533 case wxWINDOWS_OS2:
1534 case wxOS2_PM: port = _T("OS/2"); break;
1535 default: port = _T("unknown"); break;
1536 }
1537
1538 wxMessageBox(wxString::Format(
1539 _T(
1540 " wxWindows Library (%s port)\nVersion %u.%u.%u, compiled at %s %s\n Copyright (c) 1995-2000 wxWindows team"
1541 ),
1542 port.c_str(),
1543 wxMAJOR_VERSION,
1544 wxMINOR_VERSION,
1545 wxRELEASE_NUMBER,
1546 __DATE__,
1547 __TIME__
1548 ),
1549 _T("wxWindows information"),
1550 wxICON_INFORMATION | wxOK,
1551 (wxWindow *)this);
1552 }
1553 else
1554 {
1555 event.Skip();
1556 }
1557 }
1558
1559 // ----------------------------------------------------------------------------
1560 // list classes implementation
1561 // ----------------------------------------------------------------------------
1562
1563 void wxWindowListNode::DeleteData()
1564 {
1565 delete (wxWindow *)GetData();
1566 }
1567