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 // invalidiated cache value
129 m_bestSizeCache
= wxDefaultSize
;
131 // window are created enabled and visible by default
135 // the default event handler is just this window
136 m_eventHandler
= this;
140 m_windowValidator
= (wxValidator
*) NULL
;
141 #endif // wxUSE_VALIDATORS
143 // the colours/fonts are default for now, so leave m_font,
144 // m_backgroundColour and m_foregroundColour uninitialized and set those
153 #if wxUSE_CONSTRAINTS
154 // no constraints whatsoever
155 m_constraints
= (wxLayoutConstraints
*) NULL
;
156 m_constraintsInvolvedIn
= (wxWindowList
*) NULL
;
157 #endif // wxUSE_CONSTRAINTS
159 m_windowSizer
= (wxSizer
*) NULL
;
160 m_containingSizer
= (wxSizer
*) NULL
;
161 m_autoLayout
= false;
163 #if wxUSE_DRAG_AND_DROP
164 m_dropTarget
= (wxDropTarget
*)NULL
;
165 #endif // wxUSE_DRAG_AND_DROP
168 m_tooltip
= (wxToolTip
*)NULL
;
169 #endif // wxUSE_TOOLTIPS
172 m_caret
= (wxCaret
*)NULL
;
173 #endif // wxUSE_CARET
176 m_hasCustomPalette
= false;
177 #endif // wxUSE_PALETTE
179 #if wxUSE_ACCESSIBILITY
183 m_virtualSize
= wxDefaultSize
;
186 m_maxVirtualWidth
= wxDefaultSize
.x
;
188 m_maxVirtualHeight
= wxDefaultSize
.y
;
190 m_windowVariant
= wxWINDOW_VARIANT_NORMAL
;
192 // Whether we're using the current theme for this window (wxGTK only for now)
193 m_themeEnabled
= false;
195 // VZ: this one shouldn't exist...
196 m_isBeingDeleted
= false;
199 // common part of window creation process
200 bool wxWindowBase::CreateBase(wxWindowBase
*parent
,
202 const wxPoint
& WXUNUSED(pos
),
203 const wxSize
& WXUNUSED(size
),
205 const wxValidator
& wxVALIDATOR_PARAM(validator
),
206 const wxString
& name
)
209 // wxGTK doesn't allow to create controls with static box as the parent so
210 // this will result in a crash when the program is ported to wxGTK so warn
213 // if you get this assert, the correct solution is to create the controls
214 // as siblings of the static box
215 wxASSERT_MSG( !parent
|| !wxDynamicCast(parent
, wxStaticBox
),
216 _T("wxStaticBox can't be used as a window parent!") );
217 #endif // wxUSE_STATBOX
219 // ids are limited to 16 bits under MSW so if you care about portability,
220 // it's not a good idea to use ids out of this range (and negative ids are
221 // reserved for wxWidgets own usage)
222 wxASSERT_MSG( id
== wxID_ANY
|| (id
>= 0 && id
< 32767),
223 _T("invalid id value") );
225 // generate a new id if the user doesn't care about it
226 m_windowId
= id
== wxID_ANY
? NewControlId() : id
;
229 SetWindowStyleFlag(style
);
233 SetValidator(validator
);
234 #endif // wxUSE_VALIDATORS
236 // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to
237 // have it too - like this it's possible to set it only in the top level
238 // dialog/frame and all children will inherit it by defult
239 if ( parent
&& (parent
->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) )
241 SetExtraStyle(GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY
);
247 // ----------------------------------------------------------------------------
249 // ----------------------------------------------------------------------------
252 wxWindowBase::~wxWindowBase()
254 wxASSERT_MSG( GetCapture() != this, wxT("attempt to destroy window with mouse capture") );
256 // FIXME if these 2 cases result from programming errors in the user code
257 // we should probably assert here instead of silently fixing them
259 // Just in case the window has been Closed, but we're then deleting
260 // immediately: don't leave dangling pointers.
261 wxPendingDelete
.DeleteObject(this);
263 // Just in case we've loaded a top-level window via LoadNativeDialog but
264 // we weren't a dialog class
265 wxTopLevelWindows
.DeleteObject((wxWindow
*)this);
267 wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
269 // reset the dangling pointer our parent window may keep to us
272 if ( m_parent
->GetDefaultItem() == this )
274 m_parent
->SetDefaultItem(NULL
);
277 m_parent
->RemoveChild(this);
282 #endif // wxUSE_CARET
285 delete m_windowValidator
;
286 #endif // wxUSE_VALIDATORS
288 #if wxUSE_CONSTRAINTS
289 // Have to delete constraints/sizer FIRST otherwise sizers may try to look
290 // at deleted windows as they delete themselves.
291 DeleteRelatedConstraints();
295 // This removes any dangling pointers to this window in other windows'
296 // constraintsInvolvedIn lists.
297 UnsetConstraints(m_constraints
);
298 delete m_constraints
;
299 m_constraints
= NULL
;
301 #endif // wxUSE_CONSTRAINTS
303 if ( m_containingSizer
)
304 m_containingSizer
->Detach( (wxWindow
*)this );
306 delete m_windowSizer
;
308 #if wxUSE_DRAG_AND_DROP
310 #endif // wxUSE_DRAG_AND_DROP
314 #endif // wxUSE_TOOLTIPS
316 #if wxUSE_ACCESSIBILITY
321 bool wxWindowBase::Destroy()
328 bool wxWindowBase::Close(bool force
)
330 wxCloseEvent
event(wxEVT_CLOSE_WINDOW
, m_windowId
);
331 event
.SetEventObject(this);
332 event
.SetCanVeto(!force
);
334 // return false if window wasn't closed because the application vetoed the
336 return GetEventHandler()->ProcessEvent(event
) && !event
.GetVeto();
339 bool wxWindowBase::DestroyChildren()
341 wxWindowList::compatibility_iterator node
;
344 // we iterate until the list becomes empty
345 node
= GetChildren().GetFirst();
349 wxWindow
*child
= node
->GetData();
351 // note that we really want to call delete and not ->Destroy() here
352 // because we want to delete the child immediately, before we are
353 // deleted, and delayed deletion would result in problems as our (top
354 // level) child could outlive its parent
357 wxASSERT_MSG( !GetChildren().Find(child
),
358 wxT("child didn't remove itself using RemoveChild()") );
364 // ----------------------------------------------------------------------------
365 // size/position related methods
366 // ----------------------------------------------------------------------------
368 // centre the window with respect to its parent in either (or both) directions
369 void wxWindowBase::Centre(int direction
)
371 // the position/size of the parent window or of the entire screen
373 int widthParent
, heightParent
;
375 wxWindow
*parent
= NULL
;
377 if ( !(direction
& wxCENTRE_ON_SCREEN
) )
379 // find the parent to centre this window on: it should be the
380 // immediate parent for the controls but the top level parent for the
381 // top level windows (like dialogs)
382 parent
= GetParent();
385 while ( parent
&& !parent
->IsTopLevel() )
387 parent
= parent
->GetParent();
391 // there is no wxTopLevelWindow under wxMotif yet
393 // we shouldn't center the dialog on the iconized window: under
394 // Windows, for example, this places it completely off the screen
397 wxTopLevelWindow
*winTop
= wxDynamicCast(parent
, wxTopLevelWindow
);
398 if ( winTop
&& winTop
->IsIconized() )
403 #endif // __WXMOTIF__
405 // did we find the parent?
409 direction
|= wxCENTRE_ON_SCREEN
;
413 if ( direction
& wxCENTRE_ON_SCREEN
)
415 // centre with respect to the whole screen
416 wxDisplaySize(&widthParent
, &heightParent
);
422 // centre on the parent
423 parent
->GetSize(&widthParent
, &heightParent
);
425 // adjust to the parents position
426 posParent
= parent
->GetPosition();
430 // centre inside the parents client rectangle
431 parent
->GetClientSize(&widthParent
, &heightParent
);
436 GetSize(&width
, &height
);
438 int xNew
= wxDefaultPosition
.x
,
439 yNew
= wxDefaultPosition
.y
;
441 if ( direction
& wxHORIZONTAL
)
442 xNew
= (widthParent
- width
)/2;
444 if ( direction
& wxVERTICAL
)
445 yNew
= (heightParent
- height
)/2;
450 // Base size of the visible dimensions of the display
451 // to take into account the taskbar
452 wxRect rect
= wxGetClientDisplayRect();
453 wxSize
size (rect
.width
,rect
.height
);
455 // NB: in wxMSW, negative position may not neccessary mean "out of screen",
456 // but it may mean that the window is placed on other than the main
457 // display. Therefore we only make sure centered window is on the main display
458 // if the parent is at least partially present here.
459 if (posParent
.x
+ widthParent
>= 0) // if parent is (partially) on the main display
463 else if (xNew
+width
> size
.x
)
464 xNew
= size
.x
-width
-1;
466 if (posParent
.y
+ heightParent
>= 0) // if parent is (partially) on the main display
468 if (yNew
+height
> size
.y
)
469 yNew
= size
.y
-height
-1;
471 // Make certain that the title bar is initially visible
472 // always, even if this would push the bottom of the
473 // dialog of the visible area of the display
478 // move the window to this position (keeping the old size but using
479 // SetSize() and not Move() to allow xNew and/or yNew to be -1)
480 SetSize(xNew
, yNew
, width
, height
, wxSIZE_ALLOW_MINUS_ONE
);
483 // fits the window around the children
484 void wxWindowBase::Fit()
486 if ( GetChildren().GetCount() > 0 )
488 SetClientSize(GetBestSize());
490 //else: do nothing if we have no children
493 // fits virtual size (ie. scrolled area etc.) around children
494 void wxWindowBase::FitInside()
496 if ( GetChildren().GetCount() > 0 )
498 SetVirtualSize( GetBestVirtualSize() );
502 // On Mac, scrollbars are explicitly children.
504 static bool wxHasRealChildren(const wxWindowBase
* win
)
506 int realChildCount
= 0;
508 for ( wxWindowList::compatibility_iterator node
= win
->GetChildren().GetFirst();
510 node
= node
->GetNext() )
512 wxWindow
*win
= node
->GetData();
513 if ( !win
->IsTopLevel() && win
->IsShown() && !win
->IsKindOf(CLASSINFO(wxScrollBar
)))
516 return (realChildCount
> 0);
520 // return the size best suited for the current window
521 wxSize
wxWindowBase::DoGetBestSize() const
525 return m_windowSizer
->GetMinSize();
527 #if wxUSE_CONSTRAINTS
528 else if ( m_constraints
)
530 wxConstCast(this, wxWindowBase
)->SatisfyConstraints();
532 // our minimal acceptable size is such that all our windows fit inside
536 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
538 node
= node
->GetNext() )
540 wxLayoutConstraints
*c
= node
->GetData()->GetConstraints();
543 // it's not normal that we have an unconstrained child, but
544 // what can we do about it?
548 int x
= c
->right
.GetValue(),
549 y
= c
->bottom
.GetValue();
557 // TODO: we must calculate the overlaps somehow, otherwise we
558 // will never return a size bigger than the current one :-(
561 return wxSize(maxX
, maxY
);
563 #endif // wxUSE_CONSTRAINTS
564 else if ( !GetChildren().empty()
566 && wxHasRealChildren(this)
570 // our minimal acceptable size is such that all our visible child windows fit inside
574 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
576 node
= node
->GetNext() )
578 wxWindow
*win
= node
->GetData();
579 if ( win
->IsTopLevel() || ( ! win
->IsShown() )
581 || wxDynamicCast(win
, wxStatusBar
)
582 #endif // wxUSE_STATUSBAR
585 // dialogs and frames lie in different top level windows -
586 // don't deal with them here; as for the status bars, they
587 // don't lie in the client area at all
592 win
->GetPosition(&wx
, &wy
);
594 // if the window hadn't been positioned yet, assume that it is in
596 if ( wx
== wxDefaultPosition
.x
)
598 if ( wy
== wxDefaultPosition
.y
)
601 win
->GetSize(&ww
, &wh
);
602 if ( wx
+ ww
> maxX
)
604 if ( wy
+ wh
> maxY
)
608 // for compatibility with the old versions and because it really looks
609 // slightly more pretty like this, add a pad
613 return wxSize(maxX
, maxY
);
615 else // ! has children
617 // for a generic window there is no natural best size - just use either the
618 // minimum size if there is one, or the current size
619 if ( GetMinSize().IsFullySpecified() )
627 wxSize
wxWindowBase::GetBestFittingSize() const
629 // merge the best size with the min size, giving priority to the min size
630 wxSize min
= GetMinSize();
631 if (min
.x
== wxDefaultCoord
|| min
.y
== wxDefaultCoord
)
633 wxSize best
= GetBestSize();
634 if (min
.x
== wxDefaultCoord
) min
.x
= best
.x
;
635 if (min
.y
== wxDefaultCoord
) min
.y
= best
.y
;
641 void wxWindowBase::SetBestFittingSize(const wxSize
& size
)
643 // Set the min size to the size passed in. This will usually either be
644 // wxDefaultSize or the size passed to this window's ctor/Create function.
647 // Merge the size with the best size if needed
648 wxSize best
= GetBestFittingSize();
650 // If the current size doesn't match then change it
651 if (GetSize() != best
)
656 // by default the origin is not shifted
657 wxPoint
wxWindowBase::GetClientAreaOrigin() const
659 return wxPoint(0, 0);
662 // set the min/max size of the window
663 void wxWindowBase::SetSizeHints(int minW
, int minH
,
665 int WXUNUSED(incW
), int WXUNUSED(incH
))
667 // setting min width greater than max width leads to infinite loops under
668 // X11 and generally doesn't make any sense, so don't allow it
669 wxCHECK_RET( (minW
== wxDefaultSize
.x
|| maxW
== wxDefaultSize
.x
|| minW
<= maxW
) &&
670 (minH
== wxDefaultSize
.y
|| maxH
== wxDefaultSize
.y
|| minH
<= maxH
),
671 _T("min width/height must be less than max width/height!") );
679 void wxWindowBase::SetWindowVariant( wxWindowVariant variant
)
681 if ( m_windowVariant
!= variant
)
683 m_windowVariant
= variant
;
685 DoSetWindowVariant(variant
);
689 void wxWindowBase::DoSetWindowVariant( wxWindowVariant variant
)
691 // adjust the font height to correspond to our new variant (notice that
692 // we're only called if something really changed)
693 wxFont font
= GetFont();
694 int size
= font
.GetPointSize();
697 case wxWINDOW_VARIANT_NORMAL
:
700 case wxWINDOW_VARIANT_SMALL
:
705 case wxWINDOW_VARIANT_MINI
:
710 case wxWINDOW_VARIANT_LARGE
:
716 wxFAIL_MSG(_T("unexpected window variant"));
720 font
.SetPointSize(size
);
724 void wxWindowBase::SetVirtualSizeHints( int minW
, int minH
,
727 m_minVirtualWidth
= minW
;
728 m_maxVirtualWidth
= maxW
;
729 m_minVirtualHeight
= minH
;
730 m_maxVirtualHeight
= maxH
;
733 void wxWindowBase::DoSetVirtualSize( int x
, int y
)
735 if ( m_minVirtualWidth
!= wxDefaultSize
.x
&& m_minVirtualWidth
> x
)
736 x
= m_minVirtualWidth
;
737 if ( m_maxVirtualWidth
!= wxDefaultSize
.x
&& m_maxVirtualWidth
< x
)
738 x
= m_maxVirtualWidth
;
739 if ( m_minVirtualHeight
!= wxDefaultSize
.y
&& m_minVirtualHeight
> y
)
740 y
= m_minVirtualHeight
;
741 if ( m_maxVirtualHeight
!= wxDefaultSize
.y
&& m_maxVirtualHeight
< y
)
742 y
= m_maxVirtualHeight
;
744 m_virtualSize
= wxSize(x
, y
);
747 wxSize
wxWindowBase::DoGetVirtualSize() const
749 wxSize
s( GetClientSize() );
751 return wxSize( wxMax( m_virtualSize
.GetWidth(), s
.GetWidth() ),
752 wxMax( m_virtualSize
.GetHeight(), s
.GetHeight() ) );
755 // ----------------------------------------------------------------------------
756 // show/hide/enable/disable the window
757 // ----------------------------------------------------------------------------
759 bool wxWindowBase::Show(bool show
)
761 if ( show
!= m_isShown
)
773 bool wxWindowBase::Enable(bool enable
)
775 if ( enable
!= m_isEnabled
)
777 m_isEnabled
= enable
;
786 // ----------------------------------------------------------------------------
788 // ----------------------------------------------------------------------------
790 bool wxWindowBase::IsTopLevel() const
795 // ----------------------------------------------------------------------------
796 // reparenting the window
797 // ----------------------------------------------------------------------------
799 void wxWindowBase::AddChild(wxWindowBase
*child
)
801 wxCHECK_RET( child
, wxT("can't add a NULL child") );
803 // this should never happen and it will lead to a crash later if it does
804 // because RemoveChild() will remove only one node from the children list
805 // and the other(s) one(s) will be left with dangling pointers in them
806 wxASSERT_MSG( !GetChildren().Find((wxWindow
*)child
), _T("AddChild() called twice") );
808 GetChildren().Append((wxWindow
*)child
);
809 child
->SetParent(this);
812 void wxWindowBase::RemoveChild(wxWindowBase
*child
)
814 wxCHECK_RET( child
, wxT("can't remove a NULL child") );
816 GetChildren().DeleteObject((wxWindow
*)child
);
817 child
->SetParent(NULL
);
820 bool wxWindowBase::Reparent(wxWindowBase
*newParent
)
822 wxWindow
*oldParent
= GetParent();
823 if ( newParent
== oldParent
)
829 // unlink this window from the existing parent.
832 oldParent
->RemoveChild(this);
836 wxTopLevelWindows
.DeleteObject((wxWindow
*)this);
839 // add it to the new one
842 newParent
->AddChild(this);
846 wxTopLevelWindows
.Append((wxWindow
*)this);
852 // ----------------------------------------------------------------------------
853 // event handler stuff
854 // ----------------------------------------------------------------------------
856 void wxWindowBase::PushEventHandler(wxEvtHandler
*handler
)
858 wxEvtHandler
*handlerOld
= GetEventHandler();
860 handler
->SetNextHandler(handlerOld
);
863 GetEventHandler()->SetPreviousHandler(handler
);
865 SetEventHandler(handler
);
868 wxEvtHandler
*wxWindowBase::PopEventHandler(bool deleteHandler
)
870 wxEvtHandler
*handlerA
= GetEventHandler();
873 wxEvtHandler
*handlerB
= handlerA
->GetNextHandler();
874 handlerA
->SetNextHandler((wxEvtHandler
*)NULL
);
877 handlerB
->SetPreviousHandler((wxEvtHandler
*)NULL
);
878 SetEventHandler(handlerB
);
883 handlerA
= (wxEvtHandler
*)NULL
;
890 bool wxWindowBase::RemoveEventHandler(wxEvtHandler
*handler
)
892 wxCHECK_MSG( handler
, false, _T("RemoveEventHandler(NULL) called") );
894 wxEvtHandler
*handlerPrev
= NULL
,
895 *handlerCur
= GetEventHandler();
898 wxEvtHandler
*handlerNext
= handlerCur
->GetNextHandler();
900 if ( handlerCur
== handler
)
904 handlerPrev
->SetNextHandler(handlerNext
);
908 SetEventHandler(handlerNext
);
913 handlerNext
->SetPreviousHandler ( handlerPrev
);
916 handler
->SetNextHandler(NULL
);
917 handler
->SetPreviousHandler(NULL
);
922 handlerPrev
= handlerCur
;
923 handlerCur
= handlerNext
;
926 wxFAIL_MSG( _T("where has the event handler gone?") );
931 // ----------------------------------------------------------------------------
933 // ----------------------------------------------------------------------------
935 void wxWindowBase::InheritAttributes()
937 const wxWindowBase
* const parent
= GetParent();
941 // we only inherit attributes which had been explicitly set for the parent
942 // which ensures that this only happens if the user really wants it and
943 // not by default which wouldn't make any sense in modern GUIs where the
944 // controls don't all use the same fonts (nor colours)
945 if ( parent
->m_hasFont
&& !m_hasFont
)
946 SetFont(parent
->GetFont());
948 // in addition, there is a possibility to explicitly forbid inheriting
949 // colours at each class level by overriding ShouldInheritColours()
950 if ( ShouldInheritColours() )
952 if ( parent
->m_hasFgCol
&& !m_hasFgCol
)
953 SetForegroundColour(parent
->GetForegroundColour());
955 if ( parent
->m_hasBgCol
&& !m_hasBgCol
)
956 SetBackgroundColour(parent
->GetBackgroundColour());
960 /* static */ wxVisualAttributes
961 wxWindowBase::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
963 // it is important to return valid values for all attributes from here,
964 // GetXXX() below rely on this
965 wxVisualAttributes attrs
;
966 attrs
.font
= wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
);
967 attrs
.colFg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT
);
968 attrs
.colBg
= wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE
);
973 wxColour
wxWindowBase::GetBackgroundColour() const
975 if ( !m_backgroundColour
.Ok() )
977 wxASSERT_MSG( !m_hasBgCol
, _T("we have invalid explicit bg colour?") );
979 // get our default background colour
980 wxColour colBg
= GetDefaultAttributes().colBg
;
982 // we must return some valid colour to avoid redoing this every time
983 // and also to avoid surprizing the applications written for older
984 // wxWidgets versions where GetBackgroundColour() always returned
985 // something -- so give them something even if it doesn't make sense
986 // for this window (e.g. it has a themed background)
988 colBg
= GetClassDefaultAttributes().colBg
;
993 return m_backgroundColour
;
996 wxColour
wxWindowBase::GetForegroundColour() const
998 // logic is the same as above
999 if ( !m_hasFgCol
&& !m_foregroundColour
.Ok() )
1001 wxASSERT_MSG( !m_hasFgCol
, _T("we have invalid explicit fg colour?") );
1003 wxColour colFg
= GetDefaultAttributes().colFg
;
1006 colFg
= GetClassDefaultAttributes().colFg
;
1011 return m_foregroundColour
;
1014 bool wxWindowBase::SetBackgroundColour( const wxColour
&colour
)
1016 if ( colour
== m_backgroundColour
)
1019 m_hasBgCol
= colour
.Ok();
1020 m_backgroundColour
= colour
;
1021 SetThemeEnabled( !m_hasBgCol
&& !m_foregroundColour
.Ok() );
1025 bool wxWindowBase::SetForegroundColour( const wxColour
&colour
)
1027 if (colour
== m_foregroundColour
)
1030 m_hasFgCol
= colour
.Ok();
1031 m_foregroundColour
= colour
;
1032 SetThemeEnabled( !m_hasFgCol
&& !m_backgroundColour
.Ok() );
1036 bool wxWindowBase::SetCursor(const wxCursor
& cursor
)
1038 // setting an invalid cursor is ok, it means that we don't have any special
1040 if ( m_cursor
== cursor
)
1051 wxFont
wxWindowBase::GetFont() const
1053 // logic is the same as in GetBackgroundColour()
1056 wxASSERT_MSG( !m_hasFont
, _T("we have invalid explicit font?") );
1058 wxFont font
= GetDefaultAttributes().font
;
1060 font
= GetClassDefaultAttributes().font
;
1068 bool wxWindowBase::SetFont(const wxFont
& font
)
1070 if ( font
== m_font
)
1077 m_hasFont
= font
.Ok();
1084 void wxWindowBase::SetPalette(const wxPalette
& pal
)
1086 m_hasCustomPalette
= true;
1089 // VZ: can anyone explain me what do we do here?
1090 wxWindowDC
d((wxWindow
*) this);
1094 wxWindow
*wxWindowBase::GetAncestorWithCustomPalette() const
1096 wxWindow
*win
= (wxWindow
*)this;
1097 while ( win
&& !win
->HasCustomPalette() )
1099 win
= win
->GetParent();
1105 #endif // wxUSE_PALETTE
1108 void wxWindowBase::SetCaret(wxCaret
*caret
)
1119 wxASSERT_MSG( m_caret
->GetWindow() == this,
1120 wxT("caret should be created associated to this window") );
1123 #endif // wxUSE_CARET
1125 #if wxUSE_VALIDATORS
1126 // ----------------------------------------------------------------------------
1128 // ----------------------------------------------------------------------------
1130 void wxWindowBase::SetValidator(const wxValidator
& validator
)
1132 if ( m_windowValidator
)
1133 delete m_windowValidator
;
1135 m_windowValidator
= (wxValidator
*)validator
.Clone();
1137 if ( m_windowValidator
)
1138 m_windowValidator
->SetWindow(this);
1140 #endif // wxUSE_VALIDATORS
1142 // ----------------------------------------------------------------------------
1143 // update region stuff
1144 // ----------------------------------------------------------------------------
1146 wxRect
wxWindowBase::GetUpdateClientRect() const
1148 wxRegion rgnUpdate
= GetUpdateRegion();
1149 rgnUpdate
.Intersect(GetClientRect());
1150 wxRect rectUpdate
= rgnUpdate
.GetBox();
1151 wxPoint ptOrigin
= GetClientAreaOrigin();
1152 rectUpdate
.x
-= ptOrigin
.x
;
1153 rectUpdate
.y
-= ptOrigin
.y
;
1158 bool wxWindowBase::IsExposed(int x
, int y
) const
1160 return m_updateRegion
.Contains(x
, y
) != wxOutRegion
;
1163 bool wxWindowBase::IsExposed(int x
, int y
, int w
, int h
) const
1165 return m_updateRegion
.Contains(x
, y
, w
, h
) != wxOutRegion
;
1168 void wxWindowBase::ClearBackground()
1170 // wxGTK uses its own version, no need to add never used code
1172 wxClientDC
dc((wxWindow
*)this);
1173 wxBrush
brush(GetBackgroundColour(), wxSOLID
);
1174 dc
.SetBackground(brush
);
1179 // ----------------------------------------------------------------------------
1180 // find child window by id or name
1181 // ----------------------------------------------------------------------------
1183 wxWindow
*wxWindowBase::FindWindow( long id
)
1185 if ( id
== m_windowId
)
1186 return (wxWindow
*)this;
1188 wxWindowBase
*res
= (wxWindow
*)NULL
;
1189 wxWindowList::compatibility_iterator node
;
1190 for ( node
= m_children
.GetFirst(); node
&& !res
; node
= node
->GetNext() )
1192 wxWindowBase
*child
= node
->GetData();
1193 res
= child
->FindWindow( id
);
1196 return (wxWindow
*)res
;
1199 wxWindow
*wxWindowBase::FindWindow( const wxString
& name
)
1201 if ( name
== m_windowName
)
1202 return (wxWindow
*)this;
1204 wxWindowBase
*res
= (wxWindow
*)NULL
;
1205 wxWindowList::compatibility_iterator node
;
1206 for ( node
= m_children
.GetFirst(); node
&& !res
; node
= node
->GetNext() )
1208 wxWindow
*child
= node
->GetData();
1209 res
= child
->FindWindow(name
);
1212 return (wxWindow
*)res
;
1216 // find any window by id or name or label: If parent is non-NULL, look through
1217 // children for a label or title matching the specified string. If NULL, look
1218 // through all top-level windows.
1220 // to avoid duplicating code we reuse the same helper function but with
1221 // different comparators
1223 typedef bool (*wxFindWindowCmp
)(const wxWindow
*win
,
1224 const wxString
& label
, long id
);
1227 bool wxFindWindowCmpLabels(const wxWindow
*win
, const wxString
& label
,
1230 return win
->GetLabel() == label
;
1234 bool wxFindWindowCmpNames(const wxWindow
*win
, const wxString
& label
,
1237 return win
->GetName() == label
;
1241 bool wxFindWindowCmpIds(const wxWindow
*win
, const wxString
& WXUNUSED(label
),
1244 return win
->GetId() == id
;
1247 // recursive helper for the FindWindowByXXX() functions
1249 wxWindow
*wxFindWindowRecursively(const wxWindow
*parent
,
1250 const wxString
& label
,
1252 wxFindWindowCmp cmp
)
1256 // see if this is the one we're looking for
1257 if ( (*cmp
)(parent
, label
, id
) )
1258 return (wxWindow
*)parent
;
1260 // It wasn't, so check all its children
1261 for ( wxWindowList::compatibility_iterator node
= parent
->GetChildren().GetFirst();
1263 node
= node
->GetNext() )
1265 // recursively check each child
1266 wxWindow
*win
= (wxWindow
*)node
->GetData();
1267 wxWindow
*retwin
= wxFindWindowRecursively(win
, label
, id
, cmp
);
1277 // helper for FindWindowByXXX()
1279 wxWindow
*wxFindWindowHelper(const wxWindow
*parent
,
1280 const wxString
& label
,
1282 wxFindWindowCmp cmp
)
1286 // just check parent and all its children
1287 return wxFindWindowRecursively(parent
, label
, id
, cmp
);
1290 // start at very top of wx's windows
1291 for ( wxWindowList::compatibility_iterator node
= wxTopLevelWindows
.GetFirst();
1293 node
= node
->GetNext() )
1295 // recursively check each window & its children
1296 wxWindow
*win
= node
->GetData();
1297 wxWindow
*retwin
= wxFindWindowRecursively(win
, label
, id
, cmp
);
1307 wxWindowBase::FindWindowByLabel(const wxString
& title
, const wxWindow
*parent
)
1309 return wxFindWindowHelper(parent
, title
, 0, wxFindWindowCmpLabels
);
1314 wxWindowBase::FindWindowByName(const wxString
& title
, const wxWindow
*parent
)
1316 wxWindow
*win
= wxFindWindowHelper(parent
, title
, 0, wxFindWindowCmpNames
);
1320 // fall back to the label
1321 win
= FindWindowByLabel(title
, parent
);
1329 wxWindowBase::FindWindowById( long id
, const wxWindow
* parent
)
1331 return wxFindWindowHelper(parent
, _T(""), id
, wxFindWindowCmpIds
);
1334 // ----------------------------------------------------------------------------
1335 // dialog oriented functions
1336 // ----------------------------------------------------------------------------
1338 void wxWindowBase::MakeModal(bool modal
)
1340 // Disable all other windows
1343 wxWindowList::compatibility_iterator node
= wxTopLevelWindows
.GetFirst();
1346 wxWindow
*win
= node
->GetData();
1348 win
->Enable(!modal
);
1350 node
= node
->GetNext();
1355 bool wxWindowBase::Validate()
1357 #if wxUSE_VALIDATORS
1358 bool recurse
= (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) != 0;
1360 wxWindowList::compatibility_iterator node
;
1361 for ( node
= m_children
.GetFirst(); node
; node
= node
->GetNext() )
1363 wxWindowBase
*child
= node
->GetData();
1364 wxValidator
*validator
= child
->GetValidator();
1365 if ( validator
&& !validator
->Validate((wxWindow
*)this) )
1370 if ( recurse
&& !child
->Validate() )
1375 #endif // wxUSE_VALIDATORS
1380 bool wxWindowBase::TransferDataToWindow()
1382 #if wxUSE_VALIDATORS
1383 bool recurse
= (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) != 0;
1385 wxWindowList::compatibility_iterator node
;
1386 for ( node
= m_children
.GetFirst(); node
; node
= node
->GetNext() )
1388 wxWindowBase
*child
= node
->GetData();
1389 wxValidator
*validator
= child
->GetValidator();
1390 if ( validator
&& !validator
->TransferToWindow() )
1392 wxLogWarning(_("Could not transfer data to window"));
1394 wxLog::FlushActive();
1402 if ( !child
->TransferDataToWindow() )
1404 // warning already given
1409 #endif // wxUSE_VALIDATORS
1414 bool wxWindowBase::TransferDataFromWindow()
1416 #if wxUSE_VALIDATORS
1417 bool recurse
= (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY
) != 0;
1419 wxWindowList::compatibility_iterator node
;
1420 for ( node
= m_children
.GetFirst(); node
; node
= node
->GetNext() )
1422 wxWindow
*child
= node
->GetData();
1423 wxValidator
*validator
= child
->GetValidator();
1424 if ( validator
&& !validator
->TransferFromWindow() )
1426 // nop warning here because the application is supposed to give
1427 // one itself - we don't know here what might have gone wrongly
1434 if ( !child
->TransferDataFromWindow() )
1436 // warning already given
1441 #endif // wxUSE_VALIDATORS
1446 void wxWindowBase::InitDialog()
1448 wxInitDialogEvent
event(GetId());
1449 event
.SetEventObject( this );
1450 GetEventHandler()->ProcessEvent(event
);
1453 // ----------------------------------------------------------------------------
1454 // context-sensitive help support
1455 // ----------------------------------------------------------------------------
1459 // associate this help text with this window
1460 void wxWindowBase::SetHelpText(const wxString
& text
)
1462 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1465 helpProvider
->AddHelp(this, text
);
1469 // associate this help text with all windows with the same id as this
1471 void wxWindowBase::SetHelpTextForId(const wxString
& text
)
1473 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1476 helpProvider
->AddHelp(GetId(), text
);
1480 // get the help string associated with this window (may be empty)
1481 wxString
wxWindowBase::GetHelpText() const
1484 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1487 text
= helpProvider
->GetHelp(this);
1493 // show help for this window
1494 void wxWindowBase::OnHelp(wxHelpEvent
& event
)
1496 wxHelpProvider
*helpProvider
= wxHelpProvider::Get();
1499 if ( helpProvider
->ShowHelp(this) )
1501 // skip the event.Skip() below
1509 #endif // wxUSE_HELP
1511 // ----------------------------------------------------------------------------
1512 // tooltipsroot.Replace("\\", "/");
1513 // ----------------------------------------------------------------------------
1517 void wxWindowBase::SetToolTip( const wxString
&tip
)
1519 // don't create the new tooltip if we already have one
1522 m_tooltip
->SetTip( tip
);
1526 SetToolTip( new wxToolTip( tip
) );
1529 // setting empty tooltip text does not remove the tooltip any more - use
1530 // SetToolTip((wxToolTip *)NULL) for this
1533 void wxWindowBase::DoSetToolTip(wxToolTip
*tooltip
)
1538 m_tooltip
= tooltip
;
1541 #endif // wxUSE_TOOLTIPS
1543 // ----------------------------------------------------------------------------
1544 // constraints and sizers
1545 // ----------------------------------------------------------------------------
1547 #if wxUSE_CONSTRAINTS
1549 void wxWindowBase::SetConstraints( wxLayoutConstraints
*constraints
)
1551 if ( m_constraints
)
1553 UnsetConstraints(m_constraints
);
1554 delete m_constraints
;
1556 m_constraints
= constraints
;
1557 if ( m_constraints
)
1559 // Make sure other windows know they're part of a 'meaningful relationship'
1560 if ( m_constraints
->left
.GetOtherWindow() && (m_constraints
->left
.GetOtherWindow() != this) )
1561 m_constraints
->left
.GetOtherWindow()->AddConstraintReference(this);
1562 if ( m_constraints
->top
.GetOtherWindow() && (m_constraints
->top
.GetOtherWindow() != this) )
1563 m_constraints
->top
.GetOtherWindow()->AddConstraintReference(this);
1564 if ( m_constraints
->right
.GetOtherWindow() && (m_constraints
->right
.GetOtherWindow() != this) )
1565 m_constraints
->right
.GetOtherWindow()->AddConstraintReference(this);
1566 if ( m_constraints
->bottom
.GetOtherWindow() && (m_constraints
->bottom
.GetOtherWindow() != this) )
1567 m_constraints
->bottom
.GetOtherWindow()->AddConstraintReference(this);
1568 if ( m_constraints
->width
.GetOtherWindow() && (m_constraints
->width
.GetOtherWindow() != this) )
1569 m_constraints
->width
.GetOtherWindow()->AddConstraintReference(this);
1570 if ( m_constraints
->height
.GetOtherWindow() && (m_constraints
->height
.GetOtherWindow() != this) )
1571 m_constraints
->height
.GetOtherWindow()->AddConstraintReference(this);
1572 if ( m_constraints
->centreX
.GetOtherWindow() && (m_constraints
->centreX
.GetOtherWindow() != this) )
1573 m_constraints
->centreX
.GetOtherWindow()->AddConstraintReference(this);
1574 if ( m_constraints
->centreY
.GetOtherWindow() && (m_constraints
->centreY
.GetOtherWindow() != this) )
1575 m_constraints
->centreY
.GetOtherWindow()->AddConstraintReference(this);
1579 // This removes any dangling pointers to this window in other windows'
1580 // constraintsInvolvedIn lists.
1581 void wxWindowBase::UnsetConstraints(wxLayoutConstraints
*c
)
1585 if ( c
->left
.GetOtherWindow() && (c
->top
.GetOtherWindow() != this) )
1586 c
->left
.GetOtherWindow()->RemoveConstraintReference(this);
1587 if ( c
->top
.GetOtherWindow() && (c
->top
.GetOtherWindow() != this) )
1588 c
->top
.GetOtherWindow()->RemoveConstraintReference(this);
1589 if ( c
->right
.GetOtherWindow() && (c
->right
.GetOtherWindow() != this) )
1590 c
->right
.GetOtherWindow()->RemoveConstraintReference(this);
1591 if ( c
->bottom
.GetOtherWindow() && (c
->bottom
.GetOtherWindow() != this) )
1592 c
->bottom
.GetOtherWindow()->RemoveConstraintReference(this);
1593 if ( c
->width
.GetOtherWindow() && (c
->width
.GetOtherWindow() != this) )
1594 c
->width
.GetOtherWindow()->RemoveConstraintReference(this);
1595 if ( c
->height
.GetOtherWindow() && (c
->height
.GetOtherWindow() != this) )
1596 c
->height
.GetOtherWindow()->RemoveConstraintReference(this);
1597 if ( c
->centreX
.GetOtherWindow() && (c
->centreX
.GetOtherWindow() != this) )
1598 c
->centreX
.GetOtherWindow()->RemoveConstraintReference(this);
1599 if ( c
->centreY
.GetOtherWindow() && (c
->centreY
.GetOtherWindow() != this) )
1600 c
->centreY
.GetOtherWindow()->RemoveConstraintReference(this);
1604 // Back-pointer to other windows we're involved with, so if we delete this
1605 // window, we must delete any constraints we're involved with.
1606 void wxWindowBase::AddConstraintReference(wxWindowBase
*otherWin
)
1608 if ( !m_constraintsInvolvedIn
)
1609 m_constraintsInvolvedIn
= new wxWindowList
;
1610 if ( !m_constraintsInvolvedIn
->Find((wxWindow
*)otherWin
) )
1611 m_constraintsInvolvedIn
->Append((wxWindow
*)otherWin
);
1614 // REMOVE back-pointer to other windows we're involved with.
1615 void wxWindowBase::RemoveConstraintReference(wxWindowBase
*otherWin
)
1617 if ( m_constraintsInvolvedIn
)
1618 m_constraintsInvolvedIn
->DeleteObject((wxWindow
*)otherWin
);
1621 // Reset any constraints that mention this window
1622 void wxWindowBase::DeleteRelatedConstraints()
1624 if ( m_constraintsInvolvedIn
)
1626 wxWindowList::compatibility_iterator node
= m_constraintsInvolvedIn
->GetFirst();
1629 wxWindow
*win
= node
->GetData();
1630 wxLayoutConstraints
*constr
= win
->GetConstraints();
1632 // Reset any constraints involving this window
1635 constr
->left
.ResetIfWin(this);
1636 constr
->top
.ResetIfWin(this);
1637 constr
->right
.ResetIfWin(this);
1638 constr
->bottom
.ResetIfWin(this);
1639 constr
->width
.ResetIfWin(this);
1640 constr
->height
.ResetIfWin(this);
1641 constr
->centreX
.ResetIfWin(this);
1642 constr
->centreY
.ResetIfWin(this);
1645 wxWindowList::compatibility_iterator next
= node
->GetNext();
1646 m_constraintsInvolvedIn
->Erase(node
);
1650 delete m_constraintsInvolvedIn
;
1651 m_constraintsInvolvedIn
= (wxWindowList
*) NULL
;
1655 #endif // wxUSE_CONSTRAINTS
1657 void wxWindowBase::SetSizer(wxSizer
*sizer
, bool deleteOld
)
1659 if ( sizer
== m_windowSizer
)
1663 delete m_windowSizer
;
1665 m_windowSizer
= sizer
;
1667 SetAutoLayout( sizer
!= NULL
);
1670 void wxWindowBase::SetSizerAndFit(wxSizer
*sizer
, bool deleteOld
)
1672 SetSizer( sizer
, deleteOld
);
1673 sizer
->SetSizeHints( (wxWindow
*) this );
1677 void wxWindowBase::SetContainingSizer(wxSizer
* sizer
)
1679 // adding a window to a sizer twice is going to result in fatal and
1680 // hard to debug problems later because when deleting the second
1681 // associated wxSizerItem we're going to dereference a dangling
1682 // pointer; so try to detect this as early as possible
1683 wxASSERT_MSG( !sizer
|| m_containingSizer
!= sizer
,
1684 _T("Adding a window to the same sizer twice?") );
1686 m_containingSizer
= sizer
;
1689 #if wxUSE_CONSTRAINTS
1691 void wxWindowBase::SatisfyConstraints()
1693 wxLayoutConstraints
*constr
= GetConstraints();
1694 bool wasOk
= constr
&& constr
->AreSatisfied();
1696 ResetConstraints(); // Mark all constraints as unevaluated
1700 // if we're a top level panel (i.e. our parent is frame/dialog), our
1701 // own constraints will never be satisfied any more unless we do it
1705 while ( noChanges
> 0 )
1707 LayoutPhase1(&noChanges
);
1711 LayoutPhase2(&noChanges
);
1714 #endif // wxUSE_CONSTRAINTS
1716 bool wxWindowBase::Layout()
1718 // If there is a sizer, use it instead of the constraints
1722 GetVirtualSize(&w
, &h
);
1723 GetSizer()->SetDimension( 0, 0, w
, h
);
1725 #if wxUSE_CONSTRAINTS
1728 SatisfyConstraints(); // Find the right constraints values
1729 SetConstraintSizes(); // Recursively set the real window sizes
1736 #if wxUSE_CONSTRAINTS
1738 // first phase of the constraints evaluation: set our own constraints
1739 bool wxWindowBase::LayoutPhase1(int *noChanges
)
1741 wxLayoutConstraints
*constr
= GetConstraints();
1743 return !constr
|| constr
->SatisfyConstraints(this, noChanges
);
1746 // second phase: set the constraints for our children
1747 bool wxWindowBase::LayoutPhase2(int *noChanges
)
1754 // Layout grand children
1760 // Do a phase of evaluating child constraints
1761 bool wxWindowBase::DoPhase(int phase
)
1763 // the list containing the children for which the constraints are already
1765 wxWindowList succeeded
;
1767 // the max number of iterations we loop before concluding that we can't set
1769 static const int maxIterations
= 500;
1771 for ( int noIterations
= 0; noIterations
< maxIterations
; noIterations
++ )
1775 // loop over all children setting their constraints
1776 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1778 node
= node
->GetNext() )
1780 wxWindow
*child
= node
->GetData();
1781 if ( child
->IsTopLevel() )
1783 // top level children are not inside our client area
1787 if ( !child
->GetConstraints() || succeeded
.Find(child
) )
1789 // this one is either already ok or nothing we can do about it
1793 int tempNoChanges
= 0;
1794 bool success
= phase
== 1 ? child
->LayoutPhase1(&tempNoChanges
)
1795 : child
->LayoutPhase2(&tempNoChanges
);
1796 noChanges
+= tempNoChanges
;
1800 succeeded
.Append(child
);
1806 // constraints are set
1814 void wxWindowBase::ResetConstraints()
1816 wxLayoutConstraints
*constr
= GetConstraints();
1819 constr
->left
.SetDone(false);
1820 constr
->top
.SetDone(false);
1821 constr
->right
.SetDone(false);
1822 constr
->bottom
.SetDone(false);
1823 constr
->width
.SetDone(false);
1824 constr
->height
.SetDone(false);
1825 constr
->centreX
.SetDone(false);
1826 constr
->centreY
.SetDone(false);
1829 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1832 wxWindow
*win
= node
->GetData();
1833 if ( !win
->IsTopLevel() )
1834 win
->ResetConstraints();
1835 node
= node
->GetNext();
1839 // Need to distinguish between setting the 'fake' size for windows and sizers,
1840 // and setting the real values.
1841 void wxWindowBase::SetConstraintSizes(bool recurse
)
1843 wxLayoutConstraints
*constr
= GetConstraints();
1844 if ( constr
&& constr
->AreSatisfied() )
1846 int x
= constr
->left
.GetValue();
1847 int y
= constr
->top
.GetValue();
1848 int w
= constr
->width
.GetValue();
1849 int h
= constr
->height
.GetValue();
1851 if ( (constr
->width
.GetRelationship() != wxAsIs
) ||
1852 (constr
->height
.GetRelationship() != wxAsIs
) )
1854 SetSize(x
, y
, w
, h
);
1858 // If we don't want to resize this window, just move it...
1864 wxLogDebug(wxT("Constraints not satisfied for %s named '%s'."),
1865 GetClassInfo()->GetClassName(),
1871 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
1874 wxWindow
*win
= node
->GetData();
1875 if ( !win
->IsTopLevel() && win
->GetConstraints() )
1876 win
->SetConstraintSizes();
1877 node
= node
->GetNext();
1882 // Only set the size/position of the constraint (if any)
1883 void wxWindowBase::SetSizeConstraint(int x
, int y
, int w
, int h
)
1885 wxLayoutConstraints
*constr
= GetConstraints();
1888 if ( x
!= wxDefaultPosition
.x
)
1890 constr
->left
.SetValue(x
);
1891 constr
->left
.SetDone(true);
1893 if ( y
!= wxDefaultPosition
.y
)
1895 constr
->top
.SetValue(y
);
1896 constr
->top
.SetDone(true);
1898 if ( w
!= wxDefaultSize
.x
)
1900 constr
->width
.SetValue(w
);
1901 constr
->width
.SetDone(true);
1903 if ( h
!= wxDefaultSize
.y
)
1905 constr
->height
.SetValue(h
);
1906 constr
->height
.SetDone(true);
1911 void wxWindowBase::MoveConstraint(int x
, int y
)
1913 wxLayoutConstraints
*constr
= GetConstraints();
1916 if ( x
!= wxDefaultPosition
.x
)
1918 constr
->left
.SetValue(x
);
1919 constr
->left
.SetDone(true);
1921 if ( y
!= wxDefaultPosition
.y
)
1923 constr
->top
.SetValue(y
);
1924 constr
->top
.SetDone(true);
1929 void wxWindowBase::GetSizeConstraint(int *w
, int *h
) const
1931 wxLayoutConstraints
*constr
= GetConstraints();
1934 *w
= constr
->width
.GetValue();
1935 *h
= constr
->height
.GetValue();
1941 void wxWindowBase::GetClientSizeConstraint(int *w
, int *h
) const
1943 wxLayoutConstraints
*constr
= GetConstraints();
1946 *w
= constr
->width
.GetValue();
1947 *h
= constr
->height
.GetValue();
1950 GetClientSize(w
, h
);
1953 void wxWindowBase::GetPositionConstraint(int *x
, int *y
) const
1955 wxLayoutConstraints
*constr
= GetConstraints();
1958 *x
= constr
->left
.GetValue();
1959 *y
= constr
->top
.GetValue();
1965 #endif // wxUSE_CONSTRAINTS
1967 void wxWindowBase::AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
) const
1969 // don't do it for the dialogs/frames - they float independently of their
1971 if ( !IsTopLevel() )
1973 wxWindow
*parent
= GetParent();
1974 if ( !(sizeFlags
& wxSIZE_NO_ADJUSTMENTS
) && parent
)
1976 wxPoint
pt(parent
->GetClientAreaOrigin());
1983 // ----------------------------------------------------------------------------
1984 // do Update UI processing for child controls
1985 // ----------------------------------------------------------------------------
1987 void wxWindowBase::UpdateWindowUI(long flags
)
1989 wxUpdateUIEvent
event(GetId());
1990 event
.m_eventObject
= this;
1992 if ( GetEventHandler()->ProcessEvent(event
) )
1994 DoUpdateWindowUI(event
);
1997 if (flags
& wxUPDATE_UI_RECURSE
)
1999 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
2002 wxWindow
* child
= (wxWindow
*) node
->GetData();
2003 child
->UpdateWindowUI(flags
);
2004 node
= node
->GetNext();
2009 // do the window-specific processing after processing the update event
2010 // TODO: take specific knowledge out of this function and
2011 // put in each control's base class. Unfortunately we don't
2012 // yet have base implementation files for wxCheckBox and wxRadioButton.
2013 void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent
& event
)
2015 if ( event
.GetSetEnabled() )
2016 Enable(event
.GetEnabled());
2019 if ( event
.GetSetText() )
2021 wxControl
*control
= wxDynamicCastThis(wxControl
);
2024 if ( event
.GetText() != control
->GetLabel() )
2025 control
->SetLabel(event
.GetText());
2028 wxCheckBox
*checkbox
= wxDynamicCastThis(wxCheckBox
);
2031 if ( event
.GetSetChecked() )
2032 checkbox
->SetValue(event
.GetChecked());
2034 #endif // wxUSE_CHECKBOX
2037 wxRadioButton
*radiobtn
= wxDynamicCastThis(wxRadioButton
);
2040 if ( event
.GetSetChecked() )
2041 radiobtn
->SetValue(event
.GetChecked());
2043 #endif // wxUSE_RADIOBTN
2049 // call internal idle recursively
2050 // may be obsolete (wait until OnIdle scheme stabilises)
2051 void wxWindowBase::ProcessInternalIdle()
2055 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
2058 wxWindow
*child
= node
->GetData();
2059 child
->ProcessInternalIdle();
2060 node
= node
->GetNext();
2065 // ----------------------------------------------------------------------------
2066 // dialog units translations
2067 // ----------------------------------------------------------------------------
2069 wxPoint
wxWindowBase::ConvertPixelsToDialog(const wxPoint
& pt
)
2071 int charWidth
= GetCharWidth();
2072 int charHeight
= GetCharHeight();
2073 wxPoint
pt2(-1, -1);
2075 pt2
.x
= (int) ((pt
.x
* 4) / charWidth
);
2077 pt2
.y
= (int) ((pt
.y
* 8) / charHeight
);
2082 wxPoint
wxWindowBase::ConvertDialogToPixels(const wxPoint
& pt
)
2084 int charWidth
= GetCharWidth();
2085 int charHeight
= GetCharHeight();
2086 wxPoint
pt2(-1, -1);
2088 pt2
.x
= (int) ((pt
.x
* charWidth
) / 4);
2090 pt2
.y
= (int) ((pt
.y
* charHeight
) / 8);
2095 // ----------------------------------------------------------------------------
2097 // ----------------------------------------------------------------------------
2099 // propagate the colour change event to the subwindows
2100 void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent
& event
)
2102 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
2105 // Only propagate to non-top-level windows
2106 wxWindow
*win
= node
->GetData();
2107 if ( !win
->IsTopLevel() )
2109 wxSysColourChangedEvent event2
;
2110 event
.m_eventObject
= win
;
2111 win
->GetEventHandler()->ProcessEvent(event2
);
2114 node
= node
->GetNext();
2120 // the default action is to populate dialog with data when it's created,
2121 // and nudge the UI into displaying itself correctly in case
2122 // we've turned the wxUpdateUIEvents frequency down low.
2123 void wxWindowBase::OnInitDialog( wxInitDialogEvent
&WXUNUSED(event
) )
2125 TransferDataToWindow();
2127 // Update the UI at this point
2128 UpdateWindowUI(wxUPDATE_UI_RECURSE
);
2131 // process Ctrl-Alt-mclick
2132 void wxWindowBase::OnMiddleClick( wxMouseEvent
& event
)
2135 if ( event
.ControlDown() && event
.AltDown() )
2137 // don't translate these strings
2140 #ifdef __WXUNIVERSAL__
2142 #endif // __WXUNIVERSAL__
2144 switch ( wxGetOsVersion() )
2146 case wxMOTIF_X
: port
+= _T("Motif"); break;
2148 case wxMAC_DARWIN
: port
+= _T("Mac"); break;
2149 case wxBEOS
: port
+= _T("BeOS"); break;
2153 case wxGTK_BEOS
: port
+= _T("GTK"); break;
2159 case wxWIN386
: port
+= _T("MS Windows"); break;
2163 case wxMGL_OS2
: port
+= _T("MGL"); break;
2165 case wxOS2_PM
: port
+= _T("OS/2"); break;
2166 default: port
+= _T("unknown"); break;
2169 wxMessageBox(wxString::Format(
2171 " wxWidgets Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n Copyright (c) 1995-2002 wxWidgets team"
2185 _T("wxWidgets information"),
2186 wxICON_INFORMATION
| wxOK
,
2190 #endif // wxUSE_MSGDLG
2196 // ----------------------------------------------------------------------------
2198 // ----------------------------------------------------------------------------
2200 #if wxUSE_ACCESSIBILITY
2201 void wxWindowBase::SetAccessible(wxAccessible
* accessible
)
2203 if (m_accessible
&& (accessible
!= m_accessible
))
2204 delete m_accessible
;
2205 m_accessible
= accessible
;
2207 m_accessible
->SetWindow((wxWindow
*) this);
2210 // Returns the accessible object, creating if necessary.
2211 wxAccessible
* wxWindowBase::GetOrCreateAccessible()
2214 m_accessible
= CreateAccessible();
2215 return m_accessible
;
2218 // Override to create a specific accessible object.
2219 wxAccessible
* wxWindowBase::CreateAccessible()
2221 return new wxWindowAccessible((wxWindow
*) this);
2227 // ----------------------------------------------------------------------------
2228 // list classes implementation
2229 // ----------------------------------------------------------------------------
2231 void wxWindowListNode::DeleteData()
2233 delete (wxWindow
*)GetData();
2237 // ----------------------------------------------------------------------------
2239 // ----------------------------------------------------------------------------
2241 wxBorder
wxWindowBase::GetBorder(long flags
) const
2243 wxBorder border
= (wxBorder
)(flags
& wxBORDER_MASK
);
2244 if ( border
== wxBORDER_DEFAULT
)
2246 border
= GetDefaultBorder();
2252 wxBorder
wxWindowBase::GetDefaultBorder() const
2254 return wxBORDER_NONE
;
2257 // ----------------------------------------------------------------------------
2259 // ----------------------------------------------------------------------------
2261 wxHitTest
wxWindowBase::DoHitTest(wxCoord x
, wxCoord y
) const
2263 // here we just check if the point is inside the window or not
2265 // check the top and left border first
2266 bool outside
= x
< 0 || y
< 0;
2269 // check the right and bottom borders too
2270 wxSize size
= GetSize();
2271 outside
= x
>= size
.x
|| y
>= size
.y
;
2274 return outside
? wxHT_WINDOW_OUTSIDE
: wxHT_WINDOW_INSIDE
;
2277 // ----------------------------------------------------------------------------
2279 // ----------------------------------------------------------------------------
2281 struct WXDLLEXPORT wxWindowNext
2285 } *wxWindowBase::ms_winCaptureNext
= NULL
;
2287 void wxWindowBase::CaptureMouse()
2289 wxLogTrace(_T("mousecapture"), _T("CaptureMouse(%p)"), this);
2291 wxWindow
*winOld
= GetCapture();
2294 ((wxWindowBase
*) winOld
)->DoReleaseMouse();
2297 wxWindowNext
*item
= new wxWindowNext
;
2299 item
->next
= ms_winCaptureNext
;
2300 ms_winCaptureNext
= item
;
2302 //else: no mouse capture to save
2307 void wxWindowBase::ReleaseMouse()
2309 wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(%p)"), this);
2311 wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") );
2315 if ( ms_winCaptureNext
)
2317 ((wxWindowBase
*)ms_winCaptureNext
->win
)->DoCaptureMouse();
2319 wxWindowNext
*item
= ms_winCaptureNext
;
2320 ms_winCaptureNext
= item
->next
;
2323 //else: stack is empty, no previous capture
2325 wxLogTrace(_T("mousecapture"),
2326 (const wxChar
*) _T("After ReleaseMouse() mouse is captured by %p"),
2333 wxWindowBase::RegisterHotKey(int WXUNUSED(hotkeyId
),
2334 int WXUNUSED(modifiers
),
2335 int WXUNUSED(keycode
))
2341 bool wxWindowBase::UnregisterHotKey(int WXUNUSED(hotkeyId
))
2347 #endif // wxUSE_HOTKEY
2349 void wxWindowBase::SendDestroyEvent()
2351 wxWindowDestroyEvent event
;
2352 event
.SetEventObject(this);
2353 event
.SetId(GetId());
2354 GetEventHandler()->ProcessEvent(event
);
2357 // ----------------------------------------------------------------------------
2359 // ----------------------------------------------------------------------------
2361 bool wxWindowBase::TryValidator(wxEvent
& wxVALIDATOR_PARAM(event
))
2363 #if wxUSE_VALIDATORS
2364 // Can only use the validator of the window which
2365 // is receiving the event
2366 if ( event
.GetEventObject() == this )
2368 wxValidator
*validator
= GetValidator();
2369 if ( validator
&& validator
->ProcessEvent(event
) )
2374 #endif // wxUSE_VALIDATORS
2379 bool wxWindowBase::TryParent(wxEvent
& event
)
2381 // carry on up the parent-child hierarchy if the propgation count hasn't
2383 if ( event
.ShouldPropagate() )
2385 // honour the requests to stop propagation at this window: this is
2386 // used by the dialogs, for example, to prevent processing the events
2387 // from the dialog controls in the parent frame which rarely, if ever,
2389 if ( !(GetExtraStyle() & wxWS_EX_BLOCK_EVENTS
) )
2391 wxWindow
*parent
= GetParent();
2392 if ( parent
&& !parent
->IsBeingDeleted() )
2394 wxPropagateOnce
propagateOnce(event
);
2396 return parent
->GetEventHandler()->ProcessEvent(event
);
2401 return wxEvtHandler::TryParent(event
);
2404 // ----------------------------------------------------------------------------
2406 // ----------------------------------------------------------------------------
2408 // Navigates in the specified direction.
2409 bool wxWindowBase::Navigate(int flags
)
2411 wxNavigationKeyEvent eventNav
;
2412 eventNav
.SetFlags(flags
);
2413 eventNav
.SetEventObject(this);
2414 if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav
) )
2421 // ----------------------------------------------------------------------------
2423 // ----------------------------------------------------------------------------
2425 wxWindow
* wxGetTopLevelParent(wxWindow
*win
)
2427 while ( win
&& !win
->IsTopLevel() )
2428 win
= win
->GetParent();
2433 #if wxUSE_ACCESSIBILITY
2434 // ----------------------------------------------------------------------------
2435 // accessible object for windows
2436 // ----------------------------------------------------------------------------
2438 // Can return either a child object, or an integer
2439 // representing the child element, starting from 1.
2440 wxAccStatus
wxWindowAccessible::HitTest(const wxPoint
& WXUNUSED(pt
), int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(childObject
))
2442 wxASSERT( GetWindow() != NULL
);
2446 return wxACC_NOT_IMPLEMENTED
;
2449 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
2450 wxAccStatus
wxWindowAccessible::GetLocation(wxRect
& rect
, int elementId
)
2452 wxASSERT( GetWindow() != NULL
);
2456 wxWindow
* win
= NULL
;
2463 if (elementId
<= (int) GetWindow()->GetChildren().GetCount())
2465 win
= GetWindow()->GetChildren().Item(elementId
-1)->GetData();
2472 rect
= win
->GetRect();
2473 if (win
->GetParent() && !win
->IsKindOf(CLASSINFO(wxTopLevelWindow
)))
2474 rect
.SetPosition(win
->GetParent()->ClientToScreen(rect
.GetPosition()));
2478 return wxACC_NOT_IMPLEMENTED
;
2481 // Navigates from fromId to toId/toObject.
2482 wxAccStatus
wxWindowAccessible::Navigate(wxNavDir navDir
, int fromId
,
2483 int* WXUNUSED(toId
), wxAccessible
** toObject
)
2485 wxASSERT( GetWindow() != NULL
);
2491 case wxNAVDIR_FIRSTCHILD
:
2493 if (GetWindow()->GetChildren().GetCount() == 0)
2495 wxWindow
* childWindow
= (wxWindow
*) GetWindow()->GetChildren().GetFirst()->GetData();
2496 *toObject
= childWindow
->GetOrCreateAccessible();
2500 case wxNAVDIR_LASTCHILD
:
2502 if (GetWindow()->GetChildren().GetCount() == 0)
2504 wxWindow
* childWindow
= (wxWindow
*) GetWindow()->GetChildren().GetLast()->GetData();
2505 *toObject
= childWindow
->GetOrCreateAccessible();
2509 case wxNAVDIR_RIGHT
:
2513 wxWindowList::compatibility_iterator node
=
2514 wxWindowList::compatibility_iterator();
2517 // Can't navigate to sibling of this window
2518 // if we're a top-level window.
2519 if (!GetWindow()->GetParent())
2520 return wxACC_NOT_IMPLEMENTED
;
2522 node
= GetWindow()->GetParent()->GetChildren().Find(GetWindow());
2526 if (fromId
<= (int) GetWindow()->GetChildren().GetCount())
2527 node
= GetWindow()->GetChildren().Item(fromId
-1);
2530 if (node
&& node
->GetNext())
2532 wxWindow
* nextWindow
= node
->GetNext()->GetData();
2533 *toObject
= nextWindow
->GetOrCreateAccessible();
2541 case wxNAVDIR_PREVIOUS
:
2543 wxWindowList::compatibility_iterator node
=
2544 wxWindowList::compatibility_iterator();
2547 // Can't navigate to sibling of this window
2548 // if we're a top-level window.
2549 if (!GetWindow()->GetParent())
2550 return wxACC_NOT_IMPLEMENTED
;
2552 node
= GetWindow()->GetParent()->GetChildren().Find(GetWindow());
2556 if (fromId
<= (int) GetWindow()->GetChildren().GetCount())
2557 node
= GetWindow()->GetChildren().Item(fromId
-1);
2560 if (node
&& node
->GetPrevious())
2562 wxWindow
* previousWindow
= node
->GetPrevious()->GetData();
2563 *toObject
= previousWindow
->GetOrCreateAccessible();
2571 return wxACC_NOT_IMPLEMENTED
;
2574 // Gets the name of the specified object.
2575 wxAccStatus
wxWindowAccessible::GetName(int childId
, wxString
* name
)
2577 wxASSERT( GetWindow() != NULL
);
2583 // If a child, leave wxWidgets to call the function on the actual
2586 return wxACC_NOT_IMPLEMENTED
;
2588 // This will eventually be replaced by specialised
2589 // accessible classes, one for each kind of wxWidgets
2590 // control or window.
2592 if (GetWindow()->IsKindOf(CLASSINFO(wxButton
)))
2593 title
= ((wxButton
*) GetWindow())->GetLabel();
2596 title
= GetWindow()->GetName();
2598 if (!title
.IsEmpty())
2604 return wxACC_NOT_IMPLEMENTED
;
2607 // Gets the number of children.
2608 wxAccStatus
wxWindowAccessible::GetChildCount(int* childId
)
2610 wxASSERT( GetWindow() != NULL
);
2614 *childId
= (int) GetWindow()->GetChildren().GetCount();
2618 // Gets the specified child (starting from 1).
2619 // If *child is NULL and return value is wxACC_OK,
2620 // this means that the child is a simple element and
2621 // not an accessible object.
2622 wxAccStatus
wxWindowAccessible::GetChild(int childId
, wxAccessible
** child
)
2624 wxASSERT( GetWindow() != NULL
);
2634 if (childId
> (int) GetWindow()->GetChildren().GetCount())
2637 wxWindow
* childWindow
= GetWindow()->GetChildren().Item(childId
-1)->GetData();
2638 *child
= childWindow
->GetOrCreateAccessible();
2645 // Gets the parent, or NULL.
2646 wxAccStatus
wxWindowAccessible::GetParent(wxAccessible
** parent
)
2648 wxASSERT( GetWindow() != NULL
);
2652 wxWindow
* parentWindow
= GetWindow()->GetParent();
2660 *parent
= parentWindow
->GetOrCreateAccessible();
2668 // Performs the default action. childId is 0 (the action for this object)
2669 // or > 0 (the action for a child).
2670 // Return wxACC_NOT_SUPPORTED if there is no default action for this
2671 // window (e.g. an edit control).
2672 wxAccStatus
wxWindowAccessible::DoDefaultAction(int WXUNUSED(childId
))
2674 wxASSERT( GetWindow() != NULL
);
2678 return wxACC_NOT_IMPLEMENTED
;
2681 // Gets the default action for this object (0) or > 0 (the action for a child).
2682 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
2683 // string if there is no action.
2684 // The retrieved string describes the action that is performed on an object,
2685 // not what the object does as a result. For example, a toolbar button that prints
2686 // a document has a default action of "Press" rather than "Prints the current document."
2687 wxAccStatus
wxWindowAccessible::GetDefaultAction(int WXUNUSED(childId
), wxString
* WXUNUSED(actionName
))
2689 wxASSERT( GetWindow() != NULL
);
2693 return wxACC_NOT_IMPLEMENTED
;
2696 // Returns the description for this object or a child.
2697 wxAccStatus
wxWindowAccessible::GetDescription(int WXUNUSED(childId
), wxString
* description
)
2699 wxASSERT( GetWindow() != NULL
);
2703 wxString
ht(GetWindow()->GetHelpText());
2709 return wxACC_NOT_IMPLEMENTED
;
2712 // Returns help text for this object or a child, similar to tooltip text.
2713 wxAccStatus
wxWindowAccessible::GetHelpText(int WXUNUSED(childId
), wxString
* helpText
)
2715 wxASSERT( GetWindow() != NULL
);
2719 wxString
ht(GetWindow()->GetHelpText());
2725 return wxACC_NOT_IMPLEMENTED
;
2728 // Returns the keyboard shortcut for this object or child.
2729 // Return e.g. ALT+K
2730 wxAccStatus
wxWindowAccessible::GetKeyboardShortcut(int WXUNUSED(childId
), wxString
* WXUNUSED(shortcut
))
2732 wxASSERT( GetWindow() != NULL
);
2736 return wxACC_NOT_IMPLEMENTED
;
2739 // Returns a role constant.
2740 wxAccStatus
wxWindowAccessible::GetRole(int childId
, wxAccRole
* role
)
2742 wxASSERT( GetWindow() != NULL
);
2746 // If a child, leave wxWidgets to call the function on the actual
2749 return wxACC_NOT_IMPLEMENTED
;
2751 if (GetWindow()->IsKindOf(CLASSINFO(wxControl
)))
2752 return wxACC_NOT_IMPLEMENTED
;
2754 if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar
)))
2755 return wxACC_NOT_IMPLEMENTED
;
2758 if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar
)))
2759 return wxACC_NOT_IMPLEMENTED
;
2762 //*role = wxROLE_SYSTEM_CLIENT;
2763 *role
= wxROLE_SYSTEM_CLIENT
;
2767 return wxACC_NOT_IMPLEMENTED
;
2771 // Returns a state constant.
2772 wxAccStatus
wxWindowAccessible::GetState(int childId
, long* state
)
2774 wxASSERT( GetWindow() != NULL
);
2778 // If a child, leave wxWidgets to call the function on the actual
2781 return wxACC_NOT_IMPLEMENTED
;
2783 if (GetWindow()->IsKindOf(CLASSINFO(wxControl
)))
2784 return wxACC_NOT_IMPLEMENTED
;
2787 if (GetWindow()->IsKindOf(CLASSINFO(wxStatusBar
)))
2788 return wxACC_NOT_IMPLEMENTED
;
2791 if (GetWindow()->IsKindOf(CLASSINFO(wxToolBar
)))
2792 return wxACC_NOT_IMPLEMENTED
;
2799 return wxACC_NOT_IMPLEMENTED
;
2803 // Returns a localized string representing the value for the object
2805 wxAccStatus
wxWindowAccessible::GetValue(int WXUNUSED(childId
), wxString
* WXUNUSED(strValue
))
2807 wxASSERT( GetWindow() != NULL
);
2811 return wxACC_NOT_IMPLEMENTED
;
2814 // Selects the object or child.
2815 wxAccStatus
wxWindowAccessible::Select(int WXUNUSED(childId
), wxAccSelectionFlags
WXUNUSED(selectFlags
))
2817 wxASSERT( GetWindow() != NULL
);
2821 return wxACC_NOT_IMPLEMENTED
;
2824 // Gets the window with the keyboard focus.
2825 // If childId is 0 and child is NULL, no object in
2826 // this subhierarchy has the focus.
2827 // If this object has the focus, child should be 'this'.
2828 wxAccStatus
wxWindowAccessible::GetFocus(int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
2830 wxASSERT( GetWindow() != NULL
);
2834 return wxACC_NOT_IMPLEMENTED
;
2837 // Gets a variant representing the selected children
2839 // Acceptable values:
2840 // - a null variant (IsNull() returns TRUE)
2841 // - a list variant (GetType() == wxT("list")
2842 // - an integer representing the selected child element,
2843 // or 0 if this object is selected (GetType() == wxT("long")
2844 // - a "void*" pointer to a wxAccessible child object
2845 wxAccStatus
wxWindowAccessible::GetSelections(wxVariant
* WXUNUSED(selections
))
2847 wxASSERT( GetWindow() != NULL
);
2851 return wxACC_NOT_IMPLEMENTED
;
2854 #endif // wxUSE_ACCESSIBILITY