1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/window_osx.cpp
3 // Purpose: wxWindowMac
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/window.h"
23 #include "wx/dcclient.h"
24 #include "wx/button.h"
26 #include "wx/dialog.h"
27 #include "wx/settings.h"
28 #include "wx/msgdlg.h"
29 #include "wx/scrolbar.h"
30 #include "wx/statbox.h"
31 #include "wx/textctrl.h"
32 #include "wx/toolbar.h"
33 #include "wx/layout.h"
34 #include "wx/statusbr.h"
35 #include "wx/menuitem.h"
36 #include "wx/treectrl.h"
37 #include "wx/listctrl.h"
40 #include "wx/tooltip.h"
41 #include "wx/spinctrl.h"
42 #include "wx/geometry.h"
45 #include "wx/listctrl.h"
49 #include "wx/treectrl.h"
57 #include "wx/popupwin.h"
60 #if wxUSE_DRAG_AND_DROP
64 #include "wx/graphics.h"
67 #include "wx/osx/uma.h"
69 #include "wx/osx/private.h"
72 #define MAC_SCROLLBAR_SIZE 15
73 #define MAC_SMALL_SCROLLBAR_SIZE 11
77 #ifdef __WXUNIVERSAL__
78 IMPLEMENT_ABSTRACT_CLASS(wxWindowMac
, wxWindowBase
)
81 BEGIN_EVENT_TABLE(wxWindowMac
, wxWindowBase
)
82 EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent
)
85 #define wxMAC_DEBUG_REDRAW 0
86 #ifndef wxMAC_DEBUG_REDRAW
87 #define wxMAC_DEBUG_REDRAW 0
90 wxWidgetImplType
* kOSXNoWidgetImpl
= (wxWidgetImplType
*) -1L;
92 // ===========================================================================
94 // ===========================================================================
96 // the grow box has to be implemented as an inactive window, so that nothing can direct
99 class WXDLLIMPEXP_CORE wxBlindPlateWindow
: public wxWindow
102 wxBlindPlateWindow() { Init(); }
104 // Old-style constructor (no default values for coordinates to avoid
105 // ambiguity with the new one)
106 wxBlindPlateWindow(wxWindow
*parent
,
107 int x
, int y
, int width
, int height
,
108 long style
= wxTAB_TRAVERSAL
| wxNO_BORDER
,
109 const wxString
& name
= wxPanelNameStr
)
113 Create(parent
, wxID_ANY
, wxPoint(x
, y
), wxSize(width
, height
), style
, name
);
117 wxBlindPlateWindow(wxWindow
*parent
,
118 wxWindowID winid
= wxID_ANY
,
119 const wxPoint
& pos
= wxDefaultPosition
,
120 const wxSize
& size
= wxDefaultSize
,
121 long style
= wxTAB_TRAVERSAL
| wxNO_BORDER
,
122 const wxString
& name
= wxPanelNameStr
)
126 Create(parent
, winid
, pos
, size
, style
, name
);
130 bool Create(wxWindow
*parent
,
131 wxWindowID winid
= wxID_ANY
,
132 const wxPoint
& pos
= wxDefaultPosition
,
133 const wxSize
& size
= wxDefaultSize
,
134 long style
= wxTAB_TRAVERSAL
| wxNO_BORDER
,
135 const wxString
& name
= wxPanelNameStr
)
137 if ( !wxWindow::Create(parent
, winid
, pos
, size
, style
, name
) )
140 // so that non-solid background renders correctly under GTK+:
141 SetThemeEnabled(true);
145 virtual ~wxBlindPlateWindow();
147 virtual bool AcceptsFocus() const
153 // common part of all ctors
158 DECLARE_DYNAMIC_CLASS_NO_COPY(wxBlindPlateWindow
)
159 DECLARE_EVENT_TABLE()
162 wxBlindPlateWindow::~wxBlindPlateWindow()
166 IMPLEMENT_DYNAMIC_CLASS(wxBlindPlateWindow
, wxWindow
)
168 BEGIN_EVENT_TABLE(wxBlindPlateWindow
, wxWindow
)
172 // ----------------------------------------------------------------------------
173 // constructors and such
174 // ----------------------------------------------------------------------------
176 wxWindowMac::wxWindowMac()
181 wxWindowMac::wxWindowMac(wxWindowMac
*parent
,
186 const wxString
& name
)
189 Create(parent
, id
, pos
, size
, style
, name
);
192 void wxWindowMac::Init()
196 m_cgContextRef
= NULL
;
198 // as all windows are created with WS_VISIBLE style...
201 m_hScrollBar
= NULL
;
202 m_vScrollBar
= NULL
;
203 m_hScrollBarAlwaysShown
= false;
204 m_vScrollBarAlwaysShown
= false;
207 m_clipChildren
= false ;
208 m_cachedClippedRectValid
= false ;
209 m_isNativeWindowWrapper
= false;
212 wxWindowMac::~wxWindowMac()
216 MacInvalidateBorders() ;
218 #ifndef __WXUNIVERSAL__
219 // VS: make sure there's no wxFrame with last focus set to us:
220 for ( wxWindow
*win
= GetParent(); win
; win
= win
->GetParent() )
222 wxFrame
*frame
= wxDynamicCast(win
, wxFrame
);
225 if ( frame
->GetLastFocus() == this )
226 frame
->SetLastFocus(NULL
);
232 // destroy children before destroying this window itself
235 // wxRemoveMacControlAssociation( this ) ;
236 // If we delete an item, we should initialize the parent panel,
237 // because it could now be invalid.
238 wxTopLevelWindow
*tlw
= wxDynamicCast(wxGetTopLevelParent((wxWindow
*)this), wxTopLevelWindow
);
241 if ( tlw
->GetDefaultItem() == (wxButton
*) this)
242 tlw
->SetDefaultItem(NULL
);
245 if ( g_MacLastWindow
== this )
246 g_MacLastWindow
= NULL
;
248 #ifndef __WXUNIVERSAL__
249 wxFrame
* frame
= wxDynamicCast( wxGetTopLevelParent( (wxWindow
*)this ) , wxFrame
) ;
252 if ( frame
->GetLastFocus() == this )
253 frame
->SetLastFocus( NULL
) ;
257 // delete our drop target if we've got one
258 #if wxUSE_DRAG_AND_DROP
259 wxDELETE(m_dropTarget
);
265 WXWidget
wxWindowMac::GetHandle() const
268 return (WXWidget
) GetPeer()->GetWXWidget() ;
272 wxOSXWidgetImpl
* wxWindowMac::GetPeer() const
274 return m_peer
== kOSXNoWidgetImpl
? NULL
: m_peer
;
277 void wxWindowMac::DontCreatePeer()
279 m_peer
= kOSXNoWidgetImpl
;
282 void wxWindowMac::SetWrappingPeer(wxOSXWidgetImpl
* wrapper
)
284 wxOSXWidgetImpl
* inner
= GetPeer();
285 wxASSERT_MSG( inner
!= NULL
&& inner
->IsOk(), "missing or incomplete inner peer" );
286 wxASSERT_MSG( wrapper
!= NULL
&& wrapper
->IsOk(), "missing or incomplete wrapper" );
288 if ( !(inner
!= NULL
&& inner
->IsOk() && wrapper
!= NULL
&& wrapper
->IsOk()) )
291 inner
->RemoveFromParent();
292 wrapper
->InstallEventHandler();
293 wrapper
->Embed(inner
);
297 void wxWindowMac::SetPeer(wxOSXWidgetImpl
* peer
)
301 GetPeer()->RemoveFromParent();
307 if ( GetPeer() && !GetPeer()->IsRootControl())
309 wxASSERT_MSG( GetPeer()->IsOk() , wxT("The native control must exist already") ) ;
311 if (!GetParent()->GetChildren().Find((wxWindow
*)this))
312 GetParent()->AddChild( this );
314 GetPeer()->InstallEventHandler();
315 GetPeer()->Embed(GetParent()->GetPeer());
317 GetParent()->MacChildAdded() ;
319 // adjust font, controlsize etc
320 DoSetWindowVariant( m_windowVariant
) ;
322 GetPeer()->SetLabel( wxStripMenuCodes(m_label
, wxStrip_Mnemonics
), GetFont().GetEncoding() ) ;
324 // for controls we want to use best size for wxDefaultSize params )
325 if ( !GetPeer()->IsUserPane() )
326 SetInitialSize(GetMinSize());
328 SetCursor( *wxSTANDARD_CURSOR
) ;
332 #if WXWIN_COMPATIBILITY_2_8
334 bool wxWindowMac::MacIsUserPane()
336 return GetPeer() == NULL
|| GetPeer()->IsUserPane();
341 bool wxWindowMac::MacIsUserPane() const
343 return GetPeer() == NULL
|| GetPeer()->IsUserPane();
346 // ---------------------------------------------------------------------------
347 // Utility Routines to move between different coordinate systems
348 // ---------------------------------------------------------------------------
351 * Right now we have the following setup :
352 * a border that is not part of the native control is always outside the
353 * control's border (otherwise we loose all native intelligence, future ways
354 * may be to have a second embedding control responsible for drawing borders
355 * and backgrounds eventually)
356 * so all this border calculations have to be taken into account when calling
357 * native methods or getting native oriented data
358 * so we have three coordinate systems here
359 * wx client coordinates
360 * wx window coordinates (including window frames)
368 bool wxWindowMac::Create(wxWindowMac
*parent
,
373 const wxString
& name
)
375 wxCHECK_MSG( parent
, false, wxT("can't create wxWindowMac without parent") );
377 if ( !CreateBase(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
380 m_windowVariant
= parent
->GetWindowVariant() ;
382 if ( m_peer
!= kOSXNoWidgetImpl
)
384 SetPeer(wxWidgetImpl::CreateUserPane( this, parent
, id
, pos
, size
, style
, GetExtraStyle() ));
385 MacPostControlCreate(pos
, size
) ;
388 #ifndef __WXUNIVERSAL__
389 // Don't give scrollbars to wxControls unless they ask for them
390 if ( (! IsKindOf(CLASSINFO(wxControl
))
392 && ! IsKindOf(CLASSINFO(wxStatusBar
))
395 || (IsKindOf(CLASSINFO(wxControl
)) && ((style
& wxHSCROLL
) || (style
& wxVSCROLL
))))
397 MacCreateScrollBars( style
) ;
401 wxWindowCreateEvent
event((wxWindow
*)this);
402 GetEventHandler()->AddPendingEvent(event
);
407 void wxWindowMac::MacChildAdded()
411 m_vScrollBar
->Raise() ;
413 m_hScrollBar
->Raise() ;
419 void wxWindowMac::MacPostControlCreate(const wxPoint
& WXUNUSED(pos
), const wxSize
& size
)
421 // todo remove if refactoring works correctly
423 wxASSERT_MSG( GetPeer() != NULL
&& GetPeer()->IsOk() , wxT("No valid mac control") ) ;
425 if (!GetParent()->GetChildren().Find((wxWindow
*)this))
426 GetParent()->AddChild( this );
428 GetPeer()->InstallEventHandler();
429 GetPeer()->Embed(GetParent()->GetPeer());
431 GetParent()->MacChildAdded() ;
433 // adjust font, controlsize etc
434 DoSetWindowVariant( m_windowVariant
) ;
436 GetPeer()->SetLabel( wxStripMenuCodes(m_label
, wxStrip_Mnemonics
), GetFont().GetEncoding() ) ;
438 // for controls we want to use best size for wxDefaultSize params )
439 if ( !GetPeer()->IsUserPane() )
440 SetInitialSize(size
);
442 SetCursor( *wxSTANDARD_CURSOR
) ;
446 void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant
)
448 // Don't assert, in case we set the window variant before
449 // the window is created
450 // wxASSERT( GetPeer()->Ok() ) ;
452 m_windowVariant
= variant
;
454 if (GetPeer() == NULL
|| !GetPeer()->IsOk())
457 GetPeer()->SetControlSize( variant
);
461 // we will get that from the settings later
462 // and make this NORMAL later, but first
463 // we have a few calculations that we must fix
467 case wxWINDOW_VARIANT_NORMAL
:
468 size
= kControlSizeNormal
;
471 case wxWINDOW_VARIANT_SMALL
:
472 size
= kControlSizeSmall
;
475 case wxWINDOW_VARIANT_MINI
:
476 // not always defined in the headers
480 case wxWINDOW_VARIANT_LARGE
:
481 size
= kControlSizeLarge
;
485 wxFAIL_MSG(wxT("unexpected window variant"));
488 GetPeer()->SetData
<ControlSize
>(kControlEntireControl
, kControlSizeTag
, &size
) ;
494 case wxWINDOW_VARIANT_NORMAL
:
495 static wxFont
sysNormal(wxOSX_SYSTEM_FONT_NORMAL
);
499 case wxWINDOW_VARIANT_SMALL
:
500 static wxFont
sysSmall(wxOSX_SYSTEM_FONT_SMALL
);
504 case wxWINDOW_VARIANT_MINI
:
505 static wxFont
sysMini(wxOSX_SYSTEM_FONT_MINI
);
509 case wxWINDOW_VARIANT_LARGE
:
510 static wxFont
sysLarge(wxOSX_SYSTEM_FONT_NORMAL
);
515 wxFAIL_MSG(wxT("unexpected window variant"));
520 void wxWindowMac::MacUpdateControlFont()
523 GetPeer()->SetFont( GetFont() , GetForegroundColour() , GetWindowStyle() ) ;
525 // do not trigger refreshes upon invisible and possible partly created objects
526 if ( IsShownOnScreen() )
530 bool wxWindowMac::SetFont(const wxFont
& font
)
532 bool retval
= wxWindowBase::SetFont( font
);
534 MacUpdateControlFont() ;
539 bool wxWindowMac::SetForegroundColour(const wxColour
& col
)
541 bool retval
= wxWindowBase::SetForegroundColour( col
);
544 MacUpdateControlFont();
549 bool wxWindowMac::SetBackgroundStyle(wxBackgroundStyle style
)
551 if ( !wxWindowBase::SetBackgroundStyle(style
) )
555 GetPeer()->SetBackgroundStyle(style
);
559 bool wxWindowMac::SetBackgroundColour(const wxColour
& col
)
563 if ( m_backgroundColour
.Ok() )
564 m_growBox
->SetBackgroundColour(m_backgroundColour
);
566 m_growBox
->SetBackgroundColour(*wxWHITE
);
569 if ( !wxWindowBase::SetBackgroundColour(col
) && m_hasBgCol
)
573 GetPeer()->SetBackgroundColour( col
) ;
578 static bool wxIsWindowOrParentDisabled(wxWindow
* w
)
580 while (w
&& !w
->IsTopLevel())
589 void wxWindowMac::SetFocus()
591 if ( !AcceptsFocus() )
594 if (wxIsWindowOrParentDisabled((wxWindow
*) this))
597 wxWindow
* former
= FindFocus() ;
598 if ( former
== this )
601 GetPeer()->SetFocus() ;
604 void wxWindowMac::DoCaptureMouse()
606 wxApp::s_captureWindow
= (wxWindow
*) this ;
607 GetPeer()->CaptureMouse() ;
610 wxWindow
* wxWindowBase::GetCapture()
612 return wxApp::s_captureWindow
;
615 void wxWindowMac::DoReleaseMouse()
617 wxApp::s_captureWindow
= NULL
;
619 GetPeer()->ReleaseMouse() ;
622 #if wxUSE_DRAG_AND_DROP
624 void wxWindowMac::SetDropTarget(wxDropTarget
*pDropTarget
)
628 m_dropTarget
= pDropTarget
;
629 if ( m_dropTarget
!= NULL
)
637 // Old-style File Manager Drag & Drop
638 void wxWindowMac::DragAcceptFiles(bool WXUNUSED(accept
))
643 // From a wx position / size calculate the appropriate size of the native control
645 bool wxWindowMac::MacGetBoundsForControl(
649 int& w
, int& h
, bool adjustOrigin
) const
651 // the desired size, minus the border pixels gives the correct size of the control
655 w
= WidthDefault( size
.x
);
656 h
= HeightDefault( size
.y
);
658 x
+= MacGetLeftBorderSize() ;
659 y
+= MacGetTopBorderSize() ;
660 w
-= MacGetLeftBorderSize() + MacGetRightBorderSize() ;
661 h
-= MacGetTopBorderSize() + MacGetBottomBorderSize() ;
664 AdjustForParentClientOrigin( x
, y
) ;
666 // this is in window relative coordinate, as this parent may have a border, its physical position is offset by this border
667 if ( GetParent() && !GetParent()->IsTopLevel() )
669 x
-= GetParent()->MacGetLeftBorderSize() ;
670 y
-= GetParent()->MacGetTopBorderSize() ;
676 // Get window size (not client size)
677 void wxWindowMac::DoGetSize(int *x
, int *y
) const
680 GetPeer()->GetSize( width
, height
);
683 *x
= width
+ MacGetLeftBorderSize() + MacGetRightBorderSize() ;
685 *y
= height
+ MacGetTopBorderSize() + MacGetBottomBorderSize() ;
688 // get the position of the bounds of this window in client coordinates of its parent
689 void wxWindowMac::DoGetPosition(int *x
, int *y
) const
693 GetPeer()->GetPosition( x1
, y1
) ;
695 // get the wx window position from the native one
696 x1
-= MacGetLeftBorderSize() ;
697 y1
-= MacGetTopBorderSize() ;
701 wxWindow
*parent
= GetParent();
704 // we must first adjust it to be in window coordinates of the parent,
705 // as otherwise it gets lost by the ClientAreaOrigin fix
706 x1
+= parent
->MacGetLeftBorderSize() ;
707 y1
+= parent
->MacGetTopBorderSize() ;
709 // and now to client coordinates
710 wxPoint
pt(parent
->GetClientAreaOrigin());
722 void wxWindowMac::DoScreenToClient(int *x
, int *y
) const
724 wxNonOwnedWindow
* tlw
= MacGetTopLevelWindow() ;
725 wxCHECK_RET( tlw
, wxT("TopLevel Window missing") ) ;
726 tlw
->GetNonOwnedPeer()->ScreenToWindow( x
, y
);
727 MacRootWindowToWindow( x
, y
) ;
729 wxPoint origin
= GetClientAreaOrigin() ;
736 void wxWindowMac::DoClientToScreen(int *x
, int *y
) const
738 wxNonOwnedWindow
* tlw
= MacGetTopLevelWindow() ;
739 wxCHECK_RET( tlw
, wxT("TopLevel window missing") ) ;
741 wxPoint origin
= GetClientAreaOrigin() ;
747 MacWindowToRootWindow( x
, y
) ;
748 tlw
->GetNonOwnedPeer()->WindowToScreen( x
, y
);
751 void wxWindowMac::MacClientToRootWindow( int *x
, int *y
) const
753 wxPoint origin
= GetClientAreaOrigin() ;
759 MacWindowToRootWindow( x
, y
) ;
762 void wxWindowMac::MacWindowToRootWindow( int *x
, int *y
) const
773 wxNonOwnedWindow
* top
= MacGetTopLevelWindow();
776 pt
.x
-= MacGetLeftBorderSize() ;
777 pt
.y
-= MacGetTopBorderSize() ;
778 wxWidgetImpl::Convert( &pt
, GetPeer() , top
->GetPeer() ) ;
788 void wxWindowMac::MacRootWindowToWindow( int *x
, int *y
) const
799 wxNonOwnedWindow
* top
= MacGetTopLevelWindow();
802 wxWidgetImpl::Convert( &pt
, top
->GetPeer() , GetPeer() ) ;
803 pt
.x
+= MacGetLeftBorderSize() ;
804 pt
.y
+= MacGetTopBorderSize() ;
814 wxSize
wxWindowMac::DoGetSizeFromClientSize( const wxSize
& size
) const
816 wxSize sizeTotal
= size
;
818 int innerwidth
, innerheight
;
820 int outerwidth
, outerheight
;
822 GetPeer()->GetContentArea( left
, top
, innerwidth
, innerheight
);
823 GetPeer()->GetSize( outerwidth
, outerheight
);
825 sizeTotal
.x
+= outerwidth
-innerwidth
;
826 sizeTotal
.y
+= outerheight
-innerheight
;
828 sizeTotal
.x
+= MacGetLeftBorderSize() + MacGetRightBorderSize() ;
829 sizeTotal
.y
+= MacGetTopBorderSize() + MacGetBottomBorderSize() ;
834 // Get size *available for subwindows* i.e. excluding menu bar etc.
835 void wxWindowMac::DoGetClientSize( int *x
, int *y
) const
841 GetPeer()->GetContentArea( left
, top
, ww
, hh
);
843 if (m_hScrollBar
&& m_hScrollBar
->IsShown() )
844 hh
-= m_hScrollBar
->GetSize().y
;
846 if (m_vScrollBar
&& m_vScrollBar
->IsShown() )
847 ww
-= m_vScrollBar
->GetSize().x
;
856 bool wxWindowMac::SetCursor(const wxCursor
& cursor
)
858 if (m_cursor
.IsSameAs(cursor
))
863 if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR
) )
868 if ( ! wxWindowBase::SetCursor( cursor
) )
872 wxASSERT_MSG( m_cursor
.Ok(),
873 wxT("cursor must be valid after call to the base version"));
875 if ( GetPeer() != NULL
)
876 GetPeer()->SetCursor( m_cursor
);
882 bool wxWindowMac::DoPopupMenu(wxMenu
*menu
, int x
, int y
)
884 #ifndef __WXUNIVERSAL__
887 if ( x
== wxDefaultCoord
&& y
== wxDefaultCoord
)
889 wxPoint mouse
= wxGetMousePosition();
895 ClientToScreen( &x
, &y
) ;
897 menu
->GetPeer()->PopUp(this, x
, y
);
900 // actually this shouldn't be called, because universal is having its own implementation
906 // ----------------------------------------------------------------------------
908 // ----------------------------------------------------------------------------
912 void wxWindowMac::DoSetToolTip(wxToolTip
*tooltip
)
914 wxWindowBase::DoSetToolTip(tooltip
);
917 m_tooltip
->SetWindow(this);
920 GetPeer()->SetToolTip(tooltip
);
925 void wxWindowMac::MacInvalidateBorders()
927 if ( GetPeer() == NULL
)
930 bool vis
= IsShownOnScreen() ;
934 int outerBorder
= MacGetLeftBorderSize() ;
936 if ( GetPeer()->NeedsFocusRect() )
939 if ( outerBorder
== 0 )
942 // now we know that we have something to do at all
946 GetPeer()->GetSize( tw
, th
);
947 GetPeer()->GetPosition( tx
, ty
);
949 wxRect
leftupdate( tx
-outerBorder
,ty
,outerBorder
,th
);
950 wxRect
rightupdate( tx
+tw
, ty
, outerBorder
, th
);
951 wxRect
topupdate( tx
-outerBorder
, ty
-outerBorder
, tw
+ 2 * outerBorder
, outerBorder
);
952 wxRect
bottomupdate( tx
-outerBorder
, ty
+ th
, tw
+ 2 * outerBorder
, outerBorder
);
955 GetParent()->GetPeer()->SetNeedsDisplay(&leftupdate
);
956 GetParent()->GetPeer()->SetNeedsDisplay(&rightupdate
);
957 GetParent()->GetPeer()->SetNeedsDisplay(&topupdate
);
958 GetParent()->GetPeer()->SetNeedsDisplay(&bottomupdate
);
962 void wxWindowMac::DoMoveWindow(int x
, int y
, int width
, int height
)
964 // this is never called for a toplevel window, so we know we have a parent
965 int former_x
, former_y
, former_w
, former_h
;
967 // Get true coordinates of former position
968 DoGetPosition( &former_x
, &former_y
) ;
969 DoGetSize( &former_w
, &former_h
) ;
971 wxWindow
*parent
= GetParent();
974 wxPoint
pt(parent
->GetClientAreaOrigin());
979 int actualWidth
= width
;
980 int actualHeight
= height
;
985 // min and max sizes are only for sizers, not for explicit size setting
986 if ((m_minWidth
!= -1) && (actualWidth
< m_minWidth
))
987 actualWidth
= m_minWidth
;
988 if ((m_minHeight
!= -1) && (actualHeight
< m_minHeight
))
989 actualHeight
= m_minHeight
;
990 if ((m_maxWidth
!= -1) && (actualWidth
> m_maxWidth
))
991 actualWidth
= m_maxWidth
;
992 if ((m_maxHeight
!= -1) && (actualHeight
> m_maxHeight
))
993 actualHeight
= m_maxHeight
;
996 bool doMove
= false, doResize
= false ;
998 if ( actualX
!= former_x
|| actualY
!= former_y
)
1001 if ( actualWidth
!= former_w
|| actualHeight
!= former_h
)
1004 if ( doMove
|| doResize
)
1006 // as the borders are drawn outside the native control, we adjust now
1008 wxRect
bounds( wxPoint( actualX
+ MacGetLeftBorderSize() ,actualY
+ MacGetTopBorderSize() ),
1009 wxSize( actualWidth
- (MacGetLeftBorderSize() + MacGetRightBorderSize()) ,
1010 actualHeight
- (MacGetTopBorderSize() + MacGetBottomBorderSize()) ) ) ;
1012 if ( parent
&& !parent
->IsTopLevel() )
1014 bounds
.Offset( -parent
->MacGetLeftBorderSize(), -parent
->MacGetTopBorderSize() );
1017 MacInvalidateBorders() ;
1019 m_cachedClippedRectValid
= false ;
1021 GetPeer()->Move( bounds
.x
, bounds
.y
, bounds
.width
, bounds
.height
);
1023 wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
1025 MacInvalidateBorders() ;
1027 MacRepositionScrollBars() ;
1030 wxPoint
point(actualX
, actualY
);
1031 wxMoveEvent
event(point
, m_windowId
);
1032 event
.SetEventObject(this);
1033 HandleWindowEvent(event
) ;
1038 MacRepositionScrollBars() ;
1039 wxSize
size(actualWidth
, actualHeight
);
1040 wxSizeEvent
event(size
, m_windowId
);
1041 event
.SetEventObject(this);
1042 HandleWindowEvent(event
);
1047 wxSize
wxWindowMac::DoGetBestSize() const
1049 if ( GetPeer() == NULL
|| GetPeer()->IsUserPane() || IsTopLevel() )
1051 return wxWindowBase::DoGetBestSize() ;
1057 GetPeer()->GetBestRect(&r
);
1059 if ( r
.GetWidth() == 0 && r
.GetHeight() == 0 )
1067 if ( IsKindOf( CLASSINFO( wxScrollBar
) ) )
1074 if ( IsKindOf( CLASSINFO( wxSpinButton
) ) )
1081 // return wxWindowBase::DoGetBestSize() ;
1085 int bestWidth
= r
.width
+ MacGetLeftBorderSize() +
1086 MacGetRightBorderSize();
1087 int bestHeight
= r
.height
+ MacGetTopBorderSize() +
1088 MacGetBottomBorderSize();
1089 if ( bestHeight
< 10 )
1092 return wxSize(bestWidth
, bestHeight
);
1096 // set the size of the window: if the dimensions are positive, just use them,
1097 // but if any of them is equal to -1, it means that we must find the value for
1098 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
1099 // which case -1 is a valid value for x and y)
1101 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
1102 // the width/height to best suit our contents, otherwise we reuse the current
1104 void wxWindowMac::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
1106 // get the current size and position...
1107 int currentX
, currentY
;
1108 int currentW
, currentH
;
1110 GetPosition(¤tX
, ¤tY
);
1111 GetSize(¤tW
, ¤tH
);
1113 // ... and don't do anything (avoiding flicker) if it's already ok
1114 if ( x
== currentX
&& y
== currentY
&&
1115 width
== currentW
&& height
== currentH
&& ( height
!= -1 && width
!= -1 ) )
1118 MacRepositionScrollBars() ; // we might have a real position shift
1120 if (sizeFlags
& wxSIZE_FORCE_EVENT
)
1122 wxSizeEvent
event( wxSize(width
,height
), GetId() );
1123 event
.SetEventObject( this );
1124 HandleWindowEvent( event
);
1130 if ( !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
) )
1132 if ( x
== wxDefaultCoord
)
1134 if ( y
== wxDefaultCoord
)
1138 AdjustForParentClientOrigin( x
, y
, sizeFlags
);
1140 wxSize size
= wxDefaultSize
;
1141 if ( width
== wxDefaultCoord
)
1143 if ( sizeFlags
& wxSIZE_AUTO_WIDTH
)
1145 size
= DoGetBestSize();
1150 // just take the current one
1155 if ( height
== wxDefaultCoord
)
1157 if ( sizeFlags
& wxSIZE_AUTO_HEIGHT
)
1159 if ( size
.x
== wxDefaultCoord
)
1160 size
= DoGetBestSize();
1161 // else: already called DoGetBestSize() above
1167 // just take the current one
1172 DoMoveWindow( x
, y
, width
, height
);
1175 wxPoint
wxWindowMac::GetClientAreaOrigin() const
1177 int left
,top
,width
,height
;
1178 GetPeer()->GetContentArea( left
, top
, width
, height
);
1179 return wxPoint( left
+ MacGetLeftBorderSize() , top
+ MacGetTopBorderSize() );
1182 void wxWindowMac::DoSetClientSize(int clientwidth
, int clientheight
)
1184 if ( clientwidth
!= wxDefaultCoord
|| clientheight
!= wxDefaultCoord
)
1186 int currentclientwidth
, currentclientheight
;
1187 int currentwidth
, currentheight
;
1189 GetClientSize( ¤tclientwidth
, ¤tclientheight
) ;
1190 GetSize( ¤twidth
, ¤theight
) ;
1192 DoSetSize( wxDefaultCoord
, wxDefaultCoord
, currentwidth
+ clientwidth
- currentclientwidth
,
1193 currentheight
+ clientheight
- currentclientheight
, wxSIZE_USE_EXISTING
) ;
1197 float wxWindowMac::GetContentScaleFactor() const
1199 return GetPeer()->GetContentScaleFactor();
1202 void wxWindowMac::SetLabel(const wxString
& title
)
1204 if ( title
== m_label
)
1209 InvalidateBestSize();
1211 if ( GetPeer() && GetPeer()->IsOk() )
1212 GetPeer()->SetLabel( wxStripMenuCodes(m_label
, wxStrip_Mnemonics
), GetFont().GetEncoding() ) ;
1214 // do not trigger refreshes upon invisible and possible partly created objects
1215 if ( IsShownOnScreen() )
1219 wxString
wxWindowMac::GetLabel() const
1224 bool wxWindowMac::Show(bool show
)
1226 if ( !wxWindowBase::Show(show
) )
1230 GetPeer()->SetVisibility( show
) ;
1232 #ifdef __WXOSX_IPHONE__
1233 // only when there's no native event support
1234 if ( !IsTopLevel() )
1237 wxShowEvent
eventShow(GetId(), show
);
1238 eventShow
.SetEventObject(this);
1240 HandleWindowEvent(eventShow
);
1246 bool wxWindowMac::OSXShowWithEffect(bool show
,
1247 wxShowEffect effect
,
1250 if ( effect
== wxSHOW_EFFECT_NONE
||
1251 !GetPeer() || !GetPeer()->ShowWithEffect(show
, effect
, timeout
) )
1257 void wxWindowMac::DoEnable(bool enable
)
1259 GetPeer()->Enable( enable
) ;
1260 MacInvalidateBorders();
1264 // status change notifications
1267 void wxWindowMac::MacVisibilityChanged()
1271 void wxWindowMac::MacHiliteChanged()
1275 void wxWindowMac::MacEnabledStateChanged()
1277 OnEnabled( GetPeer()->IsEnabled() );
1281 // status queries on the inherited window's state
1284 bool wxWindowMac::MacIsReallyEnabled()
1286 return GetPeer()->IsEnabled() ;
1289 bool wxWindowMac::MacIsReallyHilited()
1291 #if wxOSX_USE_CARBON
1292 return GetPeer()->IsActive();
1294 return true; // TODO
1298 int wxWindowMac::GetCharHeight() const
1301 GetTextExtent( wxT("g") , NULL
, &height
, NULL
, NULL
, NULL
);
1306 int wxWindowMac::GetCharWidth() const
1309 GetTextExtent( wxT("g") , &width
, NULL
, NULL
, NULL
, NULL
);
1314 void wxWindowMac::DoGetTextExtent(const wxString
& str
,
1317 int *externalLeading
,
1318 const wxFont
*theFont
) const
1320 const wxFont
*fontToUse
= theFont
;
1324 tempFont
= GetFont();
1325 fontToUse
= &tempFont
;
1328 wxGraphicsContext
* ctx
= wxGraphicsContext::Create();
1329 ctx
->SetFont( *fontToUse
, *wxBLACK
);
1331 wxDouble h
, d
, e
, w
;
1332 ctx
->GetTextExtent( str
, &w
, &h
, &d
, &e
);
1336 if ( externalLeading
)
1337 *externalLeading
= (wxCoord
)(e
+0.5);
1339 *descent
= (wxCoord
)(d
+0.5);
1341 *x
= (wxCoord
)(w
+0.5);
1343 *y
= (wxCoord
)(h
+0.5);
1347 * Rect is given in client coordinates, for further reading, read wxTopLevelWindowMac::InvalidateRect
1348 * we always intersect with the entire window, not only with the client area
1351 void wxWindowMac::Refresh(bool WXUNUSED(eraseBack
), const wxRect
*rect
)
1353 if ( GetPeer() == NULL
)
1356 if ( !IsShownOnScreen() )
1359 GetPeer()->SetNeedsDisplay( rect
) ;
1362 void wxWindowMac::DoFreeze()
1364 #if wxOSX_USE_CARBON
1365 if ( GetPeer() && GetPeer()->IsOk() )
1366 GetPeer()->SetDrawingEnabled( false ) ;
1370 void wxWindowMac::DoThaw()
1372 #if wxOSX_USE_CARBON
1373 if ( GetPeer() && GetPeer()->IsOk() )
1375 GetPeer()->SetDrawingEnabled( true ) ;
1376 GetPeer()->InvalidateWithChildren() ;
1381 wxWindow
*wxGetActiveWindow()
1383 // actually this is a windows-only concept
1387 // Coordinates relative to the window
1388 void wxWindowMac::WarpPointer(int x_pos
, int y_pos
)
1390 #if wxOSX_USE_COCOA_OR_CARBON
1393 DoClientToScreen(&x
, &y
);
1394 CGPoint cgpoint
= CGPointMake( x
, y
);
1395 CGWarpMouseCursorPosition( cgpoint
);
1397 // At least GTK sends a mouse moved event after WarpMouse
1398 wxMouseEvent
event(wxEVT_MOTION
);
1401 wxMouseState mState
= ::wxGetMouseState();
1403 event
.m_altDown
= mState
.AltDown();
1404 event
.m_controlDown
= mState
.ControlDown();
1405 event
.m_leftDown
= mState
.LeftIsDown();
1406 event
.m_middleDown
= mState
.MiddleIsDown();
1407 event
.m_rightDown
= mState
.RightIsDown();
1408 event
.m_metaDown
= mState
.MetaDown();
1409 event
.m_shiftDown
= mState
.ShiftDown();
1410 event
.SetId(GetId());
1411 event
.SetEventObject(this);
1412 GetEventHandler()->ProcessEvent(event
);
1416 int wxWindowMac::GetScrollPos(int orient
) const
1419 if ( orient
== wxHORIZONTAL
)
1422 return m_hScrollBar
->GetThumbPosition() ;
1427 return m_vScrollBar
->GetThumbPosition() ;
1433 // This now returns the whole range, not just the number
1434 // of positions that we can scroll.
1435 int wxWindowMac::GetScrollRange(int orient
) const
1438 if ( orient
== wxHORIZONTAL
)
1441 return m_hScrollBar
->GetRange() ;
1446 return m_vScrollBar
->GetRange() ;
1452 int wxWindowMac::GetScrollThumb(int orient
) const
1455 if ( orient
== wxHORIZONTAL
)
1458 return m_hScrollBar
->GetThumbSize() ;
1463 return m_vScrollBar
->GetThumbSize() ;
1469 void wxWindowMac::SetScrollPos(int orient
, int pos
, bool WXUNUSED(refresh
))
1472 if ( orient
== wxHORIZONTAL
)
1475 m_hScrollBar
->SetThumbPosition( pos
) ;
1480 m_vScrollBar
->SetThumbPosition( pos
) ;
1486 wxWindowMac::AlwaysShowScrollbars(bool hflag
, bool vflag
)
1488 bool needVisibilityUpdate
= false;
1490 if ( m_hScrollBarAlwaysShown
!= hflag
)
1492 m_hScrollBarAlwaysShown
= hflag
;
1493 needVisibilityUpdate
= true;
1496 if ( m_vScrollBarAlwaysShown
!= vflag
)
1498 m_vScrollBarAlwaysShown
= vflag
;
1499 needVisibilityUpdate
= true;
1502 if ( needVisibilityUpdate
)
1503 DoUpdateScrollbarVisibility();
1507 // we draw borders and grow boxes, are already set up and clipped in the current port / cgContextRef
1508 // our own window origin is at leftOrigin/rightOrigin
1511 void wxWindowMac::MacPaintGrowBox()
1517 if ( MacHasScrollBarCorner() )
1520 CGContextRef cgContext
= (CGContextRef
) MacGetCGContextRef() ;
1521 wxASSERT( cgContext
) ;
1525 GetPeer()->GetSize( tw
, th
);
1526 GetPeer()->GetPosition( tx
, ty
);
1528 Rect rect
= { ty
,tx
, ty
+th
, tx
+tw
};
1531 int size
= m_hScrollBar
? m_hScrollBar
->GetSize().y
: ( m_vScrollBar
? m_vScrollBar
->GetSize().x
: MAC_SCROLLBAR_SIZE
) ;
1532 CGRect cgrect
= CGRectMake( rect
.right
- size
, rect
.bottom
- size
, size
, size
) ;
1533 CGContextSaveGState( cgContext
);
1535 if ( m_backgroundColour
.Ok() )
1537 CGContextSetFillColorWithColor( cgContext
, m_backgroundColour
.GetCGColor() );
1541 CGContextSetRGBFillColor( cgContext
, (CGFloat
) 1.0, (CGFloat
)1.0 ,(CGFloat
) 1.0 , (CGFloat
)1.0 );
1543 CGContextFillRect( cgContext
, cgrect
);
1544 CGContextRestoreGState( cgContext
);
1548 if ( m_backgroundColour
.Ok() )
1549 m_growBox
->SetBackgroundColour(m_backgroundColour
);
1551 m_growBox
->SetBackgroundColour(*wxWHITE
);
1559 void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin
) , int WXUNUSED(rightOrigin
) )
1564 bool hasFocus
= GetPeer()->NeedsFocusRect() && HasFocus();
1566 // back to the surrounding frame rectangle
1569 GetPeer()->GetSize( tw
, th
);
1570 GetPeer()->GetPosition( tx
, ty
);
1572 Rect rect
= { ty
,tx
, ty
+th
, tx
+tw
};
1574 #if wxOSX_USE_COCOA_OR_CARBON
1576 InsetRect( &rect
, -1 , -1 ) ;
1579 CGRect cgrect
= CGRectMake( rect
.left
, rect
.top
, rect
.right
- rect
.left
,
1580 rect
.bottom
- rect
.top
) ;
1582 CGContextRef cgContext
= (CGContextRef
) GetParent()->MacGetCGContextRef() ;
1583 wxASSERT( cgContext
) ;
1585 if ( GetPeer()->NeedsFrame() )
1587 HIThemeFrameDrawInfo info
;
1588 memset( &info
, 0 , sizeof(info
) ) ;
1592 info
.state
= IsEnabled() ? kThemeStateActive
: kThemeStateInactive
;
1593 info
.isFocused
= hasFocus
;
1595 if ( HasFlag(wxRAISED_BORDER
) || HasFlag(wxSUNKEN_BORDER
) || HasFlag(wxDOUBLE_BORDER
) )
1597 info
.kind
= kHIThemeFrameTextFieldSquare
;
1598 HIThemeDrawFrame( &cgrect
, &info
, cgContext
, kHIThemeOrientationNormal
) ;
1600 else if ( HasFlag(wxSIMPLE_BORDER
) )
1602 info
.kind
= kHIThemeFrameListBox
;
1603 HIThemeDrawFrame( &cgrect
, &info
, cgContext
, kHIThemeOrientationNormal
) ;
1609 HIThemeDrawFocusRect( &cgrect
, true , cgContext
, kHIThemeOrientationNormal
) ;
1612 #endif // wxOSX_USE_COCOA_OR_CARBON
1615 void wxWindowMac::RemoveChild( wxWindowBase
*child
)
1618 if ( child
== m_hScrollBar
)
1619 m_hScrollBar
= NULL
;
1620 if ( child
== m_vScrollBar
)
1621 m_vScrollBar
= NULL
;
1622 if ( child
== m_growBox
)
1625 wxWindowBase::RemoveChild( child
) ;
1628 void wxWindowMac::DoUpdateScrollbarVisibility()
1631 bool triggerSizeEvent
= false;
1635 bool showHScrollBar
= m_hScrollBarAlwaysShown
|| m_hScrollBar
->IsNeeded();
1637 if ( m_hScrollBar
->IsShown() != showHScrollBar
)
1639 m_hScrollBar
->Show( showHScrollBar
);
1640 triggerSizeEvent
= true;
1646 bool showVScrollBar
= m_vScrollBarAlwaysShown
|| m_vScrollBar
->IsNeeded();
1648 if ( m_vScrollBar
->IsShown() != showVScrollBar
)
1650 m_vScrollBar
->Show( showVScrollBar
) ;
1651 triggerSizeEvent
= true;
1655 MacRepositionScrollBars() ;
1656 if ( triggerSizeEvent
)
1658 wxSizeEvent
event(GetSize(), m_windowId
);
1659 event
.SetEventObject(this);
1660 HandleWindowEvent(event
);
1665 // New function that will replace some of the above.
1666 void wxWindowMac::SetScrollbar(int orient
, int pos
, int thumb
,
1667 int range
, bool refresh
)
1670 // Updating scrollbars when window is being deleted is useless and
1671 // currently results in asserts in client-to-screen coordinates conversion
1672 // code which is used by DoUpdateScrollbarVisibility() so just skip it.
1673 if ( m_isBeingDeleted
)
1676 if ( orient
== wxHORIZONTAL
&& m_hScrollBar
)
1677 m_hScrollBar
->SetScrollbar(pos
, thumb
, range
, thumb
, refresh
);
1678 else if ( orient
== wxVERTICAL
&& m_vScrollBar
)
1679 m_vScrollBar
->SetScrollbar(pos
, thumb
, range
, thumb
, refresh
);
1681 DoUpdateScrollbarVisibility();
1685 // Does a physical scroll
1686 void wxWindowMac::ScrollWindow(int dx
, int dy
, const wxRect
*rect
)
1688 if ( dx
== 0 && dy
== 0 )
1691 int width
, height
;
1692 GetClientSize( &width
, &height
) ;
1695 wxRect
scrollrect( MacGetLeftBorderSize() , MacGetTopBorderSize() , width
, height
) ;
1697 scrollrect
.Intersect( *rect
) ;
1698 // as the native control might be not a 0/0 wx window coordinates, we have to offset
1699 scrollrect
.Offset( -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
1701 GetPeer()->ScrollRect( &scrollrect
, dx
, dy
);
1706 for (wxWindowList::compatibility_iterator node
= GetChildren().GetFirst(); node
; node
= node
->GetNext())
1708 child
= node
->GetData();
1712 if (child
->IsTopLevel())
1715 if ( !IsClientAreaChild(child
) )
1718 child
->GetPosition( &x
, &y
);
1719 child
->GetSize( &w
, &h
);
1722 wxRect
rc( x
, y
, w
, h
);
1723 if (rect
->Intersects( rc
))
1724 child
->SetSize( x
+ dx
, y
+ dy
, w
, h
, wxSIZE_AUTO
|wxSIZE_ALLOW_MINUS_ONE
);
1728 child
->SetSize( x
+ dx
, y
+ dy
, w
, h
, wxSIZE_AUTO
|wxSIZE_ALLOW_MINUS_ONE
);
1733 void wxWindowMac::MacOnScroll( wxScrollEvent
&event
)
1736 if ( event
.GetEventObject() == m_vScrollBar
|| event
.GetEventObject() == m_hScrollBar
)
1738 wxScrollWinEvent wevent
;
1739 wevent
.SetPosition(event
.GetPosition());
1740 wevent
.SetOrientation(event
.GetOrientation());
1741 wevent
.SetEventObject(this);
1743 if (event
.GetEventType() == wxEVT_SCROLL_TOP
)
1744 wevent
.SetEventType( wxEVT_SCROLLWIN_TOP
);
1745 else if (event
.GetEventType() == wxEVT_SCROLL_BOTTOM
)
1746 wevent
.SetEventType( wxEVT_SCROLLWIN_BOTTOM
);
1747 else if (event
.GetEventType() == wxEVT_SCROLL_LINEUP
)
1748 wevent
.SetEventType( wxEVT_SCROLLWIN_LINEUP
);
1749 else if (event
.GetEventType() == wxEVT_SCROLL_LINEDOWN
)
1750 wevent
.SetEventType( wxEVT_SCROLLWIN_LINEDOWN
);
1751 else if (event
.GetEventType() == wxEVT_SCROLL_PAGEUP
)
1752 wevent
.SetEventType( wxEVT_SCROLLWIN_PAGEUP
);
1753 else if (event
.GetEventType() == wxEVT_SCROLL_PAGEDOWN
)
1754 wevent
.SetEventType( wxEVT_SCROLLWIN_PAGEDOWN
);
1755 else if (event
.GetEventType() == wxEVT_SCROLL_THUMBTRACK
)
1756 wevent
.SetEventType( wxEVT_SCROLLWIN_THUMBTRACK
);
1757 else if (event
.GetEventType() == wxEVT_SCROLL_THUMBRELEASE
)
1758 wevent
.SetEventType( wxEVT_SCROLLWIN_THUMBRELEASE
);
1760 HandleWindowEvent(wevent
);
1765 wxWindow
*wxWindowBase::DoFindFocus()
1767 return wxFindWindowFromWXWidget(wxWidgetImpl::FindFocus());
1770 // Raise the window to the top of the Z order
1771 void wxWindowMac::Raise()
1776 // Lower the window to the bottom of the Z order
1777 void wxWindowMac::Lower()
1782 // static wxWindow *gs_lastWhich = NULL;
1784 bool wxWindowMac::MacSetupCursor( const wxPoint
& pt
)
1786 // first trigger a set cursor event
1788 wxPoint clientorigin
= GetClientAreaOrigin() ;
1789 wxSize clientsize
= GetClientSize() ;
1791 if ( wxRect2DInt( clientorigin
.x
, clientorigin
.y
, clientsize
.x
, clientsize
.y
).Contains( wxPoint2DInt( pt
) ) )
1793 wxSetCursorEvent
event( pt
.x
, pt
.y
);
1795 bool processedEvtSetCursor
= HandleWindowEvent(event
);
1796 if ( processedEvtSetCursor
&& event
.HasCursor() )
1798 cursor
= event
.GetCursor() ;
1802 // the test for processedEvtSetCursor is here to prevent using m_cursor
1803 // if the user code caught EVT_SET_CURSOR() and returned nothing from
1804 // it - this is a way to say that our cursor shouldn't be used for this
1806 if ( !processedEvtSetCursor
&& m_cursor
.Ok() )
1809 if ( !wxIsBusy() && !GetParent() )
1810 cursor
= *wxSTANDARD_CURSOR
;
1814 cursor
.MacInstall() ;
1817 return cursor
.Ok() ;
1820 wxString
wxWindowMac::MacGetToolTipString( wxPoint
&WXUNUSED(pt
) )
1824 return m_tooltip
->GetTip() ;
1827 return wxEmptyString
;
1830 void wxWindowMac::ClearBackground()
1836 void wxWindowMac::Update()
1838 wxNonOwnedWindow
* top
= MacGetTopLevelWindow();
1843 wxNonOwnedWindow
* wxWindowMac::MacGetTopLevelWindow() const
1845 wxWindowMac
*iter
= (wxWindowMac
*)this ;
1849 if ( iter
->IsTopLevel() )
1851 wxTopLevelWindow
* toplevel
= wxDynamicCast(iter
,wxTopLevelWindow
);
1855 wxPopupWindow
* popupwin
= wxDynamicCast(iter
,wxPopupWindow
);
1860 iter
= iter
->GetParent() ;
1866 const wxRect
& wxWindowMac::MacGetClippedClientRect() const
1868 MacUpdateClippedRects() ;
1870 return m_cachedClippedClientRect
;
1873 const wxRect
& wxWindowMac::MacGetClippedRect() const
1875 MacUpdateClippedRects() ;
1877 return m_cachedClippedRect
;
1880 const wxRect
&wxWindowMac:: MacGetClippedRectWithOuterStructure() const
1882 MacUpdateClippedRects() ;
1884 return m_cachedClippedRectWithOuterStructure
;
1887 const wxRegion
& wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures
)
1889 static wxRegion emptyrgn
;
1891 if ( !m_isBeingDeleted
&& IsShownOnScreen() )
1893 MacUpdateClippedRects() ;
1894 if ( includeOuterStructures
)
1895 return m_cachedClippedRegionWithOuterStructure
;
1897 return m_cachedClippedRegion
;
1905 void wxWindowMac::MacUpdateClippedRects() const
1907 #if wxOSX_USE_CARBON
1908 if ( m_cachedClippedRectValid
)
1911 // includeOuterStructures is true if we try to draw somthing like a focus ring etc.
1912 // also a window dc uses this, in this case we only clip in the hierarchy for hard
1913 // borders like a scrollwindow, splitter etc otherwise we end up in a paranoia having
1914 // to add focus borders everywhere
1916 Rect rIncludingOuterStructures
;
1920 GetPeer()->GetSize( tw
, th
);
1921 GetPeer()->GetPosition( tx
, ty
);
1923 Rect r
= { ty
,tx
, ty
+th
, tx
+tw
};
1925 r
.left
-= MacGetLeftBorderSize() ;
1926 r
.top
-= MacGetTopBorderSize() ;
1927 r
.bottom
+= MacGetBottomBorderSize() ;
1928 r
.right
+= MacGetRightBorderSize() ;
1935 rIncludingOuterStructures
= r
;
1936 InsetRect( &rIncludingOuterStructures
, -4 , -4 ) ;
1938 wxRect cl
= GetClientRect() ;
1939 Rect rClient
= { cl
.y
, cl
.x
, cl
.y
+ cl
.height
, cl
.x
+ cl
.width
} ;
1943 const wxWindow
* child
= (wxWindow
*) this ;
1944 const wxWindow
* parent
= NULL
;
1946 while ( !child
->IsTopLevel() && ( parent
= child
->GetParent() ) != NULL
)
1948 if ( parent
->MacIsChildOfClientArea(child
) )
1950 size
= parent
->GetClientSize() ;
1951 wxPoint origin
= parent
->GetClientAreaOrigin() ;
1957 // this will be true for scrollbars, toolbars etc.
1958 size
= parent
->GetSize() ;
1959 y
= parent
->MacGetTopBorderSize() ;
1960 x
= parent
->MacGetLeftBorderSize() ;
1961 size
.x
-= parent
->MacGetLeftBorderSize() + parent
->MacGetRightBorderSize() ;
1962 size
.y
-= parent
->MacGetTopBorderSize() + parent
->MacGetBottomBorderSize() ;
1965 parent
->MacWindowToRootWindow( &x
, &y
) ;
1966 MacRootWindowToWindow( &x
, &y
) ;
1968 Rect rparent
= { y
, x
, y
+ size
.y
, x
+ size
.x
} ;
1970 // the wxwindow and client rects will always be clipped
1971 SectRect( &r
, &rparent
, &r
) ;
1972 SectRect( &rClient
, &rparent
, &rClient
) ;
1974 // the structure only at 'hard' borders
1975 if ( parent
->MacClipChildren() ||
1976 ( parent
->GetParent() && parent
->GetParent()->MacClipGrandChildren() ) )
1978 SectRect( &rIncludingOuterStructures
, &rparent
, &rIncludingOuterStructures
) ;
1984 m_cachedClippedRect
= wxRect( r
.left
, r
.top
, r
.right
- r
.left
, r
.bottom
- r
.top
) ;
1985 m_cachedClippedClientRect
= wxRect( rClient
.left
, rClient
.top
,
1986 rClient
.right
- rClient
.left
, rClient
.bottom
- rClient
.top
) ;
1987 m_cachedClippedRectWithOuterStructure
= wxRect(
1988 rIncludingOuterStructures
.left
, rIncludingOuterStructures
.top
,
1989 rIncludingOuterStructures
.right
- rIncludingOuterStructures
.left
,
1990 rIncludingOuterStructures
.bottom
- rIncludingOuterStructures
.top
) ;
1992 m_cachedClippedRegionWithOuterStructure
= wxRegion( m_cachedClippedRectWithOuterStructure
) ;
1993 m_cachedClippedRegion
= wxRegion( m_cachedClippedRect
) ;
1994 m_cachedClippedClientRegion
= wxRegion( m_cachedClippedClientRect
) ;
1996 m_cachedClippedRectValid
= true ;
2001 This function must not change the updatergn !
2003 bool wxWindowMac::MacDoRedraw( long time
)
2005 bool handled
= false ;
2007 wxRegion formerUpdateRgn
= m_updateRegion
;
2008 wxRegion clientUpdateRgn
= formerUpdateRgn
;
2010 const wxRect clientRect
= GetClientRect();
2012 clientUpdateRgn
.Intersect(clientRect
);
2014 // first send an erase event to the entire update area
2015 const wxBackgroundStyle bgStyle
= GetBackgroundStyle();
2018 case wxBG_STYLE_ERASE
:
2019 case wxBG_STYLE_SYSTEM
:
2020 case wxBG_STYLE_COLOUR
:
2022 // for the toplevel window this really is the entire area for
2023 // all the others only their client area, otherwise they might
2024 // be drawing with full alpha and eg put blue into the grow-box
2025 // area of a scrolled window (scroll sample)
2026 wxWindowDC
dc(this);
2028 dc
.SetDeviceClippingRegion(formerUpdateRgn
);
2030 dc
.SetDeviceClippingRegion(clientUpdateRgn
);
2032 if ( bgStyle
== wxBG_STYLE_ERASE
)
2034 wxEraseEvent
eevent( GetId(), &dc
);
2035 eevent
.SetEventObject( this );
2036 if ( ProcessWindowEvent( eevent
) )
2042 dc
.SetBackground(GetBackgroundColour());
2048 case wxBG_STYLE_PAINT
:
2049 case wxBG_STYLE_TRANSPARENT
:
2050 // nothing to do, user-defined EVT_PAINT handler will overwrite the
2051 // entire window client area
2055 wxFAIL_MSG( "unsupported background style" );
2058 // as this is a full window, shouldn't be necessary anymore
2059 // MacPaintGrowBox();
2061 // calculate a client-origin version of the update rgn and set
2062 // m_updateRegion to that
2063 clientUpdateRgn
.Offset(-clientRect
.GetPosition());
2064 m_updateRegion
= clientUpdateRgn
;
2066 if ( !m_updateRegion
.Empty() )
2068 // paint the window itself
2070 wxPaintEvent
event(GetId());
2071 event
.SetTimestamp(time
);
2072 event
.SetEventObject(this);
2073 handled
= HandleWindowEvent(event
);
2076 m_updateRegion
= formerUpdateRgn
;
2080 void wxWindowMac::MacPaintChildrenBorders()
2082 // now we cannot rely on having its borders drawn by a window itself, as it does not
2083 // get the updateRgn wide enough to always do so, so we do it from the parent
2084 // this would also be the place to draw any custom backgrounds for native controls
2085 // in Composited windowing
2086 wxPoint clientOrigin
= GetClientAreaOrigin() ;
2090 for (wxWindowList::compatibility_iterator node
= GetChildren().GetFirst(); node
; node
= node
->GetNext())
2092 child
= node
->GetData();
2096 if (child
== m_vScrollBar
)
2098 if (child
== m_hScrollBar
)
2100 if (child
== m_growBox
)
2103 if (child
->IsTopLevel())
2105 if (!child
->IsShown())
2108 // only draw those in the update region (add a safety margin of 10 pixels for shadow effects
2110 child
->GetPosition( &x
, &y
);
2111 child
->GetSize( &w
, &h
);
2113 if ( m_updateRegion
.Contains(clientOrigin
.x
+x
-10, clientOrigin
.y
+y
-10, w
+20, h
+20) )
2115 // paint custom borders
2116 wxNcPaintEvent
eventNc( child
->GetId() );
2117 eventNc
.SetEventObject( child
);
2118 if ( !child
->HandleWindowEvent( eventNc
) )
2120 child
->MacPaintBorders(0, 0) ;
2127 WXWindow
wxWindowMac::MacGetTopLevelWindowRef() const
2129 wxNonOwnedWindow
* tlw
= MacGetTopLevelWindow();
2130 return tlw
? tlw
->GetWXWindow() : NULL
;
2133 bool wxWindowMac::MacHasScrollBarCorner() const
2136 /* Returns whether the scroll bars in a wxScrolledWindow should be
2137 * shortened. Scroll bars should be shortened if either:
2139 * - both scroll bars are visible, or
2141 * - there is a resize box in the parent frame's corner and this
2142 * window shares the bottom and right edge with the parent
2146 if ( m_hScrollBar
== NULL
&& m_vScrollBar
== NULL
)
2149 if ( ( m_hScrollBar
&& m_hScrollBar
->IsShown() )
2150 && ( m_vScrollBar
&& m_vScrollBar
->IsShown() ) )
2152 // Both scroll bars visible
2157 wxPoint thisWindowBottomRight
= GetScreenRect().GetBottomRight();
2159 for ( const wxWindow
*win
= (wxWindow
*)this; win
; win
= win
->GetParent() )
2161 const wxFrame
*frame
= wxDynamicCast( win
, wxFrame
) ;
2164 if ( frame
->GetWindowStyleFlag() & wxRESIZE_BORDER
)
2166 // Parent frame has resize handle
2167 wxPoint frameBottomRight
= frame
->GetScreenRect().GetBottomRight();
2169 // Note: allow for some wiggle room here as wxMac's
2170 // window rect calculations seem to be imprecise
2171 if ( abs( thisWindowBottomRight
.x
- frameBottomRight
.x
) <= 2
2172 && abs( thisWindowBottomRight
.y
- frameBottomRight
.y
) <= 2 )
2174 // Parent frame has resize handle and shares
2175 // right bottom corner
2180 // Parent frame has resize handle but doesn't
2181 // share right bottom corner
2187 // Parent frame doesn't have resize handle
2193 // No parent frame found
2201 void wxWindowMac::MacCreateScrollBars( long style
)
2204 wxASSERT_MSG( m_vScrollBar
== NULL
&& m_hScrollBar
== NULL
, wxT("attempt to create window twice") ) ;
2206 if ( style
& ( wxVSCROLL
| wxHSCROLL
) )
2208 int scrlsize
= MAC_SCROLLBAR_SIZE
;
2209 if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL
|| GetWindowVariant() == wxWINDOW_VARIANT_MINI
)
2211 scrlsize
= MAC_SMALL_SCROLLBAR_SIZE
;
2214 int adjust
= MacHasScrollBarCorner() ? scrlsize
- 1: 0 ;
2216 GetClientSize( &width
, &height
) ;
2218 wxPoint
vPoint(width
- scrlsize
, 0) ;
2219 wxSize
vSize(scrlsize
, height
- adjust
) ;
2220 wxPoint
hPoint(0, height
- scrlsize
) ;
2221 wxSize
hSize(width
- adjust
, scrlsize
) ;
2223 // we have to set the min size to a smaller value, otherwise they cannot get smaller (InitialSize sets MinSize)
2224 if ( style
& wxVSCROLL
)
2226 m_vScrollBar
= new wxScrollBar((wxWindow
*)this, wxID_ANY
, vPoint
, vSize
, wxVERTICAL
);
2227 m_vScrollBar
->SetMinSize( wxDefaultSize
);
2230 if ( style
& wxHSCROLL
)
2232 m_hScrollBar
= new wxScrollBar((wxWindow
*)this, wxID_ANY
, hPoint
, hSize
, wxHORIZONTAL
);
2233 m_hScrollBar
->SetMinSize( wxDefaultSize
);
2236 wxPoint
gPoint(width
- scrlsize
, height
- scrlsize
);
2237 wxSize
gSize(scrlsize
, scrlsize
);
2238 m_growBox
= new wxBlindPlateWindow((wxWindow
*)this, wxID_ANY
, gPoint
, gSize
, 0);
2241 // because the create does not take into account the client area origin
2242 // we might have a real position shift
2243 MacRepositionScrollBars() ;
2247 bool wxWindowMac::MacIsChildOfClientArea( const wxWindow
* child
) const
2249 bool result
= ((child
== NULL
)
2251 || ((child
!= m_hScrollBar
) && (child
!= m_vScrollBar
) && (child
!= m_growBox
))
2258 void wxWindowMac::MacRepositionScrollBars()
2261 if ( !m_hScrollBar
&& !m_vScrollBar
)
2264 int scrlsize
= m_hScrollBar
? m_hScrollBar
->GetSize().y
: ( m_vScrollBar
? m_vScrollBar
->GetSize().x
: MAC_SCROLLBAR_SIZE
) ;
2265 int adjust
= MacHasScrollBarCorner() ? scrlsize
- 1 : 0 ;
2267 // get real client area
2269 GetSize( &width
, &height
);
2271 width
-= MacGetLeftBorderSize() + MacGetRightBorderSize();
2272 height
-= MacGetTopBorderSize() + MacGetBottomBorderSize();
2274 wxPoint
vPoint( width
- scrlsize
, 0 ) ;
2275 wxSize
vSize( scrlsize
, height
- adjust
) ;
2276 wxPoint
hPoint( 0 , height
- scrlsize
) ;
2277 wxSize
hSize( width
- adjust
, scrlsize
) ;
2280 m_vScrollBar
->SetSize( vPoint
.x
, vPoint
.y
, vSize
.x
, vSize
.y
, wxSIZE_ALLOW_MINUS_ONE
);
2282 m_hScrollBar
->SetSize( hPoint
.x
, hPoint
.y
, hSize
.x
, hSize
.y
, wxSIZE_ALLOW_MINUS_ONE
);
2285 if ( MacHasScrollBarCorner() )
2287 m_growBox
->SetSize( width
- scrlsize
, height
- scrlsize
, wxDefaultCoord
, wxDefaultCoord
, wxSIZE_USE_EXISTING
);
2288 if ( !m_growBox
->IsShown() )
2293 if ( m_growBox
->IsShown() )
2300 bool wxWindowMac::AcceptsFocus() const
2302 if ( GetPeer() == NULL
|| GetPeer()->IsUserPane() )
2303 return wxWindowBase::AcceptsFocus();
2305 return GetPeer()->CanFocus();
2308 void wxWindowMac::MacSuperChangedPosition()
2310 // only window-absolute structures have to be moved i.e. controls
2312 m_cachedClippedRectValid
= false ;
2315 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
2318 child
= node
->GetData();
2319 child
->MacSuperChangedPosition() ;
2321 node
= node
->GetNext();
2325 void wxWindowMac::MacTopLevelWindowChangedPosition()
2327 // only screen-absolute structures have to be moved i.e. glcanvas
2330 wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
2333 child
= node
->GetData();
2334 child
->MacTopLevelWindowChangedPosition() ;
2336 node
= node
->GetNext();
2340 long wxWindowMac::MacGetWXBorderSize() const
2347 if ( GetPeer() && GetPeer()->NeedsFrame() )
2349 if (HasFlag(wxRAISED_BORDER
) || HasFlag( wxSUNKEN_BORDER
) || HasFlag(wxDOUBLE_BORDER
))
2351 #if wxOSX_USE_COCOA_OR_CARBON
2352 // this metric is only the 'outset' outside the simple frame rect
2353 GetThemeMetric( kThemeMetricEditTextFrameOutset
, &border
) ;
2359 else if (HasFlag(wxSIMPLE_BORDER
))
2361 #if wxOSX_USE_COCOA_OR_CARBON
2362 // this metric is only the 'outset' outside the simple frame rect
2363 GetThemeMetric( kThemeMetricListBoxFrameOutset
, &border
) ;
2374 long wxWindowMac::MacGetLeftBorderSize() const
2376 // the wx borders are all symmetric in mac themes
2377 long border
= MacGetWXBorderSize() ;
2381 int left
, top
, right
, bottom
;
2382 GetPeer()->GetLayoutInset( left
, top
, right
, bottom
);
2390 long wxWindowMac::MacGetRightBorderSize() const
2392 // the wx borders are all symmetric in mac themes
2393 long border
= MacGetWXBorderSize() ;
2397 int left
, top
, right
, bottom
;
2398 GetPeer()->GetLayoutInset( left
, top
, right
, bottom
);
2405 long wxWindowMac::MacGetTopBorderSize() const
2407 // the wx borders are all symmetric in mac themes
2408 long border
= MacGetWXBorderSize() ;
2412 int left
, top
, right
, bottom
;
2413 GetPeer()->GetLayoutInset( left
, top
, right
, bottom
);
2420 long wxWindowMac::MacGetBottomBorderSize() const
2422 // the wx borders are all symmetric in mac themes
2423 long border
= MacGetWXBorderSize() ;
2427 int left
, top
, right
, bottom
;
2428 GetPeer()->GetLayoutInset( left
, top
, right
, bottom
);
2435 long wxWindowMac::MacRemoveBordersFromStyle( long style
)
2437 return style
& ~wxBORDER_MASK
;
2440 // Find the wxWindowMac at the current mouse position, returning the mouse
2442 wxWindow
* wxFindWindowAtPointer( wxPoint
& pt
)
2444 pt
= wxGetMousePosition();
2445 wxWindowMac
* found
= wxFindWindowAtPoint(pt
);
2447 return (wxWindow
*) found
;
2450 // Get the current mouse position.
2451 wxPoint
wxGetMousePosition()
2455 wxGetMousePosition( &x
, &y
);
2457 return wxPoint(x
, y
);
2460 void wxWindowMac::OnMouseEvent( wxMouseEvent
&event
)
2462 if ( event
.GetEventType() == wxEVT_RIGHT_DOWN
)
2464 // copied from wxGTK : CS
2465 // VZ: shouldn't we move this to base class then?
2467 // generate a "context menu" event: this is similar to wxEVT_RIGHT_DOWN
2470 // (a) it's a command event and so is propagated to the parent
2471 // (b) under MSW it can be generated from kbd too
2472 // (c) it uses screen coords (because of (a))
2473 wxContextMenuEvent
evtCtx(wxEVT_CONTEXT_MENU
,
2475 this->ClientToScreen(event
.GetPosition()));
2476 evtCtx
.SetEventObject(this);
2477 if ( ! HandleWindowEvent(evtCtx
) )
2486 void wxWindowMac::TriggerScrollEvent( wxEventType
WXUNUSED(scrollEvent
) )
2490 Rect
wxMacGetBoundsForControl( wxWindowMac
* window
, const wxPoint
& pos
, const wxSize
&size
, bool adjustForOrigin
)
2494 window
->MacGetBoundsForControl( pos
, size
, x
, y
, w
, h
, adjustForOrigin
) ;
2495 Rect bounds
= { y
, x
, y
+ h
, x
+ w
};
2500 bool wxWindowMac::OSXHandleClicked( double WXUNUSED(timestampsec
) )
2505 wxInt32
wxWindowMac::MacControlHit(WXEVENTHANDLERREF
WXUNUSED(handler
) , WXEVENTREF event
)
2507 #if wxOSX_USE_COCOA_OR_CARBON
2508 if ( OSXHandleClicked( GetEventTime((EventRef
)event
) ) )
2511 return eventNotHandledErr
;
2517 bool wxWindowMac::Reparent(wxWindowBase
*newParentBase
)
2519 wxWindowMac
*newParent
= (wxWindowMac
*)newParentBase
;
2520 if ( !wxWindowBase::Reparent(newParent
) )
2523 GetPeer()->RemoveFromParent();
2524 GetPeer()->Embed( GetParent()->GetPeer() );
2530 bool wxWindowMac::SetTransparent(wxByte alpha
)
2532 SetBackgroundStyle(wxBG_STYLE_TRANSPARENT
);
2534 if ( alpha
!= m_macAlpha
)
2536 m_macAlpha
= alpha
;
2543 bool wxWindowMac::CanSetTransparent()
2548 wxByte
wxWindowMac::GetTransparent() const
2553 bool wxWindowMac::IsShownOnScreen() const
2555 if ( GetPeer() && GetPeer()->IsOk() )
2557 bool peerVis
= GetPeer()->IsVisible();
2558 bool wxVis
= wxWindowBase::IsShownOnScreen();
2559 if( peerVis
!= wxVis
)
2561 // CS : put a breakpoint here to investigate differences
2562 // between native an wx visibilities
2563 // the only place where I've encountered them until now
2564 // are the hiding/showing sequences where the vis-changed event is
2565 // first sent to the innermost control, while wx does things
2566 // from the outmost control
2567 wxVis
= wxWindowBase::IsShownOnScreen();
2571 return GetPeer()->IsVisible();
2573 return wxWindowBase::IsShownOnScreen();
2576 bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent
& event
)
2578 bool handled
= false;
2580 // moved the ordinary key event sending AFTER the accel evaluation
2583 if ( !handled
&& event
.GetEventType() == wxEVT_KEY_DOWN
)
2585 wxWindow
*ancestor
= this;
2588 int command
= ancestor
->GetAcceleratorTable()->GetCommand( event
);
2591 wxEvtHandler
* const handler
= ancestor
->GetEventHandler();
2593 wxCommandEvent
command_event( wxEVT_COMMAND_MENU_SELECTED
, command
);
2594 handled
= handler
->ProcessEvent( command_event
);
2598 // accelerators can also be used with buttons, try them too
2599 command_event
.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED
);
2600 handled
= handler
->ProcessEvent( command_event
);
2606 if (ancestor
->IsTopLevel())
2609 ancestor
= ancestor
->GetParent();
2612 #endif // wxUSE_ACCEL
2616 handled
= HandleWindowEvent( event
) ;
2617 if ( handled
&& event
.GetSkipped() )
2628 WX_DECLARE_HASH_MAP(WXWidget
, wxWidgetImpl
*, wxPointerHash
, wxPointerEqual
, MacControlMap
);
2630 static MacControlMap wxWinMacControlList
;
2632 wxWindowMac
*wxFindWindowFromWXWidget(WXWidget inControl
)
2634 wxWidgetImpl
* impl
= wxWidgetImpl::FindFromWXWidget( inControl
);
2636 return impl
->GetWXPeer();
2641 wxWidgetImpl
*wxWidgetImpl::FindFromWXWidget(WXWidget inControl
)
2643 MacControlMap::iterator node
= wxWinMacControlList
.find(inControl
);
2645 return (node
== wxWinMacControlList
.end()) ? NULL
: node
->second
;
2648 void wxWidgetImpl::Associate(WXWidget inControl
, wxWidgetImpl
*impl
)
2650 // adding NULL ControlRef is (first) surely a result of an error and
2651 // (secondly) breaks native event processing
2652 wxCHECK_RET( inControl
!= (WXWidget
) NULL
, wxT("attempt to add a NULL WXWidget to control map") );
2654 wxWinMacControlList
[inControl
] = impl
;
2657 void wxWidgetImpl::RemoveAssociations(wxWidgetImpl
* impl
)
2659 // iterate over all the elements in the class
2660 // is the iterator stable ? as we might have two associations pointing to the same wxWindow
2661 // we should go on...
2667 MacControlMap::iterator it
;
2668 for ( it
= wxWinMacControlList
.begin(); it
!= wxWinMacControlList
.end(); ++it
)
2670 if ( it
->second
== impl
)
2672 wxWinMacControlList
.erase(it
);
2680 IMPLEMENT_ABSTRACT_CLASS( wxWidgetImpl
, wxObject
)
2682 wxWidgetImpl::wxWidgetImpl( wxWindowMac
* peer
, bool isRootControl
, bool isUserPane
)
2685 m_isRootControl
= isRootControl
;
2686 m_isUserPane
= isUserPane
;
2688 m_shouldSendEvents
= true;
2691 wxWidgetImpl::wxWidgetImpl()
2696 wxWidgetImpl::~wxWidgetImpl()
2700 void wxWidgetImpl::Init()
2702 m_isRootControl
= false;
2704 m_needsFocusRect
= false;
2705 m_needsFrame
= true;
2708 void wxWidgetImpl::SetNeedsFocusRect( bool needs
)
2710 m_needsFocusRect
= needs
;
2713 bool wxWidgetImpl::NeedsFocusRect() const
2715 return m_needsFocusRect
;
2718 void wxWidgetImpl::SetNeedsFrame( bool needs
)
2720 m_needsFrame
= needs
;
2723 bool wxWidgetImpl::NeedsFrame() const
2725 return m_needsFrame
;