1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/window.cpp
3 // Purpose: common (to all ports) wxWindow functions
4 // Author: Julian Smart, Vadim Zeitlin
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "windowbase.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/string.h"
37 #include "wx/window.h"
38 #include "wx/control.h"
39 #include "wx/checkbox.h"
40 #include "wx/radiobut.h"
41 #include "wx/statbox.h"
42 #include "wx/textctrl.h"
43 #include "wx/settings.h"
44 #include "wx/dialog.h"
45 #include "wx/msgdlg.h"
46 #include "wx/statusbr.h"
47 #include "wx/dcclient.h"
50 #if defined(__WXMAC__) && wxUSE_SCROLLBAR
51 #include "wx/scrolbar.h"
55 #include "wx/layout.h"
56 #endif // wxUSE_CONSTRAINTS
60 #if wxUSE_DRAG_AND_DROP
62 #endif // wxUSE_DRAG_AND_DROP
64 #if wxUSE_ACCESSIBILITY
65 #include "wx/access.h"
69 #include "wx/cshelp.h"
73 #include "wx/tooltip.h"
74 #endif // wxUSE_TOOLTIPS
80 // ----------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------
85 int wxWindowBase::ms_lastControlId
= 2000;
87 int wxWindowBase::ms_lastControlId
= -200;
90 IMPLEMENT_ABSTRACT_CLASS(wxWindowBase
, wxEvtHandler
)
92 // ----------------------------------------------------------------------------
94 // ----------------------------------------------------------------------------
96 BEGIN_EVENT_TABLE(wxWindowBase
, wxEvtHandler
)
97 EVT_SYS_COLOUR_CHANGED(wxWindowBase::OnSysColourChanged
)
98 EVT_INIT_DIALOG(wxWindowBase::OnInitDialog
)
99 EVT_MIDDLE_DOWN(wxWindowBase::OnMiddleClick
)
102 EVT_HELP(wxID_ANY
, wxWindowBase::OnHelp
)
107 // ============================================================================
108 // implementation of the common functionality of the wxWindow class
109 // ============================================================================
111 // ----------------------------------------------------------------------------
113 // ----------------------------------------------------------------------------
115 // the default initialization
116 wxWindowBase::wxWindowBase()
118 // no window yet, no parent nor children
119 m_parent
= (wxWindow
*)NULL
;
120 m_windowId
= wxID_ANY
;
122 // no constraints on the minimal window size
124 m_maxWidth
= wxDefaultSize
.x
;
126 m_maxHeight
= wxDefaultSize
.y
;
128 // window are created enabled and visible by default
132 // the default event handler is just this window
133 m_eventHandler
= this;
137 m_windowValidator
= (wxValidator
*) NULL
;
138 #endif // wxUSE_VALIDATORS
140 // the colours/fonts are default for now, so leave m_font,
141 // m_backgroundColour and m_foregroundColour uninitialized and set those
150 #if wxUSE_CONSTRAINTS
151 // no constraints whatsoever
152 m_constraints
= (wxLayoutConstraints
*) NULL
;
153 m_constraintsInvolvedIn
= (wxWindowList
*) NULL
;
154 #endif // wxUSE_CONSTRAINTS
156 m_windowSizer
= (wxSizer
*) NULL
;
157 m_containingSizer
= (wxSizer
*) NULL
;
158 m_autoLayout
= false;
160 #if wxUSE_DRAG_AND_DROP
161 m_dropTarget
= (wxDropTarget
*)NULL
;
162 #endif // wxUSE_DRAG_AND_DROP
165 m_tooltip
= (wxToolTip
*)NULL
;
166 #endif // wxUSE_TOOLTIPS
169 m_caret
= (wxCaret
*)NULL
;
170 #endif // wxUSE_CARET
173 m_hasCustomPalette
= false;
174 #endif // wxUSE_PALETTE
176 #if wxUSE_ACCESSIBILITY
180 m_virtualSize
= wxDefaultSize
;
183 m_maxVirtualWidth
= wxDefaultSize
.x
;
185 m_maxVirtualHeight
= wxDefaultSize
.y
;
187 m_windowVariant
= wxWINDOW_VARIANT_NORMAL
;
189 // Whether we're using the current theme for this window (wxGTK only for now)
190 m_themeEnabled
= false;
192 // VZ: this one shouldn't exist...
193 m_isBeingDeleted
= false;
196 // common part of window creation process
197 bool wxWindowBase::CreateBase(wxWindowBase
*parent
,
199 const wxPoint
& WXUNUSED(pos
),
200 const wxSize
& WXUNUSED(size
),
202 const wxValidator
& wxVALIDATOR_PARAM(validator
),
203 const wxString
& name
)
206 // wxGTK doesn't allow to create controls with static box as the parent so
207 // this will result in a crash when the program is ported to wxGTK so warn
210 // if you get this assert, the correct solution is to create the controls
211 // as siblings of the static box
212 wxASSERT_MSG( !parent
|| !wxDynamicCast(parent
, wxStaticBox
),
213 _T("wxStaticBox can't be used as a window parent!") );
214 #endif // wxUSE_STATBOX
216 // ids are limited to 16 bits under MSW so if you care about portability,
217 // it's not a good idea to use ids out of this range (and negative ids are
218 // reserved for wxWidgets own usage)
219 wxASSERT_MSG( id
== wxID_ANY
|| (id
>= 0 && id
< 32767),
220 _T("invalid id value") );
222 // generate a new id if the user doesn't care about it
223 m_windowId
= id
== wxID_ANY
? NewControlId() : id
;
226 SetWindowStyleFlag(style
);
230 SetValidator(validator
);
231 #endif // wxUSE_VALIDATORS
233 // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to
234 // have it too - like this it's possible to set it only in the top level
235 // dialog/frame and all children will inherit it by defult
236 if ( parent
&& (parent
->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) )
238 SetExtraStyle(GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY
);
244 // ----------------------------------------------------------------------------
246 // ----------------------------------------------------------------------------
249 wxWindowBase::~wxWindowBase()
251 wxASSERT_MSG( GetCapture() != this, wxT("attempt to destroy window with mouse capture") );
253 // FIXME if these 2 cases result from programming errors in the user code
254 // we should probably assert here instead of silently fixing them
256 // Just in case the window has been Closed, but we're then deleting
257 // immediately: don't leave dangling pointers.
258 wxPendingDelete
.DeleteObject(this);
260 // Just in case we've loaded a top-level window via LoadNativeDialog but
261 // we weren't a dialog class
262 wxTopLevelWindows
.DeleteObject((wxWindow
*)this);
264 wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
266 // reset the dangling pointer our parent window may keep to us
269 if ( m_parent
->GetDefaultItem() == this )
271 m_parent
->SetDefaultItem(NULL
);
274 m_parent
->RemoveChild(this);
279 #endif // wxUSE_CARET
282 delete m_windowValidator
;
283 #endif // wxUSE_VALIDATORS
285 #if wxUSE_CONSTRAINTS
286 // Have to delete constraints/sizer FIRST otherwise sizers may try to look
287 // at deleted windows as they delete themselves.
288 DeleteRelatedConstraints();
292 // This removes any dangling pointers to this window in other windows'
293 // constraintsInvolvedIn lists.
294 UnsetConstraints(m_constraints
);
295 delete m_constraints
;
296 m_constraints
= NULL
;
298 #endif // wxUSE_CONSTRAINTS
300 if ( m_containingSizer
)
301 m_containingSizer
->Detach( (wxWindow
*)this );
303 delete m_windowSizer
;
305 #if wxUSE_DRAG_AND_DROP
307 #endif // wxUSE_DRAG_AND_DROP
311 #endif // wxUSE_TOOLTIPS
313 #if wxUSE_ACCESSIBILITY
318 bool wxWindowBase::Destroy()
325 bool wxWindowBase::Close(bool force
)
327 wxCloseEvent
event(wxEVT_CLOSE_WINDOW
, m_windowId
);
328 event
.SetEventObject(this);
329 event
.SetCanVeto(!force
);
331 // return false if window wasn't closed because the application vetoed the
333 return GetEventHandler()->ProcessEvent(event
) && !event
.GetVeto();
336 bool wxWindowBase::DestroyChildren()
338 wxWindowList::compatibility_iterator node
;
341 // we iterate until the list becomes empty
342 node
= GetChildren().GetFirst();
346 wxWindow
*child
= node
->GetData();
348 // note that we really want to call delete and not ->Destroy() here
349 // because we want to delete the child immediately, before we are
350 // deleted, and delayed deletion would result in problems as our (top
351 // level) child could outlive its parent
354 wxASSERT_MSG( !GetChildren().Find(child
),
355 wxT("child didn't remove itself using RemoveChild()") );
361 // ----------------------------------------------------------------------------
362 // size/position related methods
363 // ----------------------------------------------------------------------------
365 // centre the window with respect to its parent in either (or both) directions
366 void wxWindowBase::Centre(int direction
)
368 // the position/size of the parent window or of the entire screen
370 int widthParent
, heightParent
;
372 wxWindow
*parent
= NULL
;
374 if ( !(direction
& wxCENTRE_ON_SCREEN
) )
376 // find the parent to centre this window on: it should be the
377 // immediate parent for the controls but the top level parent for the
378 // top level windows (like dialogs)
379 parent
= GetParent();
382 while ( parent
&& !parent
->IsTopLevel() )
384 parent
= parent
->GetParent();
388 // there is no wxTopLevelWindow under wxMotif yet
390 // we shouldn't center the dialog on the iconized window: under
391 // Windows, for example, this places it completely off the screen
394 wxTopLevelWindow
*winTop
= wxDynamicCast(parent
, wxTopLevelWindow
);
395 if ( winTop
&& winTop
->IsIconized() )
400 #endif // __WXMOTIF__
402 // did we find the parent?
406 direction
|= wxCENTRE_ON_SCREEN
;
410 if ( direction
& wxCENTRE_ON_SCREEN
)
412 // centre with respect to the whole screen
413 wxDisplaySize(&widthParent
, &heightParent
);
419 // centre on the parent
420 parent
->GetSize(&widthParent
, &heightParent
);
422 // adjust to the parents position
423 posParent
= parent
->GetPosition();
427 // centre inside the parents client rectangle
428 parent
->GetClientSize(&widthParent
, &heightParent
);
433 GetSize(&width
, &height
);
435 int xNew
= wxDefaultPosition
.x
,
436 yNew
= wxDefaultPosition
.y
;
438 if ( direction
& wxHORIZONTAL
)
439 xNew
= (widthParent
- width
)/2;
441 if ( direction
& wxVERTICAL
)
442 yNew
= (heightParent
- height
)/2;
447 // Base size of the visible dimensions of the display
448 // to take into account the taskbar
449 wxRect rect
= wxGetClientDisplayRect();
450 wxSize
size (rect
.width
,rect
.height
);
452 // NB: in wxMSW, negative position may not neccessary mean "out of screen",
453 // but it may mean that the window is placed on other than the main
454 // display. Therefore we only make sure centered window is on the main display
455 // if the parent is at least partially present here.
456 if (posParent
.x
+ widthParent
>= 0) // if parent is (partially) on the main display
460 else if (xNew
+width
> size
.x
)
461 xNew
= size
.x
-width
-1;
463 if (posParent
.y
+ heightParent
>= 0) // if parent is (partially) on the main display
465 if (yNew
+height
> size
.y
)
466 yNew
= size
.y
-height
-1;
468 // Make certain that the title bar is initially visible
469 // always, even if this would push the bottom of the
470 // dialog of the visible area of the display
475 // move the window to this position (keeping the old size but using
476 // SetSize() and not Move() to allow xNew and/or yNew to be -1)
477 SetSize(xNew
, yNew
, width
, height
, wxSIZE_ALLOW_MINUS_ONE
);
480 // fits the window around the children
481 void wxWindowBase::Fit()
483 if ( GetChildren().GetCount() > 0 )
485 SetClientSize(DoGetBestSize());
487 //else: do nothing if we have no children
490 // fits virtual size (ie. scrolled area etc.) around children
491 void wxWindowBase::FitInside()
493 if ( GetChildren().GetCount() > 0 )
495 SetVirtualSize( GetBestVirtualSize() );
499 // On Mac, scrollbars are explicitly children.
501 static bool wxHasRealChildren(const wxWindowBase
* win
)
503 int realChildCount
= 0;
505 for ( wxWindowList::compatibility_iterator node
= win
->GetChildren().GetFirst();
507 node
= node
->GetNext() )
509 wxWindow
*win
= node
->GetData();
510 if ( !win
->IsTopLevel() && win
->IsShown() && !win
->IsKindOf(CLASSINFO(wxScrollBar
)))
513 return (realChildCount
> 0);
517 // return the size best suited for the current window
518 wxSize
wxWindowBase::DoGetBestSize() const
522 return m_windowSizer
->GetMinSize();
524 #if wxUSE_CONSTRAINTS
525 else if ( m_constraints
)
527 wxConstCast(this, wxWindowBase
)->SatisfyConstraints();
529 // our minimal acceptable size is such that all our windows fit inside
533 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
535 node
= node
->GetNext() )
537 wxLayoutConstraints
*c
= node
->GetData()->GetConstraints();
540 // it's not normal that we have an unconstrained child, but
541 // what can we do about it?
545 int x
= c
->right
.GetValue(),
546 y
= c
->bottom
.GetValue();
554 // TODO: we must calculate the overlaps somehow, otherwise we
555 // will never return a size bigger than the current one :-(
558 return wxSize(maxX
, maxY
);
560 #endif // wxUSE_CONSTRAINTS
561 else if ( !GetChildren().empty()
563 && wxHasRealChildren(this)
567 // our minimal acceptable size is such that all our visible child windows fit inside
571 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
573 node
= node
->GetNext() )
575 wxWindow
*win
= node
->GetData();
576 if ( win
->IsTopLevel() || ( ! win
->IsShown() )
578 || wxDynamicCast(win
, wxStatusBar
)
579 #endif // wxUSE_STATUSBAR
582 // dialogs and frames lie in different top level windows -
583 // don't deal with them here; as for the status bars, they
584 // don't lie in the client area at all
589 win
->GetPosition(&wx
, &wy
);
591 // if the window hadn't been positioned yet, assume that it is in
593 if ( wx
== wxDefaultPosition
.x
)
595 if ( wy
== wxDefaultPosition
.y
)
598 win
->GetSize(&ww
, &wh
);
599 if ( wx
+ ww
> maxX
)
601 if ( wy
+ wh
> maxY
)
605 // for compatibility with the old versions and because it really looks
606 // slightly more pretty like this, add a pad
610 return wxSize(maxX
, maxY
);
612 else // ! has children
614 // for a generic window there is no natural best size - just use either the
615 // minimum size if there is one, or the current size
616 if ( GetMinSize().IsFullySpecified() )
623 void wxWindowBase::SetBestFittingSize(const wxSize
& size
)
625 // If the given size is incomplete then merge with the best size.
627 if ( size
.x
== wxDefaultSize
.x
|| size
.y
== wxDefaultSize
.y
)
629 sizeBest
= DoGetBestSize();
630 if ( size
.x
!= wxDefaultSize
.x
)
632 if ( size
.y
!= wxDefaultSize
.y
)
635 else // have complete explicit size
640 // Change the size if needed
641 if (GetSize() != sizeBest
)
644 // don't shrink the control below its best size
645 m_minWidth
= sizeBest
.x
;
646 m_minHeight
= sizeBest
.y
;
649 // by default the origin is not shifted
650 wxPoint
wxWindowBase::GetClientAreaOrigin() const
652 return wxPoint(0, 0);
655 // set the min/max size of the window
656 void wxWindowBase::SetSizeHints(int minW
, int minH
,
658 int WXUNUSED(incW
), int WXUNUSED(incH
))
660 // setting min width greater than max width leads to infinite loops under
661 // X11 and generally doesn't make any sense, so don't allow it
662 wxCHECK_RET( (minW
== wxDefaultSize
.x
|| maxW
== wxDefaultSize
.x
|| minW
<= maxW
) &&
663 (minH
== wxDefaultSize
.y
|| maxH
== wxDefaultSize
.y
|| minH
<= maxH
),
664 _T("min width/height must be less than max width/height!") );
672 void wxWindowBase::SetWindowVariant( wxWindowVariant variant
)
674 if ( m_windowVariant
!= variant
)
676 m_windowVariant
= variant
;
678 DoSetWindowVariant(variant
);
682 void wxWindowBase::DoSetWindowVariant( wxWindowVariant variant
)
684 // adjust the font height to correspond to our new variant (notice that
685 // we're only called if something really changed)
686 wxFont font
= GetFont();
687 int size
= font
.GetPointSize();
690 case wxWINDOW_VARIANT_NORMAL
:
693 case wxWINDOW_VARIANT_SMALL
:
698 case wxWINDOW_VARIANT_MINI
:
703 case wxWINDOW_VARIANT_LARGE
:
709 wxFAIL_MSG(_T("unexpected window variant"));
713 font
.SetPointSize(size
);
717 void wxWindowBase::SetVirtualSizeHints( int minW
, int minH
,
720 m_minVirtualWidth
= minW
;
721 m_maxVirtualWidth
= maxW
;
722 m_minVirtualHeight
= minH
;
723 m_maxVirtualHeight
= maxH
;
726 void wxWindowBase::DoSetVirtualSize( int x
, int y
)
728 if ( m_minVirtualWidth
!= wxDefaultSize
.x
&& m_minVirtualWidth
> x
)
729 x
= m_minVirtualWidth
;
730 if ( m_maxVirtualWidth
!= wxDefaultSize
.x
&& m_maxVirtualWidth
< x
)
731 x
= m_maxVirtualWidth
;
732 if ( m_minVirtualHeight
!= wxDefaultSize
.y
&& m_minVirtualHeight
> y
)
733 y
= m_minVirtualHeight
;
734 if ( m_maxVirtualHeight
!= wxDefaultSize
.y
&& m_maxVirtualHeight
< y
)
735 y
= m_maxVirtualHeight
;
737 m_virtualSize
= wxSize(x
, y
);
740 wxSize
wxWindowBase::DoGetVirtualSize() const
742 wxSize
s( GetClientSize() );
744 return wxSize( wxMax( m_virtualSize
.GetWidth(), s
.GetWidth() ),
745 wxMax( m_virtualSize
.GetHeight(), s
.GetHeight() ) );
748 // ----------------------------------------------------------------------------
749 // show/hide/enable/disable the window
750 // ----------------------------------------------------------------------------
752 bool wxWindowBase::Show(bool show
)
754 if ( show
!= m_isShown
)
766 bool wxWindowBase::Enable(bool enable
)
768 if ( enable
!= m_isEnabled
)
770 m_isEnabled
= enable
;
779 // ----------------------------------------------------------------------------
781 // ----------------------------------------------------------------------------
783 bool wxWindowBase::IsTopLevel() const
788 // ----------------------------------------------------------------------------
789 // reparenting the window
790 // ----------------------------------------------------------------------------
792 void wxWindowBase::AddChild(wxWindowBase
*child
)
794 wxCHECK_RET( child
, wxT("can't add a NULL child") );
796 // this should never happen and it will lead to a crash later if it does
797 // because RemoveChild() will remove only one node from the children list
798 // and the other(s) one(s) will be left with dangling pointers in them
799 wxASSERT_MSG( !GetChildren().Find((wxWindow
*)child
), _T("AddChild() called twice") );
801 GetChildren().Append((wxWindow
*)child
);
802 child
->SetParent(this);
805 void wxWindowBase::RemoveChild(wxWindowBase
*child
)
807 wxCHECK_RET( child
, wxT("can't remove a NULL child") );
809 GetChildren().DeleteObject((wxWindow
*)child
);
810 child
->SetParent(NULL
);
813 bool wxWindowBase::Reparent(wxWindowBase
*newParent
)
815 wxWindow
*oldParent
= GetParent();
816 if ( newParent
== oldParent
)
822 // unlink this window from the existing parent.
825 oldParent
->RemoveChild(this);
829 wxTopLevelWindows
.DeleteObject((wxWindow
*)this);
832 // add it to the new one
835 newParent
->AddChild(this);
839 wxTopLevelWindows
.Append((wxWindow
*)this);
845 // ----------------------------------------------------------------------------
846 // event handler stuff
847 // ----------------------------------------------------------------------------
849 void wxWindowBase::PushEventHandler(wxEvtHandler
*handler
)
851 wxEvtHandler
*handlerOld
= GetEventHandler();
853 handler
->SetNextHandler(handlerOld
);
856 GetEventHandler()->SetPreviousHandler(handler
);
858 SetEventHandler(handler
);
861 wxEvtHandler
*wxWindowBase::PopEventHandler(bool deleteHandler
)
863 wxEvtHandler
*handlerA
= GetEventHandler();
866 wxEvtHandler
*handlerB
= handlerA
->GetNextHandler();
867 handlerA
->SetNextHandler((wxEvtHandler
*)NULL
);
870 handlerB
->SetPreviousHandler((wxEvtHandler
*)NULL
);
871 SetEventHandler(handlerB
);
876 handlerA
= (wxEvtHandler
*)NULL
;
883 bool wxWindowBase::RemoveEventHandler(wxEvtHandler
*handler
)
885 wxCHECK_MSG( handler
, false, _T("RemoveEventHandler(NULL) called") );
887 wxEvtHandler
*handlerPrev
= NULL
,
888 *handlerCur
= GetEventHandler();
891 wxEvtHandler
*handlerNext
= handlerCur
->GetNextHandler();
893 if ( handlerCur
== handler
)
897 handlerPrev
->SetNextHandler(handlerNext
);
901 SetEventHandler(handlerNext
);
906 handlerNext
->SetPreviousHandler ( handlerPrev
);
909 handler
->SetNextHandler(NULL
);
910 handler
->SetPreviousHandler(NULL
);
915 handlerPrev
= handlerCur
;
916 handlerCur
= handlerNext
;
919 wxFAIL_MSG( _T("where has the event handler gone?") );
924 // ----------------------------------------------------------------------------
926 // ----------------------------------------------------------------------------
928 void wxWindowBase::InheritAttributes()
930 const wxWindowBase
* const parent
= GetParent();
934 // we only inherit attributes which had been explicitly set for the parent
935 // which ensures that this only happens if the user really wants it and
936 // not by default which wouldn't make any sense in modern GUIs where the
937 // controls don't all use the same fonts (nor colours)
938 if ( parent
->m_hasFont
&& !m_hasFont
)
939 SetFont(parent
->GetFont());
941 // in addition, there is a possibility to explicitly forbid inheriting
942 // colours at each class level by overriding ShouldInheritColours()
943 if ( ShouldInheritColours() )
945 if ( parent
->m_hasFgCol
&& !m_hasFgCol
)
946 SetForegroundColour(parent
->GetForegroundColour());
948 if ( parent
->m_hasBgCol
&& !m_hasBgCol
)
949 SetBackgroundColour(parent
->GetBackgroundColour());
953 /* static */ wxVisualAttributes
954 wxWindowBase::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
956 // it is important to return valid values for all attributes from here,
957 // GetXXX() below rely on this
958 wxVisualAttributes attrs
;
959 attrs
.font
= wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
);
960 attrs
.colFg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT
);
961 attrs
.colBg
= wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE
);
966 wxColour
wxWindowBase::GetBackgroundColour() const
968 if ( !m_backgroundColour
.Ok() )
970 wxASSERT_MSG( !m_hasBgCol
, _T("we have invalid explicit bg colour?") );
972 // get our default background colour
973 wxColour colBg
= GetDefaultAttributes().colBg
;
975 // we must return some valid colour to avoid redoing this every time
976 // and also to avoid surprizing the applications written for older
977 // wxWidgets versions where GetBackgroundColour() always returned
978 // something -- so give them something even if it doesn't make sense
979 // for this window (e.g. it has a themed background)
981 colBg
= GetClassDefaultAttributes().colBg
;
986 return m_backgroundColour
;
989 wxColour
wxWindowBase::GetForegroundColour() const
991 // logic is the same as above
992 if ( !m_hasFgCol
&& !m_foregroundColour
.Ok() )
994 wxASSERT_MSG( !m_hasFgCol
, _T("we have invalid explicit fg colour?") );
996 wxColour colFg
= GetDefaultAttributes().colFg
;
999 colFg
= GetClassDefaultAttributes().colFg
;
1004 return m_foregroundColour
;
1007 bool wxWindowBase::SetBackgroundColour( const wxColour
&colour
)
1009 if ( colour
== m_backgroundColour
)
1012 m_hasBgCol
= colour
.Ok();
1013 m_backgroundColour
= colour
;
1014 SetThemeEnabled( !m_hasBgCol
&& !m_foregroundColour
.Ok() );
1018 bool wxWindowBase::SetForegroundColour( const wxColour
&colour
)
1020 if (colour
== m_foregroundColour
)
1023 m_hasFgCol
= colour
.Ok();
1024 m_foregroundColour
= colour
;
1025 SetThemeEnabled( !m_hasFgCol
&& !m_backgroundColour
.Ok() );
1029 bool wxWindowBase::SetCursor(const wxCursor
& cursor
)
1031 // setting an invalid cursor is ok, it means that we don't have any special
1033 if ( m_cursor
== cursor
)
1044 wxFont
wxWindowBase::GetFont() const
1046 // logic is the same as in GetBackgroundColour()
1049 wxASSERT_MSG( !m_hasFont
, _T("we have invalid explicit font?") );
1051 wxFont font
= GetDefaultAttributes().font
;
1053 font
= GetClassDefaultAttributes().font
;
1061 bool wxWindowBase::SetFont(const wxFont
& font
)
1063 if ( font
== m_font
)
1070 m_hasFont
= font
.Ok();
1077 void wxWindowBase::SetPalette(const wxPalette
& pal
)
1079 m_hasCustomPalette
= true;
1082 // VZ: can anyone explain me what do we do here?
1083 wxWindowDC
d((wxWindow
*) this);
1087 wxWindow
*wxWindowBase::GetAncestorWithCustomPalette() const
1089 wxWindow
*win
= (wxWindow
*)this;
1090 while ( win
&& !win
->HasCustomPalette() )
1092 win
= win
->GetParent();
1098 #endif // wxUSE_PALETTE
1101 void wxWindowBase::SetCaret(wxCaret
*caret
)
1112 wxASSERT_MSG( m_caret
->GetWindow() == this,
1113 wxT("caret should be created associated to this window") );
1116 #endif // wxUSE_CARET
1118 #if wxUSE_VALIDATORS
1119 // ----------------------------------------------------------------------------
1121 // ----------------------------------------------------------------------------
1123 void wxWindowBase::SetValidator(const wxValidator
& validator
)
1125 if ( m_windowValidator
)
1126 delete m_windowValidator
;
1128 m_windowValidator
= (wxValidator
*)validator
.Clone();
1130 if ( m_windowValidator
)
1131 m_windowValidator
->SetWindow(this);
1133 #endif // wxUSE_VALIDATORS
1135 // ----------------------------------------------------------------------------
1136 // update region stuff
1137 // ----------------------------------------------------------------------------
1139 wxRect
wxWindowBase::GetUpdateClientRect() const
1141 wxRegion rgnUpdate
= GetUpdateRegion();
1142 rgnUpdate
.Intersect(GetClientRect());
1143 wxRect rectUpdate
= rgnUpdate
.GetBox();
1144 wxPoint ptOrigin
= GetClientAreaOrigin();
1145 rectUpdate
.x
-= ptOrigin
.x
;
1146 rectUpdate
.y
-= ptOrigin
.y
;
1151 bool wxWindowBase::IsExposed(int x
, int y
) const
1153 return m_updateRegion
.Contains(x
, y
) != wxOutRegion
;
1156 bool wxWindowBase::IsExposed(int x
, int y
, int w
, int h
) const
1158 return m_updateRegion
.Contains(x
, y
, w
, h
) != wxOutRegion
;
1161 void wxWindowBase::ClearBackground()
1163 // wxGTK uses its own version, no need to add never used code
1165 wxClientDC
dc((wxWindow
*)this);
1166 wxBrush
brush(GetBackgroundColour(), wxSOLID
);
1167 dc
.SetBackground(brush
);
1172 // ----------------------------------------------------------------------------
1173 // find child window by id or name
1174 // ----------------------------------------------------------------------------
1176 wxWindow
*wxWindowBase::FindWindow( long id
)
1178 if ( id
== m_windowId
)
1179 return (wxWindow
*)this;
1181 wxWindowBase
*res
= (wxWindow
*)NULL
;
1182 wxWindowList::compatibility_iterator node
;
1183 for ( node
= m_children
.GetFirst(); node
&& !res
; node
= node
->GetNext() )
1185 wxWindowBase
*child
= node
->GetData();
1186 res
= child
->FindWindow( id
);
1189 return (wxWindow
*)res
;
1192 wxWindow
*wxWindowBase::FindWindow( const wxString
& name
)
1194 if ( name
== m_windowName
)
1195 return (wxWindow
*)this;
1197 wxWindowBase
*res
= (wxWindow
*)NULL
;
1198 wxWindowList::compatibility_iterator node
;
1199 for ( node
= m_children
.GetFirst(); node
&& !res
; node
= node
->GetNext() )
1201 wxWindow
*child
= node
->GetData();
1202 res
= child
->FindWindow(name
);
1205 return (wxWindow
*)res
;
1209 // find any window by id or name or label: If parent is non-NULL, look through
1210 // children for a label or title matching the specified string. If NULL, look
1211 // through all top-level windows.
1213 // to avoid duplicating code we reuse the same helper function but with
1214 // different comparators
1216 typedef bool (*wxFindWindowCmp
)(const wxWindow
*win
,
1217 const wxString
& label
, long id
);
1220 bool wxFindWindowCmpLabels(const wxWindow
*win
, const wxString
& label
,
1223 return win
->GetLabel() == label
;
1227 bool wxFindWindowCmpNames(const wxWindow
*win
, const wxString
& label
,
1230 return win
->GetName() == label
;
1234 bool wxFindWindowCmpIds(const wxWindow
*win
, const wxString
& WXUNUSED(label
),
1237 return win
->GetId() == id
;
1240 // recursive helper for the FindWindowByXXX() functions
1242 wxWindow
*wxFindWindowRecursively(const wxWindow
*parent
,
1243 const wxString
& label
,
1245 wxFindWindowCmp cmp
)
1249 // see if this is the one we're looking for
1250 if ( (*cmp
)(parent
, label
, id
) )
1251 return (wxWindow
*)parent
;
1253 // It wasn't, so check all its children
1254 for ( wxWindowList::compatibility_iterator node
= parent
->GetChildren().GetFirst();
1256 node
= node
->GetNext() )
1258 // recursively check each child
1259 wxWindow
*win
= (wxWindow
*)node
->GetData();
1260 wxWindow
*retwin
= wxFindWindowRecursively(win
, label
, id
, cmp
);
1270 // helper for FindWindowByXXX()
1272 wxWindow
*wxFindWindowHelper(const wxWindow
*parent
,
1273 const wxString
& label
,
1275 wxFindWindowCmp cmp
)
1279 // just check parent and all its children
1280 return wxFindWindowRecursively(parent
, label
, id
, cmp
);
1283 // start at very top of wx's windows
1284 for ( wxWindowList::compatibility_iterator node
= wxTopLevelWindows
.GetFirst();
1286 node
= node
->GetNext() )
1288 // recursively check each window & its children
1289 wxWindow
*win
= node
->GetData();
1290 wxWindow
*retwin
= wxFindWindowRecursively(win
, label
, id
, cmp
);
1300 wxWindowBase::FindWindowByLabel(const wxString
& title
, const wxWindow
*parent
)
1302 return wxFindWindowHelper(parent
, title
, 0, wxFindWindowCmpLabels
);
1307 wxWindowBase::FindWindowByName(const wxString
& title
, const wxWindow
*parent
)
1309 wxWindow
*win
= wxFindWindowHelper(parent
, title
, 0, wxFindWindowCmpNames
);
1313 // fall back to the label
1314 win
= FindWindowByLabel(title
, parent
);
1322 wxWindowBase::FindWindowById( long id
, const wxWindow
* parent
)
1324 return wxFindWindowHelper(parent
, _T(""), id
, wxFindWindowCmpIds
);
1327 // ----------------------------------------------------------------------------
1328 // dialog oriented functions
1329 // ----------------------------------------------------------------------------
1331 void wxWindowBase::MakeModal(bool modal
)
1333 // Disable all other windows
1336 wxWindowList::compatibility_iterator node
= wxTopLevelWindows
.GetFirst();
1339 wxWindow
*win
= node
->GetData();
1341 win
->Enable(!modal
);
1343 node
= node
->GetNext();
1348 bool wxWindowBase::Validate()
1350 #if wxUSE_VALIDATORS
1351 bool recurse
= (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) != 0;
1353 wxWindowList::compatibility_iterator node
;
1354 for ( node
= m_children
.GetFirst(); node
; node
= node
->GetNext() )
1356 wxWindowBase
*child
= node
->GetData();
1357 wxValidator
*validator
= child
->GetValidator();
1358 if ( validator
&& !validator
->Validate((wxWindow
*)this) )
1363 if ( recurse
&& !child
->Validate() )
1368 #endif // wxUSE_VALIDATORS
1373 bool wxWindowBase::TransferDataToWindow()
1375 #if wxUSE_VALIDATORS
1376 bool recurse
= (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) != 0;
1378 wxWindowList::compatibility_iterator node
;
1379 for ( node
= m_children
.GetFirst(); node
; node
= node
->GetNext() )
1381 wxWindowBase
*child
= node
->GetData();
1382 wxValidator
*validator
= child
->GetValidator();
1383 if ( validator
&& !validator
->TransferToWindow() )
1385 wxLogWarning(_("Could not transfer data to window"));
1387 wxLog::FlushActive();
1395 if ( !child
->TransferDataToWindow() )
1397 // warning already given
1402 #endif // wxUSE_VALIDATORS
1407 bool wxWindowBase::TransferDataFromWindow()
1409 #if wxUSE_VALIDATORS
1410 bool recurse
= (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) != 0;
1412 wxWindowList::compatibility_iterator node
;
1413 for ( node
= m_children
.GetFirst(); node
; node
= node
->GetNext() )
1415 wxWindow
*child
= node
->GetData();
1416 wxValidator
*validator
= child
->GetValidator();
1417 if ( validator
&& !validator
->TransferFromWindow() )
1419 // nop warning here because the application is supposed to give
1420 // one itself - we don't know here what might have gone wrongly
1427 if ( !child
->TransferDataFromWindow() )
1429 // warning already given
1434 #endif // wxUSE_VALIDATORS
1439 void wxWindowBase::InitDialog()
1441 wxInitDialogEvent
event(GetId());
1442 event
.SetEventObject( this );
1443 GetEventHandler()->ProcessEvent(event
);
1446 // ----------------------------------------------------------------------------
1447 // context-sensitive help support
1448 // ----------------------------------------------------------------------------
1452 // associate this help text with this window
1453 void wxWindowBase::SetHelpText(const wxString
& text
)
1455 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1458 helpProvider
->AddHelp(this, text
);
1462 // associate this help text with all windows with the same id as this
1464 void wxWindowBase::SetHelpTextForId(const wxString
& text
)
1466 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1469 helpProvider
->AddHelp(GetId(), text
);
1473 // get the help string associated with this window (may be empty)
1474 wxString
wxWindowBase::GetHelpText() const
1477 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1480 text
= helpProvider
->GetHelp(this);
1486 // show help for this window
1487 void wxWindowBase::OnHelp(wxHelpEvent
& event
)
1489 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1492 if ( helpProvider
->ShowHelp(this) )
1494 // skip the event.Skip() below
1502 #endif // wxUSE_HELP
1504 // ----------------------------------------------------------------------------
1505 // tooltipsroot.Replace("\\", "/");
1506 // ----------------------------------------------------------------------------
1510 void wxWindowBase::SetToolTip( const wxString
&tip
)
1512 // don't create the new tooltip if we already have one
1515 m_tooltip
->SetTip( tip
);
1519 SetToolTip( new wxToolTip( tip
) );
1522 // setting empty tooltip text does not remove the tooltip any more - use
1523 // SetToolTip((wxToolTip *)NULL) for this
1526 void wxWindowBase::DoSetToolTip(wxToolTip
*tooltip
)
1531 m_tooltip
= tooltip
;
1534 #endif // wxUSE_TOOLTIPS
1536 // ----------------------------------------------------------------------------
1537 // constraints and sizers
1538 // ----------------------------------------------------------------------------
1540 #if wxUSE_CONSTRAINTS
1542 void wxWindowBase::SetConstraints( wxLayoutConstraints
*constraints
)
1544 if ( m_constraints
)
1546 UnsetConstraints(m_constraints
);
1547 delete m_constraints
;
1549 m_constraints
= constraints
;
1550 if ( m_constraints
)
1552 // Make sure other windows know they're part of a 'meaningful relationship'
1553 if ( m_constraints
->left
.GetOtherWindow() && (m_constraints
->left
.GetOtherWindow() != this) )
1554 m_constraints
->left
.GetOtherWindow()->AddConstraintReference(this);
1555 if ( m_constraints
->top
.GetOtherWindow() && (m_constraints
->top
.GetOtherWindow() != this) )
1556 m_constraints
->top
.GetOtherWindow()->AddConstraintReference(this);
1557 if ( m_constraints
->right
.GetOtherWindow() && (m_constraints
->right
.GetOtherWindow() != this) )
1558 m_constraints
->right
.GetOtherWindow()->AddConstraintReference(this);
1559 if ( m_constraints
->bottom
.GetOtherWindow() && (m_constraints
->bottom
.GetOtherWindow() != this) )
1560 m_constraints
->bottom
.GetOtherWindow()->AddConstraintReference(this);
1561 if ( m_constraints
->width
.GetOtherWindow() && (m_constraints
->width
.GetOtherWindow() != this) )
1562 m_constraints
->width
.GetOtherWindow()->AddConstraintReference(this);
1563 if ( m_constraints
->height
.GetOtherWindow() && (m_constraints
->height
.GetOtherWindow() != this) )
1564 m_constraints
->height
.GetOtherWindow()->AddConstraintReference(this);
1565 if ( m_constraints
->centreX
.GetOtherWindow() && (m_constraints
->centreX
.GetOtherWindow() != this) )
1566 m_constraints
->centreX
.GetOtherWindow()->AddConstraintReference(this);
1567 if ( m_constraints
->centreY
.GetOtherWindow() && (m_constraints
->centreY
.GetOtherWindow() != this) )
1568 m_constraints
->centreY
.GetOtherWindow()->AddConstraintReference(this);
1572 // This removes any dangling pointers to this window in other windows'
1573 // constraintsInvolvedIn lists.
1574 void wxWindowBase::UnsetConstraints(wxLayoutConstraints
*c
)
1578 if ( c
->left
.GetOtherWindow() && (c
->top
.GetOtherWindow() != this) )
1579 c
->left
.GetOtherWindow()->RemoveConstraintReference(this);
1580 if ( c
->top
.GetOtherWindow() && (c
->top
.GetOtherWindow() != this) )
1581 c
->top
.GetOtherWindow()->RemoveConstraintReference(this);
1582 if ( c
->right
.GetOtherWindow() && (c
->right
.GetOtherWindow() != this) )
1583 c
->right
.GetOtherWindow()->RemoveConstraintReference(this);
1584 if ( c
->bottom
.GetOtherWindow() && (c
->bottom
.GetOtherWindow() != this) )
1585 c
->bottom
.GetOtherWindow()->RemoveConstraintReference(this);
1586 if ( c
->width
.GetOtherWindow() && (c
->width
.GetOtherWindow() != this) )
1587 c
->width
.GetOtherWindow()->RemoveConstraintReference(this);
1588 if ( c
->height
.GetOtherWindow() && (c
->height
.GetOtherWindow() != this) )
1589 c
->height
.GetOtherWindow()->RemoveConstraintReference(this);
1590 if ( c
->centreX
.GetOtherWindow() && (c
->centreX
.GetOtherWindow() != this) )
1591 c
->centreX
.GetOtherWindow()->RemoveConstraintReference(this);
1592 if ( c
->centreY
.GetOtherWindow() && (c
->centreY
.GetOtherWindow() != this) )
1593 c
->centreY
.GetOtherWindow()->RemoveConstraintReference(this);
1597 // Back-pointer to other windows we're involved with, so if we delete this
1598 // window, we must delete any constraints we're involved with.
1599 void wxWindowBase::AddConstraintReference(wxWindowBase
*otherWin
)
1601 if ( !m_constraintsInvolvedIn
)
1602 m_constraintsInvolvedIn
= new wxWindowList
;
1603 if ( !m_constraintsInvolvedIn
->Find((wxWindow
*)otherWin
) )
1604 m_constraintsInvolvedIn
->Append((wxWindow
*)otherWin
);
1607 // REMOVE back-pointer to other windows we're involved with.
1608 void wxWindowBase::RemoveConstraintReference(wxWindowBase
*otherWin
)
1610 if ( m_constraintsInvolvedIn
)
1611 m_constraintsInvolvedIn
->DeleteObject((wxWindow
*)otherWin
);
1614 // Reset any constraints that mention this window
1615 void wxWindowBase::DeleteRelatedConstraints()
1617 if ( m_constraintsInvolvedIn
)
1619 wxWindowList::compatibility_iterator node
= m_constraintsInvolvedIn
->GetFirst();
1622 wxWindow
*win
= node
->GetData();
1623 wxLayoutConstraints
*constr
= win
->GetConstraints();
1625 // Reset any constraints involving this window
1628 constr
->left
.ResetIfWin(this);
1629 constr
->top
.ResetIfWin(this);
1630 constr
->right
.ResetIfWin(this);
1631 constr
->bottom
.ResetIfWin(this);
1632 constr
->width
.ResetIfWin(this);
1633 constr
->height
.ResetIfWin(this);
1634 constr
->centreX
.ResetIfWin(this);
1635 constr
->centreY
.ResetIfWin(this);
1638 wxWindowList::compatibility_iterator next
= node
->GetNext();
1639 m_constraintsInvolvedIn
->Erase(node
);
1643 delete m_constraintsInvolvedIn
;
1644 m_constraintsInvolvedIn
= (wxWindowList
*) NULL
;
1648 #endif // wxUSE_CONSTRAINTS
1650 void wxWindowBase::SetSizer(wxSizer
*sizer
, bool deleteOld
)
1652 if ( sizer
== m_windowSizer
)
1656 delete m_windowSizer
;
1658 m_windowSizer
= sizer
;
1660 SetAutoLayout( sizer
!= NULL
);
1663 void wxWindowBase::SetSizerAndFit(wxSizer
*sizer
, bool deleteOld
)
1665 SetSizer( sizer
, deleteOld
);
1666 sizer
->SetSizeHints( (wxWindow
*) this );
1670 void wxWindowBase::SetContainingSizer(wxSizer
* sizer
)
1672 // adding a window to a sizer twice is going to result in fatal and
1673 // hard to debug problems later because when deleting the second
1674 // associated wxSizerItem we're going to dereference a dangling
1675 // pointer; so try to detect this as early as possible
1676 wxASSERT_MSG( !sizer
|| m_containingSizer
!= sizer
,
1677 _T("Adding a window to the same sizer twice?") );
1679 m_containingSizer
= sizer
;
1682 #if wxUSE_CONSTRAINTS
1684 void wxWindowBase::SatisfyConstraints()
1686 wxLayoutConstraints
*constr
= GetConstraints();
1687 bool wasOk
= constr
&& constr
->AreSatisfied();
1689 ResetConstraints(); // Mark all constraints as unevaluated
1693 // if we're a top level panel (i.e. our parent is frame/dialog), our
1694 // own constraints will never be satisfied any more unless we do it
1698 while ( noChanges
> 0 )
1700 LayoutPhase1(&noChanges
);
1704 LayoutPhase2(&noChanges
);
1707 #endif // wxUSE_CONSTRAINTS
1709 bool wxWindowBase::Layout()
1711 // If there is a sizer, use it instead of the constraints
1715 GetVirtualSize(&w
, &h
);
1716 GetSizer()->SetDimension( 0, 0, w
, h
);
1718 #if wxUSE_CONSTRAINTS
1721 SatisfyConstraints(); // Find the right constraints values
1722 SetConstraintSizes(); // Recursively set the real window sizes
1729 #if wxUSE_CONSTRAINTS
1731 // first phase of the constraints evaluation: set our own constraints
1732 bool wxWindowBase::LayoutPhase1(int *noChanges
)
1734 wxLayoutConstraints
*constr
= GetConstraints();
1736 return !constr
|| constr
->SatisfyConstraints(this, noChanges
);
1739 // second phase: set the constraints for our children
1740 bool wxWindowBase::LayoutPhase2(int *noChanges
)
1747 // Layout grand children
1753 // Do a phase of evaluating child constraints
1754 bool wxWindowBase::DoPhase(int phase
)
1756 // the list containing the children for which the constraints are already
1758 wxWindowList succeeded
;
1760 // the max number of iterations we loop before concluding that we can't set
1762 static const int maxIterations
= 500;
1764 for ( int noIterations
= 0; noIterations
< maxIterations
; noIterations
++ )
1768 // loop over all children setting their constraints
1769 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1771 node
= node
->GetNext() )
1773 wxWindow
*child
= node
->GetData();
1774 if ( child
->IsTopLevel() )
1776 // top level children are not inside our client area
1780 if ( !child
->GetConstraints() || succeeded
.Find(child
) )
1782 // this one is either already ok or nothing we can do about it
1786 int tempNoChanges
= 0;
1787 bool success
= phase
== 1 ? child
->LayoutPhase1(&tempNoChanges
)
1788 : child
->LayoutPhase2(&tempNoChanges
);
1789 noChanges
+= tempNoChanges
;
1793 succeeded
.Append(child
);
1799 // constraints are set
1807 void wxWindowBase::ResetConstraints()
1809 wxLayoutConstraints
*constr
= GetConstraints();
1812 constr
->left
.SetDone(false);
1813 constr
->top
.SetDone(false);
1814 constr
->right
.SetDone(false);
1815 constr
->bottom
.SetDone(false);
1816 constr
->width
.SetDone(false);
1817 constr
->height
.SetDone(false);
1818 constr
->centreX
.SetDone(false);
1819 constr
->centreY
.SetDone(false);
1822 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1825 wxWindow
*win
= node
->GetData();
1826 if ( !win
->IsTopLevel() )
1827 win
->ResetConstraints();
1828 node
= node
->GetNext();
1832 // Need to distinguish between setting the 'fake' size for windows and sizers,
1833 // and setting the real values.
1834 void wxWindowBase::SetConstraintSizes(bool recurse
)
1836 wxLayoutConstraints
*constr
= GetConstraints();
1837 if ( constr
&& constr
->AreSatisfied() )
1839 int x
= constr
->left
.GetValue();
1840 int y
= constr
->top
.GetValue();
1841 int w
= constr
->width
.GetValue();
1842 int h
= constr
->height
.GetValue();
1844 if ( (constr
->width
.GetRelationship() != wxAsIs
) ||
1845 (constr
->height
.GetRelationship() != wxAsIs
) )
1847 SetSize(x
, y
, w
, h
);
1851 // If we don't want to resize this window, just move it...
1857 wxLogDebug(wxT("Constraints not satisfied for %s named '%s'."),
1858 GetClassInfo()->GetClassName(),
1864 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1867 wxWindow
*win
= node
->GetData();
1868 if ( !win
->IsTopLevel() && win
->GetConstraints() )
1869 win
->SetConstraintSizes();
1870 node
= node
->GetNext();
1875 // Only set the size/position of the constraint (if any)
1876 void wxWindowBase::SetSizeConstraint(int x
, int y
, int w
, int h
)
1878 wxLayoutConstraints
*constr
= GetConstraints();
1881 if ( x
!= wxDefaultPosition
.x
)
1883 constr
->left
.SetValue(x
);
1884 constr
->left
.SetDone(true);
1886 if ( y
!= wxDefaultPosition
.y
)
1888 constr
->top
.SetValue(y
);
1889 constr
->top
.SetDone(true);
1891 if ( w
!= wxDefaultSize
.x
)
1893 constr
->width
.SetValue(w
);
1894 constr
->width
.SetDone(true);
1896 if ( h
!= wxDefaultSize
.y
)
1898 constr
->height
.SetValue(h
);
1899 constr
->height
.SetDone(true);
1904 void wxWindowBase::MoveConstraint(int x
, int y
)
1906 wxLayoutConstraints
*constr
= GetConstraints();
1909 if ( x
!= wxDefaultPosition
.x
)
1911 constr
->left
.SetValue(x
);
1912 constr
->left
.SetDone(true);
1914 if ( y
!= wxDefaultPosition
.y
)
1916 constr
->top
.SetValue(y
);
1917 constr
->top
.SetDone(true);
1922 void wxWindowBase::GetSizeConstraint(int *w
, int *h
) const
1924 wxLayoutConstraints
*constr
= GetConstraints();
1927 *w
= constr
->width
.GetValue();
1928 *h
= constr
->height
.GetValue();
1934 void wxWindowBase::GetClientSizeConstraint(int *w
, int *h
) const
1936 wxLayoutConstraints
*constr
= GetConstraints();
1939 *w
= constr
->width
.GetValue();
1940 *h
= constr
->height
.GetValue();
1943 GetClientSize(w
, h
);
1946 void wxWindowBase::GetPositionConstraint(int *x
, int *y
) const
1948 wxLayoutConstraints
*constr
= GetConstraints();
1951 *x
= constr
->left
.GetValue();
1952 *y
= constr
->top
.GetValue();
1958 #endif // wxUSE_CONSTRAINTS
1960 void wxWindowBase::AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
) const
1962 // don't do it for the dialogs/frames - they float independently of their
1964 if ( !IsTopLevel() )
1966 wxWindow
*parent
= GetParent();
1967 if ( !(sizeFlags
& wxSIZE_NO_ADJUSTMENTS
) && parent
)
1969 wxPoint
pt(parent
->GetClientAreaOrigin());
1976 // ----------------------------------------------------------------------------
1977 // do Update UI processing for child controls
1978 // ----------------------------------------------------------------------------
1980 void wxWindowBase::UpdateWindowUI(long flags
)
1982 wxUpdateUIEvent
event(GetId());
1983 event
.m_eventObject
= this;
1985 if ( GetEventHandler()->ProcessEvent(event
) )
1987 DoUpdateWindowUI(event
);
1990 if (flags
& wxUPDATE_UI_RECURSE
)
1992 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1995 wxWindow
* child
= (wxWindow
*) node
->GetData();
1996 child
->UpdateWindowUI(flags
);
1997 node
= node
->GetNext();
2002 // do the window-specific processing after processing the update event
2003 // TODO: take specific knowledge out of this function and
2004 // put in each control's base class. Unfortunately we don't
2005 // yet have base implementation files for wxCheckBox and wxRadioButton.
2006 void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent
& event
)
2008 if ( event
.GetSetEnabled() )
2009 Enable(event
.GetEnabled());
2012 if ( event
.GetSetText() )
2014 wxControl
*control
= wxDynamicCastThis(wxControl
);
2017 if ( event
.GetText() != control
->GetLabel() )
2018 control
->SetLabel(event
.GetText());
2021 wxCheckBox
*checkbox
= wxDynamicCastThis(wxCheckBox
);
2024 if ( event
.GetSetChecked() )
2025 checkbox
->SetValue(event
.GetChecked());
2027 #endif // wxUSE_CHECKBOX
2030 wxRadioButton
*radiobtn
= wxDynamicCastThis(wxRadioButton
);
2033 if ( event
.GetSetChecked() )
2034 radiobtn
->SetValue(event
.GetChecked());
2036 #endif // wxUSE_RADIOBTN
2042 // call internal idle recursively
2043 // may be obsolete (wait until OnIdle scheme stabilises)
2044 void wxWindowBase::ProcessInternalIdle()
2048 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
2051 wxWindow
*child
= node
->GetData();
2052 child
->ProcessInternalIdle();
2053 node
= node
->GetNext();
2058 // ----------------------------------------------------------------------------
2059 // dialog units translations
2060 // ----------------------------------------------------------------------------
2062 wxPoint
wxWindowBase::ConvertPixelsToDialog(const wxPoint
& pt
)
2064 int charWidth
= GetCharWidth();
2065 int charHeight
= GetCharHeight();
2066 wxPoint
pt2(-1, -1);
2068 pt2
.x
= (int) ((pt
.x
* 4) / charWidth
);
2070 pt2
.y
= (int) ((pt
.y
* 8) / charHeight
);
2075 wxPoint
wxWindowBase::ConvertDialogToPixels(const wxPoint
& pt
)
2077 int charWidth
= GetCharWidth();
2078 int charHeight
= GetCharHeight();
2079 wxPoint
pt2(-1, -1);
2081 pt2
.x
= (int) ((pt
.x
* charWidth
) / 4);
2083 pt2
.y
= (int) ((pt
.y
* charHeight
) / 8);
2088 // ----------------------------------------------------------------------------
2090 // ----------------------------------------------------------------------------
2092 // propagate the colour change event to the subwindows
2093 void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent
& event
)
2095 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
2098 // Only propagate to non-top-level windows
2099 wxWindow
*win
= node
->GetData();
2100 if ( !win
->IsTopLevel() )
2102 wxSysColourChangedEvent event2
;
2103 event
.m_eventObject
= win
;
2104 win
->GetEventHandler()->ProcessEvent(event2
);
2107 node
= node
->GetNext();
2113 // the default action is to populate dialog with data when it's created,
2114 // and nudge the UI into displaying itself correctly in case
2115 // we've turned the wxUpdateUIEvents frequency down low.
2116 void wxWindowBase::OnInitDialog( wxInitDialogEvent
&WXUNUSED(event
) )
2118 TransferDataToWindow();
2120 // Update the UI at this point
2121 UpdateWindowUI(wxUPDATE_UI_RECURSE
);
2124 // process Ctrl-Alt-mclick
2125 void wxWindowBase::OnMiddleClick( wxMouseEvent
& event
)
2128 if ( event
.ControlDown() && event
.AltDown() )
2130 // don't translate these strings
2133 #ifdef __WXUNIVERSAL__
2135 #endif // __WXUNIVERSAL__
2137 switch ( wxGetOsVersion() )
2139 case wxMOTIF_X
: port
+= _T("Motif"); break;
2141 case wxMAC_DARWIN
: port
+= _T("Mac"); break;
2142 case wxBEOS
: port
+= _T("BeOS"); break;
2146 case wxGTK_BEOS
: port
+= _T("GTK"); break;
2152 case wxWIN386
: port
+= _T("MS Windows"); break;
2156 case wxMGL_OS2
: port
+= _T("MGL"); break;
2158 case wxOS2_PM
: port
+= _T("OS/2"); break;
2159 default: port
+= _T("unknown"); break;
2162 wxMessageBox(wxString::Format(
2164 " wxWidgets Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n Copyright (c) 1995-2002 wxWidgets team"
2178 _T("wxWidgets information"),
2179 wxICON_INFORMATION
| wxOK
,
2183 #endif // wxUSE_MSGDLG
2189 // ----------------------------------------------------------------------------
2191 // ----------------------------------------------------------------------------
2193 #if wxUSE_ACCESSIBILITY
2194 void wxWindowBase::SetAccessible(wxAccessible
* accessible
)
2196 if (m_accessible
&& (accessible
!= m_accessible
))
2197 delete m_accessible
;
2198 m_accessible
= accessible
;
2200 m_accessible
->SetWindow((wxWindow
*) this);
2203 // Returns the accessible object, creating if necessary.
2204 wxAccessible
* wxWindowBase::GetOrCreateAccessible()
2207 m_accessible
= CreateAccessible();
2208 return m_accessible
;
2211 // Override to create a specific accessible object.
2212 wxAccessible
* wxWindowBase::CreateAccessible()
2214 return new wxWindowAccessible((wxWindow
*) this);
2220 // ----------------------------------------------------------------------------
2221 // list classes implementation
2222 // ----------------------------------------------------------------------------
2224 void wxWindowListNode::DeleteData()
2226 delete (wxWindow
*)GetData();
2230 // ----------------------------------------------------------------------------
2232 // ----------------------------------------------------------------------------
2234 wxBorder
wxWindowBase::GetBorder(long flags
) const
2236 wxBorder border
= (wxBorder
)(flags
& wxBORDER_MASK
);
2237 if ( border
== wxBORDER_DEFAULT
)
2239 border
= GetDefaultBorder();
2245 wxBorder
wxWindowBase::GetDefaultBorder() const
2247 return wxBORDER_NONE
;
2250 // ----------------------------------------------------------------------------
2252 // ----------------------------------------------------------------------------
2254 wxHitTest
wxWindowBase::DoHitTest(wxCoord x
, wxCoord y
) const
2256 // here we just check if the point is inside the window or not
2258 // check the top and left border first
2259 bool outside
= x
< 0 || y
< 0;
2262 // check the right and bottom borders too
2263 wxSize size
= GetSize();
2264 outside
= x
>= size
.x
|| y
>= size
.y
;
2267 return outside
? wxHT_WINDOW_OUTSIDE
: wxHT_WINDOW_INSIDE
;
2270 // ----------------------------------------------------------------------------
2272 // ----------------------------------------------------------------------------
2274 struct WXDLLEXPORT wxWindowNext
2278 } *wxWindowBase::ms_winCaptureNext
= NULL
;
2280 void wxWindowBase::CaptureMouse()
2282 wxLogTrace(_T("mousecapture"), _T("CaptureMouse(%p)"), this);
2284 wxWindow
*winOld
= GetCapture();
2287 ((wxWindowBase
*) winOld
)->DoReleaseMouse();
2290 wxWindowNext
*item
= new wxWindowNext
;
2292 item
->next
= ms_winCaptureNext
;
2293 ms_winCaptureNext
= item
;
2295 //else: no mouse capture to save
2300 void wxWindowBase::ReleaseMouse()
2302 wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(%p)"), this);
2304 wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") );
2308 if ( ms_winCaptureNext
)
2310 ((wxWindowBase
*)ms_winCaptureNext
->win
)->DoCaptureMouse();
2312 wxWindowNext
*item
= ms_winCaptureNext
;
2313 ms_winCaptureNext
= item
->next
;
2316 //else: stack is empty, no previous capture
2318 wxLogTrace(_T("mousecapture"),
2319 (const wxChar
*) _T("After ReleaseMouse() mouse is captured by %p"),
2326 wxWindowBase::RegisterHotKey(int WXUNUSED(hotkeyId
),
2327 int WXUNUSED(modifiers
),
2328 int WXUNUSED(keycode
))
2334 bool wxWindowBase::UnregisterHotKey(int WXUNUSED(hotkeyId
))
2340 #endif // wxUSE_HOTKEY
2342 void wxWindowBase::SendDestroyEvent()
2344 wxWindowDestroyEvent event
;
2345 event
.SetEventObject(this);
2346 event
.SetId(GetId());
2347 GetEventHandler()->ProcessEvent(event
);
2350 // ----------------------------------------------------------------------------
2352 // ----------------------------------------------------------------------------
2354 bool wxWindowBase::TryValidator(wxEvent
& wxVALIDATOR_PARAM(event
))
2356 #if wxUSE_VALIDATORS
2357 // Can only use the validator of the window which
2358 // is receiving the event
2359 if ( event
.GetEventObject() == this )
2361 wxValidator
*validator
= GetValidator();
2362 if ( validator
&& validator
->ProcessEvent(event
) )
2367 #endif // wxUSE_VALIDATORS
2372 bool wxWindowBase::TryParent(wxEvent
& event
)
2374 // carry on up the parent-child hierarchy if the propgation count hasn't
2376 if ( event
.ShouldPropagate() )
2378 // honour the requests to stop propagation at this window: this is
2379 // used by the dialogs, for example, to prevent processing the events
2380 // from the dialog controls in the parent frame which rarely, if ever,
2382 if ( !(GetExtraStyle() & wxWS_EX_BLOCK_EVENTS
) )
2384 wxWindow
*parent
= GetParent();
2385 if ( parent
&& !parent
->IsBeingDeleted() )
2387 wxPropagateOnce
propagateOnce(event
);
2389 return parent
->GetEventHandler()->ProcessEvent(event
);
2394 return wxEvtHandler::TryParent(event
);
2397 // ----------------------------------------------------------------------------
2399 // ----------------------------------------------------------------------------
2401 // Navigates in the specified direction.
2402 bool wxWindowBase::Navigate(int flags
)
2404 wxNavigationKeyEvent eventNav
;
2405 eventNav
.SetFlags(flags
);
2406 eventNav
.SetEventObject(this);
2407 if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav
) )
2414 // ----------------------------------------------------------------------------
2416 // ----------------------------------------------------------------------------
2418 wxWindow
* wxGetTopLevelParent(wxWindow
*win
)
2420 while ( win
&& !win
->IsTopLevel() )
2421 win
= win
->GetParent();
2426 #if wxUSE_ACCESSIBILITY
2427 // ----------------------------------------------------------------------------
2428 // accessible object for windows
2429 // ----------------------------------------------------------------------------
2431 // Can return either a child object, or an integer
2432 // representing the child element, starting from 1.
2433 wxAccStatus
wxWindowAccessible::HitTest(const wxPoint
& WXUNUSED(pt
), int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(childObject
))
2435 wxASSERT( GetWindow() != NULL
);
2439 return wxACC_NOT_IMPLEMENTED
;
2442 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
2443 wxAccStatus
wxWindowAccessible::GetLocation(wxRect
& rect
, int elementId
)
2445 wxASSERT( GetWindow() != NULL
);
2449 wxWindow
* win
= NULL
;
2456 if (elementId
<= (int) GetWindow()->GetChildren().GetCount())
2458 win
= GetWindow()->GetChildren().Item(elementId
-1)->GetData();
2465 rect
= win
->GetRect();
2466 if (win
->GetParent() && !win
->IsKindOf(CLASSINFO(wxTopLevelWindow
)))
2467 rect
.SetPosition(win
->GetParent()->ClientToScreen(rect
.GetPosition()));
2471 return wxACC_NOT_IMPLEMENTED
;
2474 // Navigates from fromId to toId/toObject.
2475 wxAccStatus
wxWindowAccessible::Navigate(wxNavDir navDir
, int fromId
,
2476 int* WXUNUSED(toId
), wxAccessible
** toObject
)
2478 wxASSERT( GetWindow() != NULL
);
2484 case wxNAVDIR_FIRSTCHILD
:
2486 if (GetWindow()->GetChildren().GetCount() == 0)
2488 wxWindow
* childWindow
= (wxWindow
*) GetWindow()->GetChildren().GetFirst()->GetData();
2489 *toObject
= childWindow
->GetOrCreateAccessible();
2493 case wxNAVDIR_LASTCHILD
:
2495 if (GetWindow()->GetChildren().GetCount() == 0)
2497 wxWindow
* childWindow
= (wxWindow
*) GetWindow()->GetChildren().GetLast()->GetData();
2498 *toObject
= childWindow
->GetOrCreateAccessible();
2502 case wxNAVDIR_RIGHT
:
2506 wxWindowList::compatibility_iterator node
=
2507 wxWindowList::compatibility_iterator();
2510 // Can't navigate to sibling of this window
2511 // if we're a top-level window.
2512 if (!GetWindow()->GetParent())
2513 return wxACC_NOT_IMPLEMENTED
;
2515 node
= GetWindow()->GetParent()->GetChildren().Find(GetWindow());
2519 if (fromId
<= (int) GetWindow()->GetChildren().GetCount())
2520 node
= GetWindow()->GetChildren().Item(fromId
-1);
2523 if (node
&& node
->GetNext())
2525 wxWindow
* nextWindow
= node
->GetNext()->GetData();
2526 *toObject
= nextWindow
->GetOrCreateAccessible();
2534 case wxNAVDIR_PREVIOUS
:
2536 wxWindowList::compatibility_iterator node
=
2537 wxWindowList::compatibility_iterator();
2540 // Can't navigate to sibling of this window
2541 // if we're a top-level window.
2542 if (!GetWindow()->GetParent())
2543 return wxACC_NOT_IMPLEMENTED
;
2545 node
= GetWindow()->GetParent()->GetChildren().Find(GetWindow());
2549 if (fromId
<= (int) GetWindow()->GetChildren().GetCount())
2550 node
= GetWindow()->GetChildren().Item(fromId
-1);
2553 if (node
&& node
->GetPrevious())
2555 wxWindow
* previousWindow
= node
->GetPrevious()->GetData();
2556 *toObject
= previousWindow
->GetOrCreateAccessible();
2564 return wxACC_NOT_IMPLEMENTED
;
2567 // Gets the name of the specified object.
2568 wxAccStatus
wxWindowAccessible::GetName(int childId
, wxString
* name
)
2570 wxASSERT( GetWindow() != NULL
);
2576 // If a child, leave wxWidgets to call the function on the actual
2579 return wxACC_NOT_IMPLEMENTED
;
2581 // This will eventually be replaced by specialised
2582 // accessible classes, one for each kind of wxWidgets
2583 // control or window.
2585 if (GetWindow()->IsKindOf(CLASSINFO(wxButton
)))
2586 title
= ((wxButton
*) GetWindow())->GetLabel();
2589 title
= GetWindow()->GetName();
2591 if (!title
.IsEmpty())
2597 return wxACC_NOT_IMPLEMENTED
;
2600 // Gets the number of children.
2601 wxAccStatus
wxWindowAccessible::GetChildCount(int* childId
)
2603 wxASSERT( GetWindow() != NULL
);
2607 *childId
= (int) GetWindow()->GetChildren().GetCount();
2611 // Gets the specified child (starting from 1).
2612 // If *child is NULL and return value is wxACC_OK,
2613 // this means that the child is a simple element and
2614 // not an accessible object.
2615 wxAccStatus
wxWindowAccessible::GetChild(int childId
, wxAccessible
** child
)
2617 wxASSERT( GetWindow() != NULL
);
2627 if (childId
> (int) GetWindow()->GetChildren().GetCount())
2630 wxWindow
* childWindow
= GetWindow()->GetChildren().Item(childId
-1)->GetData();
2631 *child
= childWindow
->GetOrCreateAccessible();
2638 // Gets the parent, or NULL.
2639 wxAccStatus
wxWindowAccessible::GetParent(wxAccessible
** parent
)
2641 wxASSERT( GetWindow() != NULL
);
2645 wxWindow
* parentWindow
= GetWindow()->GetParent();
2653 *parent
= parentWindow
->GetOrCreateAccessible();
2661 // Performs the default action. childId is 0 (the action for this object)
2662 // or > 0 (the action for a child).
2663 // Return wxACC_NOT_SUPPORTED if there is no default action for this
2664 // window (e.g. an edit control).
2665 wxAccStatus
wxWindowAccessible::DoDefaultAction(int WXUNUSED(childId
))
2667 wxASSERT( GetWindow() != NULL
);
2671 return wxACC_NOT_IMPLEMENTED
;
2674 // Gets the default action for this object (0) or > 0 (the action for a child).
2675 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
2676 // string if there is no action.
2677 // The retrieved string describes the action that is performed on an object,
2678 // not what the object does as a result. For example, a toolbar button that prints
2679 // a document has a default action of "Press" rather than "Prints the current document."
2680 wxAccStatus
wxWindowAccessible::GetDefaultAction(int WXUNUSED(childId
), wxString
* WXUNUSED(actionName
))
2682 wxASSERT( GetWindow() != NULL
);
2686 return wxACC_NOT_IMPLEMENTED
;
2689 // Returns the description for this object or a child.
2690 wxAccStatus
wxWindowAccessible::GetDescription(int WXUNUSED(childId
), wxString
* description
)
2692 wxASSERT( GetWindow() != NULL
);
2696 wxString
ht(GetWindow()->GetHelpText());
2702 return wxACC_NOT_IMPLEMENTED
;
2705 // Returns help text for this object or a child, similar to tooltip text.
2706 wxAccStatus
wxWindowAccessible::GetHelpText(int WXUNUSED(childId
), wxString
* helpText
)
2708 wxASSERT( GetWindow() != NULL
);
2712 wxString
ht(GetWindow()->GetHelpText());
2718 return wxACC_NOT_IMPLEMENTED
;
2721 // Returns the keyboard shortcut for this object or child.
2722 // Return e.g. ALT+K
2723 wxAccStatus
wxWindowAccessible::GetKeyboardShortcut(int WXUNUSED(childId
), wxString
* WXUNUSED(shortcut
))
2725 wxASSERT( GetWindow() != NULL
);
2729 return wxACC_NOT_IMPLEMENTED
;
2732 // Returns a role constant.
2733 wxAccStatus
wxWindowAccessible::GetRole(int childId
, wxAccRole
* role
)
2735 wxASSERT( GetWindow() != NULL
);
2739 // If a child, leave wxWidgets to call the function on the actual
2742 return wxACC_NOT_IMPLEMENTED
;
2744 if (GetWindow()->IsKindOf(CLASSINFO(wxControl
)))
2745 return wxACC_NOT_IMPLEMENTED
;
2747 if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar
)))
2748 return wxACC_NOT_IMPLEMENTED
;
2751 if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar
)))
2752 return wxACC_NOT_IMPLEMENTED
;
2755 //*role = wxROLE_SYSTEM_CLIENT;
2756 *role
= wxROLE_SYSTEM_CLIENT
;
2760 return wxACC_NOT_IMPLEMENTED
;
2764 // Returns a state constant.
2765 wxAccStatus
wxWindowAccessible::GetState(int childId
, long* state
)
2767 wxASSERT( GetWindow() != NULL
);
2771 // If a child, leave wxWidgets to call the function on the actual
2774 return wxACC_NOT_IMPLEMENTED
;
2776 if (GetWindow()->IsKindOf(CLASSINFO(wxControl
)))
2777 return wxACC_NOT_IMPLEMENTED
;
2780 if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar
)))
2781 return wxACC_NOT_IMPLEMENTED
;
2784 if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar
)))
2785 return wxACC_NOT_IMPLEMENTED
;
2792 return wxACC_NOT_IMPLEMENTED
;
2796 // Returns a localized string representing the value for the object
2798 wxAccStatus
wxWindowAccessible::GetValue(int WXUNUSED(childId
), wxString
* WXUNUSED(strValue
))
2800 wxASSERT( GetWindow() != NULL
);
2804 return wxACC_NOT_IMPLEMENTED
;
2807 // Selects the object or child.
2808 wxAccStatus
wxWindowAccessible::Select(int WXUNUSED(childId
), wxAccSelectionFlags
WXUNUSED(selectFlags
))
2810 wxASSERT( GetWindow() != NULL
);
2814 return wxACC_NOT_IMPLEMENTED
;
2817 // Gets the window with the keyboard focus.
2818 // If childId is 0 and child is NULL, no object in
2819 // this subhierarchy has the focus.
2820 // If this object has the focus, child should be 'this'.
2821 wxAccStatus
wxWindowAccessible::GetFocus(int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
2823 wxASSERT( GetWindow() != NULL
);
2827 return wxACC_NOT_IMPLEMENTED
;
2830 // Gets a variant representing the selected children
2832 // Acceptable values:
2833 // - a null variant (IsNull() returns TRUE)
2834 // - a list variant (GetType() == wxT("list")
2835 // - an integer representing the selected child element,
2836 // or 0 if this object is selected (GetType() == wxT("long")
2837 // - a "void*" pointer to a wxAccessible child object
2838 wxAccStatus
wxWindowAccessible::GetSelections(wxVariant
* WXUNUSED(selections
))
2840 wxASSERT( GetWindow() != NULL
);
2844 return wxACC_NOT_IMPLEMENTED
;
2847 #endif // wxUSE_ACCESSIBILITY