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