1 /////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "window.h"
19 #include "wx/dcclient.h"
23 #include "wx/layout.h"
24 #include "wx/dialog.h"
25 #include "wx/listbox.h"
26 #include "wx/button.h"
27 #include "wx/settings.h"
28 #include "wx/msgdlg.h"
30 #include "wx/notebook.h"
31 #include "wx/tabctrl.h"
32 // TODO remove the line below, just for lookup-up convenience CS
33 #include "wx/mac/window.h"
35 #include "wx/menuitem.h"
42 #define wxWINDOW_HSCROLL 5998
43 #define wxWINDOW_VSCROLL 5997
44 #define MAC_SCROLLBAR_SIZE 16
46 #include <wx/mac/uma.h>
48 #if wxUSE_DRAG_AND_DROP
54 extern wxList wxPendingDelete
;
55 wxWindow
* gFocusWindow
= NULL
;
57 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxEvtHandler
)
59 BEGIN_EVENT_TABLE(wxWindow
, wxEvtHandler
)
60 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground
)
61 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged
)
62 EVT_INIT_DIALOG(wxWindow::OnInitDialog
)
63 EVT_IDLE(wxWindow::OnIdle
)
64 // EVT_SCROLL(wxWindow::OnScroll)
70 // ===========================================================================
72 // ===========================================================================
74 // ---------------------------------------------------------------------------
75 // wxWindow utility functions
76 // ---------------------------------------------------------------------------
78 // Find an item given the Macintosh Window Reference
80 wxList
*wxWinMacWindowList
= NULL
;
81 wxWindow
*wxFindWinFromMacWindow(WindowRef inWindowRef
)
83 wxNode
*node
= wxWinMacWindowList
->Find((long)inWindowRef
);
86 return (wxWindow
*)node
->Data();
89 void wxAssociateWinWithMacWindow(WindowRef inWindowRef
, wxWindow
*win
)
91 // adding NULL WindowRef is (first) surely a result of an error and
92 // (secondly) breaks menu command processing
93 wxCHECK_RET( inWindowRef
!= (WindowRef
) NULL
, "attempt to add a NULL WindowRef to window list" );
95 if ( !wxWinMacWindowList
->Find((long)inWindowRef
) )
96 wxWinMacWindowList
->Append((long)inWindowRef
, win
);
99 void wxRemoveMacWindowAssociation(wxWindow
*win
)
101 wxWinMacWindowList
->DeleteObject(win
);
104 // ----------------------------------------------------------------------------
105 // constructors and such
106 // ----------------------------------------------------------------------------
108 void wxWindow::Init()
114 m_doubleClickAllowed
= 0;
115 m_winCaptured
= FALSE
;
117 m_isBeingDeleted
= FALSE
;
120 m_mouseInWindow
= FALSE
;
124 m_backgroundTransparent
= FALSE
;
126 // as all windows are created with WS_VISIBLE style...
129 m_macWindowData
= NULL
;
136 m_hScrollBar
= NULL
;
137 m_vScrollBar
= NULL
;
139 #if wxUSE_DRAG_AND_DROP
140 m_pDropTarget
= NULL
;
145 wxWindow::~wxWindow()
147 m_isBeingDeleted
= TRUE
;
149 if ( s_lastMouseWindow
== this )
151 s_lastMouseWindow
= NULL
;
154 if ( gFocusWindow
== this )
156 gFocusWindow
= NULL
;
160 m_parent
->RemoveChild(this);
164 if ( m_macWindowData
)
166 UMADisposeWindow( m_macWindowData
->m_macWindow
) ;
167 delete m_macWindowData
;
168 wxRemoveMacWindowAssociation( this ) ;
173 bool wxWindow::Create(wxWindow
*parent
, wxWindowID id
,
177 const wxString
& name
)
179 wxCHECK_MSG( parent
, FALSE
, wxT("can't create wxWindow without parent") );
181 if ( !CreateBase(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
184 parent
->AddChild(this);
188 AdjustForParentClientOrigin(m_x
, m_y
, wxSIZE_USE_EXISTING
);
189 m_width
= WidthDefault( size
.x
);
190 m_height
= HeightDefault( size
.y
) ;
192 MacCreateScrollBars( style
) ;
197 void wxWindow::SetFocus()
199 if ( AcceptsFocus() )
205 if ( gFocusWindow
->m_caret
)
207 gFocusWindow
->m_caret
->OnKillFocus();
209 #endif // wxUSE_CARET
210 wxControl
* control
= wxDynamicCast( gFocusWindow
, wxControl
) ;
211 if ( control
&& control
->GetMacControl() )
213 UMASetKeyboardFocus( gFocusWindow
->GetMacRootWindow() , control
->GetMacControl() , kControlFocusNoPart
) ;
215 wxFocusEvent
event(wxEVT_KILL_FOCUS
, gFocusWindow
->m_windowId
);
216 event
.SetEventObject(gFocusWindow
);
217 gFocusWindow
->GetEventHandler()->ProcessEvent(event
) ;
219 gFocusWindow
= this ;
225 m_caret
->OnSetFocus();
227 #endif // wxUSE_CARET
228 // panel wants to track the window which was the last to have focus in it
229 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
232 panel
->SetLastFocus(this);
234 wxControl
* control
= wxDynamicCast( gFocusWindow
, wxControl
) ;
235 if ( control
&& control
->GetMacControl() )
237 UMASetKeyboardFocus( gFocusWindow
->GetMacRootWindow() , control
->GetMacControl() , kControlEditTextPart
) ;
240 wxFocusEvent
event(wxEVT_SET_FOCUS
, m_windowId
);
241 event
.SetEventObject(this);
242 GetEventHandler()->ProcessEvent(event
) ;
247 bool wxWindow::Enable(bool enable
)
249 if ( !wxWindowBase::Enable(enable
) )
252 HWND hWnd = GetHwnd();
254 ::EnableWindow(hWnd, (BOOL)enable);
257 wxWindowList::Node
*node
= GetChildren().GetFirst();
260 wxWindow
*child
= node
->GetData();
261 child
->Enable(enable
);
263 node
= node
->GetNext();
269 void wxWindow::CaptureMouse()
271 wxTheApp
->s_captureWindow
= this ;
274 void wxWindow::ReleaseMouse()
276 wxTheApp
->s_captureWindow
= NULL
;
279 #if wxUSE_DRAG_AND_DROP
281 void wxWindow::SetDropTarget(wxDropTarget
*pDropTarget
)
283 if ( m_pDropTarget
!= 0 ) {
284 delete m_pDropTarget
;
287 m_pDropTarget
= pDropTarget
;
288 if ( m_pDropTarget
!= 0 )
296 // Old style file-manager drag&drop
297 void wxWindow::DragAcceptFiles(bool accept
)
303 void wxWindow::DoGetSize(int *x
, int *y
) const
309 void wxWindow::DoGetPosition(int *x
, int *y
) const
315 wxPoint
pt(GetParent()->GetClientAreaOrigin());
321 wxSize
wxWindow::DoGetBestSize()
323 return wxSize( 0 , 0 ) ;
326 bool wxWindow::Reparent(wxWindow
*parent
)
328 if ( !wxWindowBase::Reparent(parent
) )
334 bool wxWindow::DoPopupMenu(wxMenu
*menu
, int x
, int y
)
336 menu
->SetInvokingWindow(this);
338 ClientToScreen( &x
, &y
) ;
340 ::InsertMenu( menu
->GetHMenu() , -1 ) ;
341 long menuResult
= ::PopUpMenuSelect(menu
->GetHMenu() ,y
,x
, 0) ;
342 menu
->MacMenuSelect( this , TickCount() , HiWord(menuResult
) , LoWord(menuResult
) ) ;
343 ::DeleteMenu( menu
->MacGetMenuId() ) ;
344 menu
->SetInvokingWindow(NULL
);
349 void wxWindow::DoScreenToClient(int *x
, int *y
) const
351 WindowRef window
= GetMacRootWindow() ;
359 ::SetPort( UMAGetWindowPort( window
) ) ;
360 ::GlobalToLocal( &localwhere
) ;
366 MacRootWindowToClient( x
, y
) ;
369 void wxWindow::DoClientToScreen(int *x
, int *y
) const
371 WindowRef window
= GetMacRootWindow() ;
373 MacClientToRootWindow( x
, y
) ;
381 ::SetPort( UMAGetWindowPort( window
) ) ;
382 ::LocalToGlobal( &localwhere
) ;
388 void wxWindow::MacClientToRootWindow( int *x
, int *y
) const
390 if ( m_macWindowData
)
397 GetParent()->MacClientToRootWindow( x
, y
) ;
401 void wxWindow::MacRootWindowToClient( int *x
, int *y
) const
403 if ( m_macWindowData
)
410 GetParent()->MacRootWindowToClient( x
, y
) ;
414 bool wxWindow::SetCursor(const wxCursor
& cursor
)
416 if ( !wxWindowBase::SetCursor(cursor
) )
422 wxASSERT_MSG( m_cursor
.Ok(),
423 wxT("cursor must be valid after call to the base version"));
429 // Change the cursor NOW if we're within the correct window
431 if ( MacGetWindowFromPoint( wxPoint( pt
.h
, pt
.v
) , &mouseWin
) )
433 if ( mouseWin
== this && !wxIsBusy() )
435 cursor
.MacInstall() ;
443 // Get size *available for subwindows* i.e. excluding menu bar etc.
444 void wxWindow::DoGetClientSize(int *x
, int *y
) const
449 if (m_vScrollBar
&& m_vScrollBar
->IsShown() )
450 (*x
) -= MAC_SCROLLBAR_SIZE
;
451 if (m_hScrollBar
&& m_hScrollBar
->IsShown() )
452 (*y
) -= MAC_SCROLLBAR_SIZE
;
456 // ----------------------------------------------------------------------------
458 // ----------------------------------------------------------------------------
462 void wxWindow::DoSetToolTip(wxToolTip
*tooltip
)
464 wxWindowBase::DoSetToolTip(tooltip
);
467 // m_tooltip->SetWindow(this);
470 #endif // wxUSE_TOOLTIPS
472 void wxWindow::DoMoveWindow(int x
, int y
, int width
, int height
)
474 DoSetSize( x
,y
, width
, height
) ;
477 void wxWindow::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
481 int former_w
= m_width
;
482 int former_h
= m_height
;
484 int currentX
, currentY
;
485 GetPosition(¤tX
, ¤tY
);
486 int currentW
,currentH
;
487 GetSize(¤tW
, ¤tH
);
489 int actualWidth
= width
;
490 int actualHeight
= height
;
493 if (x
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
495 if (y
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
498 actualWidth
= currentW
;
500 actualHeight
= currentH
;
502 if ( actualX
== currentX
&& actualY
== currentY
&& actualWidth
== currentW
&& actualHeight
== currentH
)
504 MacRepositionScrollBars() ; // we might have a real position shift
508 AdjustForParentClientOrigin(actualX
, actualY
, sizeFlags
);
511 bool doMove
= false ;
512 bool doResize
= false ;
514 if ( actualX
!= former_x
|| actualY
!= former_y
)
518 if ( actualWidth
!= former_w
|| actualHeight
!= former_h
)
523 if ( doMove
|| doResize
)
525 if ( m_macWindowData
)
530 // erase former position
532 wxMacDrawingClientHelper
focus( this ) ;
535 Rect clientrect
= { 0 , 0 , m_height
, m_width
} ;
536 InvalRect( &clientrect
) ;
542 m_width
= actualWidth
;
543 m_height
= actualHeight
;
544 if ( m_macWindowData
)
547 ::MoveWindow(m_macWindowData
->m_macWindow
, m_x
, m_y
, false); // don't make frontmost
550 ::SizeWindow(m_macWindowData
->m_macWindow
, m_width
, m_height
, true);
552 // the OS takes care of invalidating and erasing
554 if ( IsKindOf( CLASSINFO( wxFrame
) ) )
556 wxFrame
* frame
= (wxFrame
*) this ;
557 frame
->PositionStatusBar();
558 frame
->PositionToolBar();
563 // erase new position
565 wxMacDrawingClientHelper
focus( this ) ;
568 Rect clientrect
= { 0 , 0 , m_height
, m_width
} ;
569 InvalRect( &clientrect
) ;
573 wxWindow::MacSuperChangedPosition() ; // like this only children will be notified
575 MacRepositionScrollBars() ;
578 wxMoveEvent
event(wxPoint(m_x
, m_y
), m_windowId
);
579 event
.SetEventObject(this);
580 GetEventHandler()->ProcessEvent(event
) ;
584 MacRepositionScrollBars() ;
585 wxSizeEvent
event(wxSize(m_width
, m_height
), m_windowId
);
586 event
.SetEventObject(this);
587 GetEventHandler()->ProcessEvent(event
);
591 // For implementation purposes - sometimes decorations make the client area
594 wxPoint
wxWindow::GetClientAreaOrigin() const
596 return wxPoint(0, 0);
599 // Makes an adjustment to the window position (for example, a frame that has
600 // a toolbar that it manages itself).
601 void wxWindow::AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
)
603 if( !m_macWindowData
)
605 if (((sizeFlags
& wxSIZE_NO_ADJUSTMENTS
) == 0) && GetParent())
607 wxPoint
pt(GetParent()->GetClientAreaOrigin());
608 x
+= pt
.x
; y
+= pt
.y
;
613 void wxWindow::SetTitle(const wxString
& title
)
619 if( wxApp::s_macDefaultEncodingIsPC
)
620 label
= wxMacMakeMacStringFromPC( title
) ;
624 if ( m_macWindowData
)
625 UMASetWTitleC( m_macWindowData
->m_macWindow
, label
) ;
628 wxString
wxWindow::GetTitle() const
633 bool wxWindow::Show(bool show
)
635 if ( !wxWindowBase::Show(show
) )
638 if ( m_macWindowData
)
642 UMAShowWindow( m_macWindowData
->m_macWindow
) ;
643 UMASelectWindow( m_macWindowData
->m_macWindow
) ;
644 // no need to generate events here, they will get them triggered by macos
645 wxSizeEvent
event(wxSize(m_width
, m_height
), m_windowId
);
646 event
.SetEventObject(this);
647 GetEventHandler()->ProcessEvent(event
);
651 UMAHideWindow( m_macWindowData
->m_macWindow
) ;
659 int wxWindow::GetCharHeight() const
661 wxClientDC
dc ( (wxWindow
*)this ) ;
662 return dc
.GetCharHeight() ;
665 int wxWindow::GetCharWidth() const
667 wxClientDC
dc ( (wxWindow
*)this ) ;
668 return dc
.GetCharWidth() ;
671 void wxWindow::GetTextExtent(const wxString
& string
, int *x
, int *y
,
672 int *descent
, int *externalLeading
, const wxFont
*theFont
) const
674 const wxFont
*fontToUse
= theFont
;
678 wxClientDC
dc( this ) ;
680 dc
.GetTextExtent( string
, &lx
, &ly
, &ld
, &le
, fontToUse
) ;
681 *externalLeading
= le
;
687 void wxWindow::MacEraseBackground( Rect
*rect
)
689 WindowRef window
= GetMacRootWindow() ;
690 if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
) )
692 UMASetThemeWindowBackground( window
, kThemeBrushDocumentWindowBackground
, false ) ;
694 else if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
696 // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
697 // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
698 // either a non gray background color or a non control window
700 wxWindow
* parent
= GetParent() ;
703 if ( parent
->m_backgroundColour
!= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
705 // if we have any other colours in the hierarchy
706 RGBBackColor( &parent
->m_backgroundColour
.GetPixel()) ;
709 if( parent
->IsKindOf( CLASSINFO( wxControl
) ) && ((wxControl
*)parent
)->GetMacControl() )
711 // if we have the normal colours in the hierarchy but another control etc. -> use it's background
712 if ( parent
->IsKindOf( CLASSINFO( wxNotebook
) ) || parent
->IsKindOf( CLASSINFO( wxTabCtrl
) ))
714 ApplyThemeBackground (kThemeBackgroundTabPane
, rect
, kThemeStateActive
,8,true);
720 // we have arrived at a non control item
724 parent
= parent
->GetParent() ;
728 // if there is nothing special -> use default
729 UMASetThemeWindowBackground( window
, kThemeBrushDialogBackgroundActive
, false ) ;
734 RGBBackColor( &m_backgroundColour
.GetPixel()) ;
739 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
741 wxWindow
*child
= (wxWindow
*)node
->Data();
745 // child->GetClientSize( &width , &height ) ;
747 Rect clientrect
= { child
->m_x
, child
->m_y
, child
->m_x
+child
->m_width
, child
->m_y
+ child
->m_height
} ;
748 SectRect( &clientrect
, rect
, &clientrect
) ;
750 OffsetRect( &clientrect
, -child
->m_x
, -child
->m_y
) ;
751 if ( child
->GetMacRootWindow() == window
&& child
->IsShown() )
753 wxMacDrawingClientHelper
focus( this ) ;
756 child
->MacEraseBackground( &clientrect
) ;
762 void wxWindow::Refresh(bool eraseBack
, const wxRect
*rect
)
764 wxMacDrawingClientHelper
focus( this ) ;
768 GetClientSize( &width
, &height
) ;
769 Rect clientrect
= { 0 , 0 , height
, width
} ;
770 ClipRect( &clientrect
) ;
774 Rect r
= { rect
->y
, rect
->x
, rect
->y
+ rect
->height
, rect
->x
+ rect
->width
} ;
775 SectRect( &clientrect
, &r
, &clientrect
) ;
777 InvalRect( &clientrect
) ;
781 MacEraseBackground( &clientrect ) ;
787 // Responds to colour changes: passes event on to children.
788 void wxWindow::OnSysColourChanged(wxSysColourChangedEvent
& event
)
790 wxNode
*node
= GetChildren().First();
793 // Only propagate to non-top-level windows
794 wxWindow
*win
= (wxWindow
*)node
->Data();
795 if ( win
->GetParent() )
797 wxSysColourChangedEvent event2
;
798 event
.m_eventObject
= win
;
799 win
->GetEventHandler()->ProcessEvent(event2
);
806 #if wxUSE_CARET && WXWIN_COMPATIBILITY
807 // ---------------------------------------------------------------------------
808 // Caret manipulation
809 // ---------------------------------------------------------------------------
811 void wxWindow::CreateCaret(int w
, int h
)
813 SetCaret(new wxCaret(this, w
, h
));
816 void wxWindow::CreateCaret(const wxBitmap
*WXUNUSED(bitmap
))
818 wxFAIL_MSG("not implemented");
821 void wxWindow::ShowCaret(bool show
)
823 wxCHECK_RET( m_caret
, "no caret to show" );
828 void wxWindow::DestroyCaret()
833 void wxWindow::SetCaretPos(int x
, int y
)
835 wxCHECK_RET( m_caret
, "no caret to move" );
840 void wxWindow::GetCaretPos(int *x
, int *y
) const
842 wxCHECK_RET( m_caret
, "no caret to get position of" );
844 m_caret
->GetPosition(x
, y
);
846 #endif // wxUSE_CARET
848 wxWindow
*wxGetActiveWindow()
850 // actually this is a windows-only concept
854 // Coordinates relative to the window
855 void wxWindow::WarpPointer (int x_pos
, int y_pos
)
857 // We really dont move the mouse programmatically under mac
860 void wxWindow::OnEraseBackground(wxEraseEvent
& event
)
862 // TODO : probably we would adopt the EraseEvent structure
865 int wxWindow::GetScrollPos(int orient
) const
867 if ( orient
== wxHORIZONTAL
)
870 return m_hScrollBar
->GetThumbPosition() ;
875 return m_vScrollBar
->GetThumbPosition() ;
880 // This now returns the whole range, not just the number
881 // of positions that we can scroll.
882 int wxWindow::GetScrollRange(int orient
) const
884 if ( orient
== wxHORIZONTAL
)
887 return m_hScrollBar
->GetRange() ;
892 return m_vScrollBar
->GetRange() ;
897 int wxWindow::GetScrollThumb(int orient
) const
899 if ( orient
== wxHORIZONTAL
)
902 return m_hScrollBar
->GetThumbSize() ;
907 return m_vScrollBar
->GetThumbSize() ;
912 void wxWindow::SetScrollPos(int orient
, int pos
, bool refresh
)
914 if ( orient
== wxHORIZONTAL
)
917 m_hScrollBar
->SetThumbPosition( pos
) ;
922 m_vScrollBar
->SetThumbPosition( pos
) ;
926 // New function that will replace some of the above.
927 void wxWindow::SetScrollbar(int orient
, int pos
, int thumbVisible
,
928 int range
, bool refresh
)
930 if ( orient
== wxHORIZONTAL
)
934 if ( range
== 0 || thumbVisible
>= range
)
936 if ( m_hScrollBar
->IsShown() )
937 m_hScrollBar
->Show(false) ;
941 if ( !m_hScrollBar
->IsShown() )
942 m_hScrollBar
->Show(true) ;
943 m_hScrollBar
->SetScrollbar( pos
, thumbVisible
, range
, refresh
) ;
951 if ( range
== 0 || thumbVisible
>= range
)
953 if ( m_vScrollBar
->IsShown() )
954 m_vScrollBar
->Show(false) ;
958 if ( !m_vScrollBar
->IsShown() )
959 m_vScrollBar
->Show(true) ;
960 m_vScrollBar
->SetScrollbar( pos
, thumbVisible
, range
, refresh
) ;
964 MacRepositionScrollBars() ;
967 // Does a physical scroll
968 void wxWindow::ScrollWindow(int dx
, int dy
, const wxRect
*rect
)
970 wxMacDrawingClientHelper
focus( this ) ;
974 GetClientSize( &width
, &height
) ;
975 Rect scrollrect
= { 0 , 0 , height
, width
} ;
977 RgnHandle updateRgn
= NewRgn() ;
978 ClipRect( &scrollrect
) ;
981 Rect r
= { rect
->y
, rect
->x
, rect
->y
+ rect
->height
, rect
->x
+ rect
->width
} ;
982 SectRect( &scrollrect
, &r
, &scrollrect
) ;
984 ScrollRect( &scrollrect
, dx
, dy
, updateRgn
) ;
985 InvalRgn( updateRgn
) ;
986 DisposeRgn( updateRgn
) ;
990 void wxWindow::MacOnScroll(wxScrollEvent
&event
)
992 if ( event
.m_eventObject
== m_vScrollBar
|| event
.m_eventObject
== m_hScrollBar
)
994 wxScrollWinEvent wevent
;
995 wevent
.SetPosition(event
.GetPosition());
996 wevent
.SetOrientation(event
.GetOrientation());
997 wevent
.m_eventObject
= this;
999 switch ( event
.m_eventType
)
1001 case wxEVT_SCROLL_TOP
:
1002 wevent
.m_eventType
= wxEVT_SCROLLWIN_TOP
;
1005 case wxEVT_SCROLL_BOTTOM
:
1006 wevent
.m_eventType
= wxEVT_SCROLLWIN_BOTTOM
;
1009 case wxEVT_SCROLL_LINEUP
:
1010 wevent
.m_eventType
= wxEVT_SCROLLWIN_LINEUP
;
1013 case wxEVT_SCROLL_LINEDOWN
:
1014 wevent
.m_eventType
= wxEVT_SCROLLWIN_LINEDOWN
;
1017 case wxEVT_SCROLL_PAGEUP
:
1018 wevent
.m_eventType
= wxEVT_SCROLLWIN_PAGEUP
;
1021 case wxEVT_SCROLL_PAGEDOWN
:
1022 wevent
.m_eventType
= wxEVT_SCROLLWIN_PAGEDOWN
;
1025 case wxEVT_SCROLL_THUMBTRACK
:
1026 wevent
.m_eventType
= wxEVT_SCROLLWIN_THUMBTRACK
;
1031 GetEventHandler()->ProcessEvent(wevent
);
1035 bool wxWindow::SetFont(const wxFont
& font
)
1037 if ( !wxWindowBase::SetFont(font
) )
1046 // Get the window with the focus
1047 wxWindow
*wxWindowBase::FindFocus()
1049 return gFocusWindow
;
1052 #if WXWIN_COMPATIBILITY
1053 // If nothing defined for this, try the parent.
1054 // E.g. we may be a button loaded from a resource, with no callback function
1056 void wxWindow::OnCommand(wxWindow
& win
, wxCommandEvent
& event
)
1058 if ( GetEventHandler()->ProcessEvent(event
) )
1061 m_parent
->GetEventHandler()->OnCommand(win
, event
);
1063 #endif // WXWIN_COMPATIBILITY_2
1065 #if WXWIN_COMPATIBILITY
1066 wxObject
* wxWindow::GetChild(int number
) const
1068 // Return a pointer to the Nth object in the Panel
1069 wxNode
*node
= GetChildren().First();
1072 node
= node
->Next();
1075 wxObject
*obj
= (wxObject
*)node
->Data();
1081 #endif // WXWIN_COMPATIBILITY
1083 void wxWindow::Clear()
1085 if ( m_macWindowData
)
1087 wxMacDrawingClientHelper
helper ( this ) ;
1089 wxPoint origin
= GetClientAreaOrigin() ;
1090 GetClientSize( &w
, &h
) ;
1091 UMASetThemeWindowBackground( m_macWindowData
->m_macWindow
, m_macWindowData
->m_macWindowBackgroundTheme
, false ) ;
1092 Rect r
= { origin
.y
, origin
.x
, origin
.y
+h
, origin
.x
+w
} ;
1097 wxClientDC
dc(this);
1098 wxBrush
brush(GetBackgroundColour(), wxSOLID
);
1099 dc
.SetBackground(brush
);
1104 // Setup background and foreground colours correctly
1105 void wxWindow::SetupColours()
1108 SetBackgroundColour(GetParent()->GetBackgroundColour());
1111 void wxWindow::OnIdle(wxIdleEvent
& event
)
1114 // Check if we need to send a LEAVE event
1115 if (m_mouseInWindow)
1118 ::GetCursorPos(&pt);
1119 if (::WindowFromPoint(pt) != (HWND) GetHWND())
1121 // Generate a LEAVE event
1122 m_mouseInWindow = FALSE;
1123 MSWOnMouseLeave(pt.x, pt.y, 0);
1128 // This calls the UI-update mechanism (querying windows for
1129 // menu/toolbar/control state information)
1133 // Raise the window to the top of the Z order
1134 void wxWindow::Raise()
1139 // Lower the window to the bottom of the Z order
1140 void wxWindow::Lower()
1145 void wxWindow::DoSetClientSize(int width
, int height
)
1147 if ( width
!= -1 || height
!= -1 )
1150 if ( width
!= -1 && m_vScrollBar
)
1151 width
+= MAC_SCROLLBAR_SIZE
;
1152 if ( height
!= -1 && m_vScrollBar
)
1153 height
+= MAC_SCROLLBAR_SIZE
;
1155 DoSetSize( -1 , -1 , width
, height
) ;
1160 wxWindow
* wxWindow::s_lastMouseWindow
= NULL
;
1162 bool wxWindow::MacGetWindowFromPointSub( const wxPoint
&point
, wxWindow
** outWin
)
1164 if ((point
.x
< m_x
) || (point
.y
< m_y
) ||
1165 (point
.x
> (m_x
+ m_width
)) || (point
.y
> (m_y
+ m_height
)))
1168 WindowRef window
= GetMacRootWindow() ;
1170 wxPoint
newPoint( point
) ;
1175 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
1177 wxWindow
*child
= (wxWindow
*)node
->Data();
1178 if ( child
->GetMacRootWindow() == window
)
1180 if (child
->MacGetWindowFromPointSub(newPoint
, outWin
))
1189 bool wxWindow::MacGetWindowFromPoint( const wxPoint
&screenpoint
, wxWindow
** outWin
)
1192 Point pt
= { screenpoint
.y
, screenpoint
.x
} ;
1193 if ( ::FindWindow( pt
, &window
) == 3 )
1195 wxPoint
point( screenpoint
) ;
1196 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1197 win
->ScreenToClient( point
) ;
1198 return win
->MacGetWindowFromPointSub( point
, outWin
) ;
1203 extern int wxBusyCursorCount
;
1205 bool wxWindow::MacDispatchMouseEvent(wxMouseEvent
& event
)
1207 if ((event
.m_x
< m_x
) || (event
.m_y
< m_y
) ||
1208 (event
.m_x
> (m_x
+ m_width
)) || (event
.m_y
> (m_y
+ m_height
)))
1211 if ( IsKindOf( CLASSINFO ( wxStaticBox
) ) )
1214 WindowRef window
= GetMacRootWindow() ;
1222 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
1224 wxWindow
*child
= (wxWindow
*)node
->Data();
1225 if ( child
->GetMacRootWindow() == window
&& child
->IsShown() && child
->IsEnabled() )
1227 if (child
->MacDispatchMouseEvent(event
))
1235 if ( wxBusyCursorCount
== 0 )
1237 m_cursor
.MacInstall() ;
1239 GetEventHandler()->ProcessEvent( event
) ;
1243 void wxWindow::MacFireMouseEvent( EventRecord
*ev
)
1245 wxMouseEvent
event(wxEVT_LEFT_DOWN
);
1246 bool isDown
= !(ev
->modifiers
& btnState
) ; // 1 is for up
1247 bool controlDown
= ev
->modifiers
& controlKey
; // for simulating right mouse
1249 event
.m_leftDown
= isDown
&& !controlDown
;
1250 event
.m_middleDown
= FALSE
;
1251 event
.m_rightDown
= isDown
&& controlDown
;
1253 if ( ev
->what
== mouseDown
)
1256 event
.SetEventType(wxEVT_RIGHT_DOWN
) ;
1258 event
.SetEventType(wxEVT_LEFT_DOWN
) ;
1260 else if ( ev
->what
== mouseUp
)
1263 event
.SetEventType(wxEVT_RIGHT_UP
) ;
1265 event
.SetEventType(wxEVT_LEFT_UP
) ;
1269 event
.SetEventType(wxEVT_MOTION
) ;
1272 event
.m_shiftDown
= ev
->modifiers
& shiftKey
;
1273 event
.m_controlDown
= ev
->modifiers
& controlKey
;
1274 event
.m_altDown
= ev
->modifiers
& optionKey
;
1275 event
.m_metaDown
= ev
->modifiers
& cmdKey
;
1277 Point localwhere
= ev
->where
;
1280 ::GetPort( &port
) ;
1281 ::SetPort( UMAGetWindowPort( m_macWindowData
->m_macWindow
) ) ;
1282 ::GlobalToLocal( &localwhere
) ;
1285 event
.m_x
= localwhere
.h
;
1286 event
.m_y
= localwhere
.v
;
1291 wxPoint origin = GetClientAreaOrigin() ;
1293 event.m_x += origin.x ;
1294 event.m_y += origin.y ;
1297 event
.m_timeStamp
= ev
->when
;
1298 event
.SetEventObject(this);
1299 if ( wxTheApp
->s_captureWindow
)
1303 wxTheApp
->s_captureWindow
->ScreenToClient( &x
, &y
) ;
1306 wxTheApp
->s_captureWindow
->GetEventHandler()->ProcessEvent( event
) ;
1307 if ( ev
->what
== mouseUp
)
1309 wxTheApp
->s_captureWindow
= NULL
;
1310 if ( wxBusyCursorCount
== 0 )
1312 m_cursor
.MacInstall() ;
1318 MacDispatchMouseEvent( event
) ;
1322 void wxWindow::MacMouseDown( EventRecord
*ev
, short part
)
1324 MacFireMouseEvent( ev
) ;
1327 void wxWindow::MacMouseUp( EventRecord
*ev
, short part
)
1329 WindowPtr frontWindow
;
1334 MacFireMouseEvent( ev
) ;
1340 void wxWindow::MacMouseMoved( EventRecord
*ev
, short part
)
1342 WindowPtr frontWindow
;
1347 MacFireMouseEvent( ev
) ;
1352 void wxWindow::MacActivate( EventRecord
*ev
, bool inIsActivating
)
1354 wxActivateEvent
event(wxEVT_ACTIVATE
, inIsActivating
);
1355 event
.m_timeStamp
= ev
->when
;
1356 event
.SetEventObject(this);
1358 GetEventHandler()->ProcessEvent(event
);
1360 UMAHighlightAndActivateWindow( m_macWindowData
->m_macWindow
, inIsActivating
) ;
1363 void wxWindow::MacRedraw( RgnHandle updatergn
, long time
)
1365 // updatergn is always already clipped to our boundaries
1366 WindowRef window
= GetMacRootWindow() ;
1367 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1369 wxMacDrawingClientHelper
focus( this ) ;
1372 WindowRef window
= GetMacRootWindow() ;
1373 bool eraseBackground
= false ;
1374 if ( m_macWindowData
)
1375 eraseBackground
= true ;
1376 if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
) )
1378 UMASetThemeWindowBackground( window
, kThemeBrushDocumentWindowBackground
, false ) ;
1380 else if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
1382 // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
1383 // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
1384 // either a non gray background color or a non control window
1387 wxWindow
* parent
= GetParent() ;
1390 if ( parent
->GetMacRootWindow() != window
)
1392 // we are in a different window on the mac system
1397 if( parent
->IsKindOf( CLASSINFO( wxControl
) ) && ((wxControl
*)parent
)->GetMacControl() )
1399 if ( parent
->m_backgroundColour
!= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
1401 // if we have any other colours in the hierarchy
1402 RGBBackColor( &parent
->m_backgroundColour
.GetPixel()) ;
1405 // if we have the normal colours in the hierarchy but another control etc. -> use it's background
1406 if ( parent
->IsKindOf( CLASSINFO( wxNotebook
) ) || parent
->IsKindOf( CLASSINFO( wxTabCtrl
) ))
1408 ApplyThemeBackground(kThemeBackgroundTabPane
, &(**updatergn
).rgnBBox
, kThemeStateActive
,8,true);
1417 parent
= parent
->GetParent() ;
1421 // if there is nothing special -> use default
1422 UMASetThemeWindowBackground( window
, kThemeBrushDialogBackgroundActive
, false ) ;
1427 RGBBackColor( &m_backgroundColour
.GetPixel()) ;
1429 if ( GetParent() && m_backgroundColour
!= GetParent()->GetBackgroundColour() )
1430 eraseBackground
= true ;
1431 SetClip( updatergn
) ;
1432 if ( eraseBackground
)
1434 EraseRgn( updatergn
) ;
1440 m_updateRegion
= updatergn
;
1442 event
.m_timeStamp
= time
;
1443 event
.SetEventObject(this);
1445 GetEventHandler()->ProcessEvent(event
);
1447 RgnHandle childupdate
= NewRgn() ;
1449 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
1451 wxWindow
*child
= (wxWindow
*)node
->Data();
1455 child
->GetClientSize( &width
, &height
) ;
1457 SetRectRgn( childupdate
, child
->m_x
, child
->m_y
, child
->m_x
+width
, child
->m_y
+ height
) ;
1458 SectRgn( childupdate
, m_updateRegion
.GetWXHRGN() , childupdate
) ;
1459 OffsetRgn( childupdate
, -child
->m_x
, -child
->m_y
) ;
1460 if ( child
->GetMacRootWindow() == window
&& child
->IsShown() )
1462 // because dialogs may also be children
1463 child
->MacRedraw( childupdate
, time
) ;
1466 DisposeRgn( childupdate
) ;
1467 // eventually a draw grow box here
1470 void wxWindow::MacUpdateImmediately()
1472 WindowRef window
= GetMacRootWindow() ;
1475 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1476 BeginUpdate( window
) ;
1480 if ( !EmptyRgn( window
->visRgn
) )
1483 win
->MacRedraw( window
->visRgn
, wxTheApp
->sm_lastMessageTime
) ;
1486 wxMacDrawingHelper help( win ) ;
1487 SetOrigin( 0 , 0 ) ;
1488 UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
1489 UMAUpdateControls( window , window->visRgn ) ;
1490 UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ;
1495 EndUpdate( window
) ;
1499 void wxWindow::MacUpdate( EventRecord
*ev
)
1501 WindowRef window
= (WindowRef
) ev
->message
;
1502 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1504 BeginUpdate( window
) ;
1507 // if windowshade gives incompatibility , take the follwing out
1509 if ( !EmptyRgn( window
->visRgn
) )
1512 MacRedraw( window
->visRgn
, ev
->when
) ;
1515 wxMacDrawingHelper help( this ) ;
1516 SetOrigin( 0 , 0 ) ;
1517 UMASetThemeWindowBackground( m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
1518 UMAUpdateControls( window , window->visRgn ) ;
1519 UMASetThemeWindowBackground( m_macWindowData->m_macWindow , m_macWindowData->m_macWindowBackgroundTheme , false ) ;
1524 EndUpdate( window
) ;
1527 WindowRef
wxWindow::GetMacRootWindow() const
1529 WindowRef window
= NULL
;
1530 wxWindow
*iter
= (wxWindow
*)this ;
1534 if ( iter
->m_macWindowData
)
1535 return iter
->m_macWindowData
->m_macWindow
;
1537 iter
= iter
->GetParent() ;
1539 wxASSERT_MSG( 1 , "No valid mac root window" ) ;
1543 void wxWindow::MacCreateScrollBars( long style
)
1545 wxASSERT_MSG( m_vScrollBar
== NULL
&& m_hScrollBar
== NULL
, "attempt to create window twice" ) ;
1546 bool hasBoth
= ( style
& wxVSCROLL
) && ( style
& wxHSCROLL
) ;
1547 int adjust
= hasBoth
? MAC_SCROLLBAR_SIZE
- 1: 0 ;
1549 if ( style
& wxVSCROLL
)
1551 m_vScrollBar
= new wxScrollBar(this, wxWINDOW_VSCROLL
, wxPoint(m_width
-MAC_SCROLLBAR_SIZE
, 0),
1552 wxSize(MAC_SCROLLBAR_SIZE
, m_height
- adjust
), wxVERTICAL
);
1553 // m_vScrollBar->PushEventHandler( this ) ;
1555 if ( style
& wxHSCROLL
)
1557 m_hScrollBar
= new wxScrollBar(this, wxWINDOW_HSCROLL
, wxPoint(0 , m_height
-MAC_SCROLLBAR_SIZE
),
1558 wxSize( m_width
- adjust
, MAC_SCROLLBAR_SIZE
), wxHORIZONTAL
);
1559 // m_hScrollBar->PushEventHandler( this ) ;
1562 // because the create does not take into account the client area origin
1563 MacRepositionScrollBars() ; // we might have a real position shift
1566 void wxWindow::MacRepositionScrollBars()
1568 bool hasBoth
= ( m_hScrollBar
&& m_hScrollBar
->IsShown()) && ( m_vScrollBar
&& m_vScrollBar
->IsShown()) ;
1569 int adjust
= hasBoth
? MAC_SCROLLBAR_SIZE
- 1 : 0 ;
1573 m_vScrollBar
->SetSize( m_width
-MAC_SCROLLBAR_SIZE
, 0, MAC_SCROLLBAR_SIZE
, m_height
- adjust
, wxSIZE_USE_EXISTING
);
1577 m_hScrollBar
->SetSize( 0 , m_height
-MAC_SCROLLBAR_SIZE
,m_width
- adjust
, MAC_SCROLLBAR_SIZE
, wxSIZE_USE_EXISTING
);
1581 void wxWindow::MacKeyDown( EventRecord
*ev
)
1586 bool wxWindow::AcceptsFocus() const
1588 return MacCanFocus() && wxWindowBase::AcceptsFocus();
1591 ControlHandle
wxWindow::MacGetContainerForEmbedding()
1593 if ( m_macWindowData
)
1594 return m_macWindowData
->m_macRootControl
;
1596 return GetParent()->MacGetContainerForEmbedding() ;
1599 void wxWindow::MacSuperChangedPosition()
1601 // only window-absolute structures have to be moved i.e. controls
1603 wxNode
*node
= GetChildren().First();
1606 wxWindow
*child
= (wxWindow
*)node
->Data();
1607 child
->MacSuperChangedPosition() ;
1608 node
= node
->Next();
1612 bool wxWindow::MacSetupFocusPort( )
1620 MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1621 return MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1624 bool wxWindow::MacSetupFocusClientPort( )
1632 MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1633 return MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1636 bool wxWindow::MacSetupDrawingPort( )
1644 MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1645 return MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1648 bool wxWindow::MacSetupDrawingClientPort( )
1656 MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1657 return MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1661 bool wxWindow::MacSetPortFocusParams( const Point
& localOrigin
, const Rect
& clipRect
, WindowRef window
, wxWindow
* win
)
1663 if ( window
== NULL
)
1669 ::GetPort(&currPort
);
1670 port
= UMAGetWindowPort( window
) ;
1671 if (currPort
!= port
)
1674 ::SetOrigin(-localOrigin
.h
, -localOrigin
.v
);
1678 bool wxWindow::MacSetPortDrawingParams( const Point
& localOrigin
, const Rect
& clipRect
, WindowRef window
, wxWindow
* win
)
1680 if ( window
== NULL
)
1685 ::GetPort(&currPort
);
1686 port
= UMAGetWindowPort( window
) ;
1687 if (currPort
!= port
)
1690 ::SetOrigin(-localOrigin
.h
, -localOrigin
.v
);
1691 ::ClipRect(&clipRect
);
1694 ::RGBBackColor(& win
->GetBackgroundColour().GetPixel() ) ;
1695 ::RGBForeColor(& win
->GetForegroundColour().GetPixel() ) ;
1696 ::BackPat( &qd
.white
) ;
1697 ::UMASetThemeWindowBackground( win
->m_macWindowData
->m_macWindow
, win
->m_macWindowData
->m_macWindowBackgroundTheme
, false ) ;
1701 void wxWindow::MacGetPortParams(Point
* localOrigin
, Rect
* clipRect
, WindowRef
*window
, wxWindow
** rootwin
)
1703 if ( m_macWindowData
)
1709 clipRect
->right
= m_width
;
1710 clipRect
->bottom
= m_height
;
1711 *window
= m_macWindowData
->m_macWindow
;
1716 wxASSERT( GetParent() != NULL
) ;
1717 GetParent()->MacGetPortParams( localOrigin
, clipRect
, window
, rootwin
) ;
1718 localOrigin
->h
+= m_x
;
1719 localOrigin
->v
+= m_y
;
1720 OffsetRect(clipRect
, -m_x
, -m_y
);
1725 myClip
.right
= m_width
;
1726 myClip
.bottom
= m_height
;
1727 SectRect(clipRect
, &myClip
, clipRect
);
1731 void wxWindow::MacGetPortClientParams(Point
* localOrigin
, Rect
* clipRect
, WindowRef
*window
, wxWindow
** rootwin
)
1733 int width
, height
;
1734 GetClientSize( &width
, &height
) ;
1736 if ( m_macWindowData
)
1742 clipRect
->right
= m_width
;//width;
1743 clipRect
->bottom
= m_height
;// height;
1744 *window
= m_macWindowData
->m_macWindow
;
1749 wxASSERT( GetParent() != NULL
) ;
1751 GetParent()->MacGetPortClientParams( localOrigin
, clipRect
, window
, rootwin
) ;
1753 localOrigin
->h
+= m_x
;
1754 localOrigin
->v
+= m_y
;
1755 OffsetRect(clipRect
, -m_x
, -m_y
);
1760 myClip
.right
= width
;
1761 myClip
.bottom
= height
;
1762 SectRect(clipRect
, &myClip
, clipRect
);
1766 wxMacFocusHelper::wxMacFocusHelper( wxWindow
* theWindow
)
1773 m_currentPort
= NULL
;
1774 GetPort( &m_formerPort
) ;
1778 theWindow
->MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1779 m_currentPort
= UMAGetWindowPort( window
) ;
1780 theWindow
->MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1785 wxMacFocusHelper::~wxMacFocusHelper()
1789 SetOrigin( 0 , 0 ) ;
1791 if ( m_formerPort
!= m_currentPort
)
1792 SetPort( m_formerPort
) ;
1795 wxMacDrawingHelper::wxMacDrawingHelper( wxWindow
* theWindow
)
1802 m_currentPort
= NULL
;
1804 GetPort( &m_formerPort
) ;
1807 theWindow
->MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1808 m_currentPort
= UMAGetWindowPort( window
) ;
1809 if ( m_formerPort
!= m_currentPort
)
1810 SetPort( m_currentPort
) ;
1811 GetPenState( &m_savedPenState
) ;
1812 theWindow
->MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1817 wxMacDrawingHelper::~wxMacDrawingHelper()
1821 SetPenState( &m_savedPenState
) ;
1822 SetOrigin( 0 , 0 ) ;
1823 ClipRect( &m_currentPort
->portRect
) ;
1826 if ( m_formerPort
!= m_currentPort
)
1827 SetPort( m_formerPort
) ;
1830 wxMacFocusClientHelper::wxMacFocusClientHelper( wxWindow
* theWindow
)
1837 m_currentPort
= NULL
;
1839 GetPort( &m_formerPort
) ;
1843 theWindow
->MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1844 m_currentPort
= UMAGetWindowPort( window
) ;
1845 theWindow
->MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1850 wxMacFocusClientHelper::~wxMacFocusClientHelper()
1854 SetOrigin( 0 , 0 ) ;
1856 if ( m_formerPort
!= m_currentPort
)
1857 SetPort( m_formerPort
) ;
1860 wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindow
* theWindow
)
1867 m_currentPort
= NULL
;
1869 GetPort( &m_formerPort
) ;
1873 theWindow
->MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1874 m_currentPort
= UMAGetWindowPort( window
) ;
1875 if ( m_formerPort
!= m_currentPort
)
1876 SetPort( m_currentPort
) ;
1877 GetPenState( &m_savedPenState
) ;
1878 theWindow
->MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1883 wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
1887 SetPenState( &m_savedPenState
) ;
1888 SetOrigin( 0 , 0 ) ;
1889 ClipRect( &m_currentPort
->portRect
) ;
1892 if ( m_formerPort
!= m_currentPort
)
1893 SetPort( m_formerPort
) ;