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 #if !USE_SHARED_LIBRARY
58 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxEvtHandler
)
60 BEGIN_EVENT_TABLE(wxWindow
, wxEvtHandler
)
61 EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground
)
62 EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged
)
63 EVT_INIT_DIALOG(wxWindow::OnInitDialog
)
64 EVT_IDLE(wxWindow::OnIdle
)
65 // EVT_SCROLL(wxWindow::OnScroll)
72 // ===========================================================================
74 // ===========================================================================
76 // ---------------------------------------------------------------------------
77 // wxWindow utility functions
78 // ---------------------------------------------------------------------------
80 // Find an item given the Macintosh Window Reference
82 wxList
*wxWinMacWindowList
= NULL
;
83 wxWindow
*wxFindWinFromMacWindow(WindowRef inWindowRef
)
85 wxNode
*node
= wxWinMacWindowList
->Find((long)inWindowRef
);
88 return (wxWindow
*)node
->Data();
91 void wxAssociateWinWithMacWindow(WindowRef inWindowRef
, wxWindow
*win
)
93 // adding NULL WindowRef is (first) surely a result of an error and
94 // (secondly) breaks menu command processing
95 wxCHECK_RET( inWindowRef
!= (WindowRef
) NULL
, "attempt to add a NULL WindowRef to window list" );
97 if ( !wxWinMacWindowList
->Find((long)inWindowRef
) )
98 wxWinMacWindowList
->Append((long)inWindowRef
, win
);
101 void wxRemoveMacWindowAssociation(wxWindow
*win
)
103 wxWinMacWindowList
->DeleteObject(win
);
106 // ----------------------------------------------------------------------------
107 // constructors and such
108 // ----------------------------------------------------------------------------
110 void wxWindow::Init()
116 m_doubleClickAllowed
= 0;
117 m_winCaptured
= FALSE
;
119 m_isBeingDeleted
= FALSE
;
122 m_mouseInWindow
= FALSE
;
126 m_backgroundTransparent
= FALSE
;
128 // as all windows are created with WS_VISIBLE style...
131 m_macWindowData
= NULL
;
138 m_hScrollBar
= NULL
;
139 m_vScrollBar
= NULL
;
141 #if wxUSE_DRAG_AND_DROP
142 m_pDropTarget
= NULL
;
147 wxWindow::~wxWindow()
149 m_isBeingDeleted
= TRUE
;
151 if ( s_lastMouseWindow
== this )
153 s_lastMouseWindow
= NULL
;
156 if ( gFocusWindow
== this )
158 gFocusWindow
= NULL
;
162 m_parent
->RemoveChild(this);
166 if ( m_macWindowData
)
168 UMADisposeWindow( m_macWindowData
->m_macWindow
) ;
169 delete m_macWindowData
;
170 wxRemoveMacWindowAssociation( this ) ;
175 bool wxWindow::Create(wxWindow
*parent
, wxWindowID id
,
179 const wxString
& name
)
181 wxCHECK_MSG( parent
, FALSE
, wxT("can't create wxWindow without parent") );
183 if ( !CreateBase(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
186 parent
->AddChild(this);
190 AdjustForParentClientOrigin(m_x
, m_y
, wxSIZE_USE_EXISTING
);
191 m_width
= WidthDefault( size
.x
);
192 m_height
= HeightDefault( size
.y
) ;
194 MacCreateScrollBars( style
) ;
199 void wxWindow::SetFocus()
201 if ( AcceptsFocus() )
207 if ( gFocusWindow
->m_caret
)
209 gFocusWindow
->m_caret
->OnKillFocus();
211 #endif // wxUSE_CARET
212 wxControl
* control
= wxDynamicCast( gFocusWindow
, wxControl
) ;
213 if ( control
&& control
->GetMacControl() )
215 UMASetKeyboardFocus( gFocusWindow
->GetMacRootWindow() , control
->GetMacControl() , kControlFocusNoPart
) ;
217 wxFocusEvent
event(wxEVT_KILL_FOCUS
, gFocusWindow
->m_windowId
);
218 event
.SetEventObject(gFocusWindow
);
219 gFocusWindow
->GetEventHandler()->ProcessEvent(event
) ;
221 gFocusWindow
= this ;
227 m_caret
->OnSetFocus();
229 #endif // wxUSE_CARET
230 // panel wants to track the window which was the last to have focus in it
231 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
234 panel
->SetLastFocus(this);
236 wxControl
* control
= wxDynamicCast( gFocusWindow
, wxControl
) ;
237 if ( control
&& control
->GetMacControl() )
239 UMASetKeyboardFocus( gFocusWindow
->GetMacRootWindow() , control
->GetMacControl() , kControlEditTextPart
) ;
242 wxFocusEvent
event(wxEVT_SET_FOCUS
, m_windowId
);
243 event
.SetEventObject(this);
244 GetEventHandler()->ProcessEvent(event
) ;
249 bool wxWindow::Enable(bool enable
)
251 if ( !wxWindowBase::Enable(enable
) )
254 HWND hWnd = GetHwnd();
256 ::EnableWindow(hWnd, (BOOL)enable);
259 wxWindowList::Node
*node
= GetChildren().GetFirst();
262 wxWindow
*child
= node
->GetData();
263 child
->Enable(enable
);
265 node
= node
->GetNext();
271 void wxWindow::CaptureMouse()
273 wxTheApp
->s_captureWindow
= this ;
276 void wxWindow::ReleaseMouse()
278 wxTheApp
->s_captureWindow
= NULL
;
281 #if wxUSE_DRAG_AND_DROP
283 void wxWindow::SetDropTarget(wxDropTarget
*pDropTarget
)
285 if ( m_pDropTarget
!= 0 ) {
286 delete m_pDropTarget
;
289 m_pDropTarget
= pDropTarget
;
290 if ( m_pDropTarget
!= 0 )
298 // Old style file-manager drag&drop
299 void wxWindow::DragAcceptFiles(bool accept
)
305 void wxWindow::DoGetSize(int *x
, int *y
) const
311 void wxWindow::DoGetPosition(int *x
, int *y
) const
317 wxPoint
pt(GetParent()->GetClientAreaOrigin());
323 wxSize
wxWindow::DoGetBestSize()
325 return wxSize( 0 , 0 ) ;
328 bool wxWindow::Reparent(wxWindow
*parent
)
330 if ( !wxWindowBase::Reparent(parent
) )
336 bool wxWindow::DoPopupMenu(wxMenu
*menu
, int x
, int y
)
338 menu
->SetInvokingWindow(this);
340 ClientToScreen( &x
, &y
) ;
342 ::InsertMenu( menu
->GetHMenu() , -1 ) ;
343 long menuResult
= ::PopUpMenuSelect(menu
->GetHMenu() ,y
,x
, 0) ;
344 menu
->MacMenuSelect( this , TickCount() , HiWord(menuResult
) , LoWord(menuResult
) ) ;
345 ::DeleteMenu( menu
->MacGetMenuId() ) ;
346 menu
->SetInvokingWindow(NULL
);
351 void wxWindow::DoScreenToClient(int *x
, int *y
) const
353 WindowRef window
= GetMacRootWindow() ;
361 ::SetPort( UMAGetWindowPort( window
) ) ;
362 ::GlobalToLocal( &localwhere
) ;
368 MacRootWindowToClient( x
, y
) ;
371 void wxWindow::DoClientToScreen(int *x
, int *y
) const
373 WindowRef window
= GetMacRootWindow() ;
375 MacClientToRootWindow( x
, y
) ;
383 ::SetPort( UMAGetWindowPort( window
) ) ;
384 ::LocalToGlobal( &localwhere
) ;
390 void wxWindow::MacClientToRootWindow( int *x
, int *y
) const
392 if ( m_macWindowData
)
399 GetParent()->MacClientToRootWindow( x
, y
) ;
403 void wxWindow::MacRootWindowToClient( int *x
, int *y
) const
405 if ( m_macWindowData
)
412 GetParent()->MacRootWindowToClient( x
, y
) ;
416 bool wxWindow::SetCursor(const wxCursor
& cursor
)
418 if ( !wxWindowBase::SetCursor(cursor
) )
424 wxASSERT_MSG( m_cursor
.Ok(),
425 wxT("cursor must be valid after call to the base version"));
431 // Change the cursor NOW if we're within the correct window
433 if ( MacGetWindowFromPoint( wxPoint( pt
.h
, pt
.v
) , &mouseWin
) )
435 if ( mouseWin
== this && !wxIsBusy() )
437 cursor
.MacInstall() ;
445 // Get size *available for subwindows* i.e. excluding menu bar etc.
446 void wxWindow::DoGetClientSize(int *x
, int *y
) const
451 if (m_vScrollBar
&& m_vScrollBar
->IsShown() )
452 (*x
) -= MAC_SCROLLBAR_SIZE
;
453 if (m_hScrollBar
&& m_hScrollBar
->IsShown() )
454 (*y
) -= MAC_SCROLLBAR_SIZE
;
458 // ----------------------------------------------------------------------------
460 // ----------------------------------------------------------------------------
464 void wxWindow::DoSetToolTip(wxToolTip
*tooltip
)
466 wxWindowBase::DoSetToolTip(tooltip
);
469 // m_tooltip->SetWindow(this);
472 #endif // wxUSE_TOOLTIPS
474 void wxWindow::DoMoveWindow(int x
, int y
, int width
, int height
)
476 DoSetSize( x
,y
, width
, height
) ;
479 void wxWindow::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
483 int former_w
= m_width
;
484 int former_h
= m_height
;
486 int currentX
, currentY
;
487 GetPosition(¤tX
, ¤tY
);
488 int currentW
,currentH
;
489 GetSize(¤tW
, ¤tH
);
491 int actualWidth
= width
;
492 int actualHeight
= height
;
495 if (x
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
497 if (y
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
500 actualWidth
= currentW
;
502 actualHeight
= currentH
;
504 if ( actualX
== currentX
&& actualY
== currentY
&& actualWidth
== currentW
&& actualHeight
== currentH
)
506 MacRepositionScrollBars() ; // we might have a real position shift
510 AdjustForParentClientOrigin(actualX
, actualY
, sizeFlags
);
513 bool doMove
= false ;
514 bool doResize
= false ;
516 if ( actualX
!= former_x
|| actualY
!= former_y
)
520 if ( actualWidth
!= former_w
|| actualHeight
!= former_h
)
525 if ( doMove
|| doResize
)
527 if ( m_macWindowData
)
532 // erase former position
534 wxMacDrawingClientHelper
focus( this ) ;
537 Rect clientrect
= { 0 , 0 , m_height
, m_width
} ;
538 InvalRect( &clientrect
) ;
544 m_width
= actualWidth
;
545 m_height
= actualHeight
;
546 if ( m_macWindowData
)
549 ::MoveWindow(m_macWindowData
->m_macWindow
, m_x
, m_y
, false); // don't make frontmost
552 ::SizeWindow(m_macWindowData
->m_macWindow
, m_width
, m_height
, true);
554 // the OS takes care of invalidating and erasing
556 if ( IsKindOf( CLASSINFO( wxFrame
) ) )
558 wxFrame
* frame
= (wxFrame
*) this ;
559 frame
->PositionStatusBar();
560 frame
->PositionToolBar();
565 // erase new position
567 wxMacDrawingClientHelper
focus( this ) ;
570 Rect clientrect
= { 0 , 0 , m_height
, m_width
} ;
571 InvalRect( &clientrect
) ;
575 wxWindow::MacSuperChangedPosition() ; // like this only children will be notified
577 MacRepositionScrollBars() ;
580 wxMoveEvent
event(wxPoint(m_x
, m_y
), m_windowId
);
581 event
.SetEventObject(this);
582 GetEventHandler()->ProcessEvent(event
) ;
586 MacRepositionScrollBars() ;
587 wxSizeEvent
event(wxSize(m_width
, m_height
), m_windowId
);
588 event
.SetEventObject(this);
589 GetEventHandler()->ProcessEvent(event
);
593 // For implementation purposes - sometimes decorations make the client area
596 wxPoint
wxWindow::GetClientAreaOrigin() const
598 return wxPoint(0, 0);
601 // Makes an adjustment to the window position (for example, a frame that has
602 // a toolbar that it manages itself).
603 void wxWindow::AdjustForParentClientOrigin(int& x
, int& y
, int sizeFlags
)
605 if( !m_macWindowData
)
607 if (((sizeFlags
& wxSIZE_NO_ADJUSTMENTS
) == 0) && GetParent())
609 wxPoint
pt(GetParent()->GetClientAreaOrigin());
610 x
+= pt
.x
; y
+= pt
.y
;
615 void wxWindow::SetTitle(const wxString
& title
)
621 if( wxApp::s_macDefaultEncodingIsPC
)
622 label
= wxMacMakeMacStringFromPC( title
) ;
626 if ( m_macWindowData
)
627 UMASetWTitleC( m_macWindowData
->m_macWindow
, label
) ;
630 wxString
wxWindow::GetTitle() const
635 bool wxWindow::Show(bool show
)
637 if ( !wxWindowBase::Show(show
) )
640 if ( m_macWindowData
)
644 UMAShowWindow( m_macWindowData
->m_macWindow
) ;
645 UMASelectWindow( m_macWindowData
->m_macWindow
) ;
646 // no need to generate events here, they will get them triggered by macos
647 wxSizeEvent
event(wxSize(m_width
, m_height
), m_windowId
);
648 event
.SetEventObject(this);
649 GetEventHandler()->ProcessEvent(event
);
653 UMAHideWindow( m_macWindowData
->m_macWindow
) ;
661 int wxWindow::GetCharHeight() const
663 wxClientDC
dc ( (wxWindow
*)this ) ;
664 return dc
.GetCharHeight() ;
667 int wxWindow::GetCharWidth() const
669 wxClientDC
dc ( (wxWindow
*)this ) ;
670 return dc
.GetCharWidth() ;
673 void wxWindow::GetTextExtent(const wxString
& string
, int *x
, int *y
,
674 int *descent
, int *externalLeading
, const wxFont
*theFont
) const
676 const wxFont
*fontToUse
= theFont
;
680 wxClientDC
dc( this ) ;
682 dc
.GetTextExtent( string
, &lx
, &ly
, &ld
, &le
, fontToUse
) ;
683 *externalLeading
= le
;
689 void wxWindow::MacEraseBackground( Rect
*rect
)
691 WindowRef window
= GetMacRootWindow() ;
692 if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
) )
694 UMASetThemeWindowBackground( window
, kThemeBrushDocumentWindowBackground
, false ) ;
696 else if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
698 // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
699 // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
700 // either a non gray background color or a non control window
702 wxWindow
* parent
= GetParent() ;
705 if ( parent
->m_backgroundColour
!= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
707 // if we have any other colours in the hierarchy
708 RGBBackColor( &parent
->m_backgroundColour
.GetPixel()) ;
711 if( parent
->IsKindOf( CLASSINFO( wxControl
) ) && ((wxControl
*)parent
)->GetMacControl() )
713 // if we have the normal colours in the hierarchy but another control etc. -> use it's background
714 if ( parent
->IsKindOf( CLASSINFO( wxNotebook
) ) || parent
->IsKindOf( CLASSINFO( wxTabCtrl
) ))
716 ApplyThemeBackground (kThemeBackgroundTabPane
, rect
, kThemeStateActive
,8,true);
722 // we have arrived at a non control item
726 parent
= parent
->GetParent() ;
730 // if there is nothing special -> use default
731 UMASetThemeWindowBackground( window
, kThemeBrushDialogBackgroundActive
, false ) ;
736 RGBBackColor( &m_backgroundColour
.GetPixel()) ;
741 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
743 wxWindow
*child
= (wxWindow
*)node
->Data();
747 // child->GetClientSize( &width , &height ) ;
749 Rect clientrect
= { child
->m_x
, child
->m_y
, child
->m_x
+child
->m_width
, child
->m_y
+ child
->m_height
} ;
750 SectRect( &clientrect
, rect
, &clientrect
) ;
752 OffsetRect( &clientrect
, -child
->m_x
, -child
->m_y
) ;
753 if ( child
->GetMacRootWindow() == window
&& child
->IsShown() )
755 wxMacDrawingClientHelper
focus( this ) ;
758 child
->MacEraseBackground( &clientrect
) ;
764 void wxWindow::Refresh(bool eraseBack
, const wxRect
*rect
)
766 wxMacDrawingClientHelper
focus( this ) ;
770 GetClientSize( &width
, &height
) ;
771 Rect clientrect
= { 0 , 0 , height
, width
} ;
772 ClipRect( &clientrect
) ;
776 Rect r
= { rect
->y
, rect
->x
, rect
->y
+ rect
->height
, rect
->x
+ rect
->width
} ;
777 SectRect( &clientrect
, &r
, &clientrect
) ;
779 InvalRect( &clientrect
) ;
783 MacEraseBackground( &clientrect ) ;
789 // Responds to colour changes: passes event on to children.
790 void wxWindow::OnSysColourChanged(wxSysColourChangedEvent
& event
)
792 wxNode
*node
= GetChildren().First();
795 // Only propagate to non-top-level windows
796 wxWindow
*win
= (wxWindow
*)node
->Data();
797 if ( win
->GetParent() )
799 wxSysColourChangedEvent event2
;
800 event
.m_eventObject
= win
;
801 win
->GetEventHandler()->ProcessEvent(event2
);
808 #if wxUSE_CARET && WXWIN_COMPATIBILITY
809 // ---------------------------------------------------------------------------
810 // Caret manipulation
811 // ---------------------------------------------------------------------------
813 void wxWindow::CreateCaret(int w
, int h
)
815 SetCaret(new wxCaret(this, w
, h
));
818 void wxWindow::CreateCaret(const wxBitmap
*WXUNUSED(bitmap
))
820 wxFAIL_MSG("not implemented");
823 void wxWindow::ShowCaret(bool show
)
825 wxCHECK_RET( m_caret
, "no caret to show" );
830 void wxWindow::DestroyCaret()
835 void wxWindow::SetCaretPos(int x
, int y
)
837 wxCHECK_RET( m_caret
, "no caret to move" );
842 void wxWindow::GetCaretPos(int *x
, int *y
) const
844 wxCHECK_RET( m_caret
, "no caret to get position of" );
846 m_caret
->GetPosition(x
, y
);
848 #endif // wxUSE_CARET
850 wxWindow
*wxGetActiveWindow()
852 // actually this is a windows-only concept
856 // Coordinates relative to the window
857 void wxWindow::WarpPointer (int x_pos
, int y_pos
)
859 // We really dont move the mouse programmatically under mac
862 void wxWindow::OnEraseBackground(wxEraseEvent
& event
)
864 // TODO : probably we would adopt the EraseEvent structure
867 int wxWindow::GetScrollPos(int orient
) const
869 if ( orient
== wxHORIZONTAL
)
872 return m_hScrollBar
->GetThumbPosition() ;
877 return m_vScrollBar
->GetThumbPosition() ;
882 // This now returns the whole range, not just the number
883 // of positions that we can scroll.
884 int wxWindow::GetScrollRange(int orient
) const
886 if ( orient
== wxHORIZONTAL
)
889 return m_hScrollBar
->GetRange() ;
894 return m_vScrollBar
->GetRange() ;
899 int wxWindow::GetScrollThumb(int orient
) const
901 if ( orient
== wxHORIZONTAL
)
904 return m_hScrollBar
->GetThumbSize() ;
909 return m_vScrollBar
->GetThumbSize() ;
914 void wxWindow::SetScrollPos(int orient
, int pos
, bool refresh
)
916 if ( orient
== wxHORIZONTAL
)
919 m_hScrollBar
->SetThumbPosition( pos
) ;
924 m_vScrollBar
->SetThumbPosition( pos
) ;
928 // New function that will replace some of the above.
929 void wxWindow::SetScrollbar(int orient
, int pos
, int thumbVisible
,
930 int range
, bool refresh
)
932 if ( orient
== wxHORIZONTAL
)
936 if ( range
== 0 || thumbVisible
>= range
)
938 if ( m_hScrollBar
->IsShown() )
939 m_hScrollBar
->Show(false) ;
943 if ( !m_hScrollBar
->IsShown() )
944 m_hScrollBar
->Show(true) ;
945 m_hScrollBar
->SetScrollbar( pos
, thumbVisible
, range
, refresh
) ;
953 if ( range
== 0 || thumbVisible
>= range
)
955 if ( m_vScrollBar
->IsShown() )
956 m_vScrollBar
->Show(false) ;
960 if ( !m_vScrollBar
->IsShown() )
961 m_vScrollBar
->Show(true) ;
962 m_vScrollBar
->SetScrollbar( pos
, thumbVisible
, range
, refresh
) ;
966 MacRepositionScrollBars() ;
969 // Does a physical scroll
970 void wxWindow::ScrollWindow(int dx
, int dy
, const wxRect
*rect
)
972 wxMacDrawingClientHelper
focus( this ) ;
976 GetClientSize( &width
, &height
) ;
977 Rect scrollrect
= { 0 , 0 , height
, width
} ;
979 RgnHandle updateRgn
= NewRgn() ;
980 ClipRect( &scrollrect
) ;
983 Rect r
= { rect
->y
, rect
->x
, rect
->y
+ rect
->height
, rect
->x
+ rect
->width
} ;
984 SectRect( &scrollrect
, &r
, &scrollrect
) ;
986 ScrollRect( &scrollrect
, dx
, dy
, updateRgn
) ;
987 InvalRgn( updateRgn
) ;
988 DisposeRgn( updateRgn
) ;
992 void wxWindow::MacOnScroll(wxScrollEvent
&event
)
994 if ( event
.m_eventObject
== m_vScrollBar
|| event
.m_eventObject
== m_hScrollBar
)
996 wxScrollWinEvent wevent
;
997 wevent
.SetPosition(event
.GetPosition());
998 wevent
.SetOrientation(event
.GetOrientation());
999 wevent
.m_eventObject
= this;
1001 switch ( event
.m_eventType
)
1003 case wxEVT_SCROLL_TOP
:
1004 wevent
.m_eventType
= wxEVT_SCROLLWIN_TOP
;
1007 case wxEVT_SCROLL_BOTTOM
:
1008 wevent
.m_eventType
= wxEVT_SCROLLWIN_BOTTOM
;
1011 case wxEVT_SCROLL_LINEUP
:
1012 wevent
.m_eventType
= wxEVT_SCROLLWIN_LINEUP
;
1015 case wxEVT_SCROLL_LINEDOWN
:
1016 wevent
.m_eventType
= wxEVT_SCROLLWIN_LINEDOWN
;
1019 case wxEVT_SCROLL_PAGEUP
:
1020 wevent
.m_eventType
= wxEVT_SCROLLWIN_PAGEUP
;
1023 case wxEVT_SCROLL_PAGEDOWN
:
1024 wevent
.m_eventType
= wxEVT_SCROLLWIN_PAGEDOWN
;
1027 case wxEVT_SCROLL_THUMBTRACK
:
1028 wevent
.m_eventType
= wxEVT_SCROLLWIN_THUMBTRACK
;
1033 GetEventHandler()->ProcessEvent(wevent
);
1037 bool wxWindow::SetFont(const wxFont
& font
)
1039 if ( !wxWindowBase::SetFont(font
) )
1048 // Get the window with the focus
1049 wxWindow
*wxWindowBase::FindFocus()
1051 return gFocusWindow
;
1054 #if WXWIN_COMPATIBILITY
1055 // If nothing defined for this, try the parent.
1056 // E.g. we may be a button loaded from a resource, with no callback function
1058 void wxWindow::OnCommand(wxWindow
& win
, wxCommandEvent
& event
)
1060 if ( GetEventHandler()->ProcessEvent(event
) )
1063 m_parent
->GetEventHandler()->OnCommand(win
, event
);
1065 #endif // WXWIN_COMPATIBILITY_2
1067 #if WXWIN_COMPATIBILITY
1068 wxObject
* wxWindow::GetChild(int number
) const
1070 // Return a pointer to the Nth object in the Panel
1071 wxNode
*node
= GetChildren().First();
1074 node
= node
->Next();
1077 wxObject
*obj
= (wxObject
*)node
->Data();
1083 #endif // WXWIN_COMPATIBILITY
1085 void wxWindow::Clear()
1087 if ( m_macWindowData
)
1089 wxMacDrawingClientHelper
helper ( this ) ;
1091 wxPoint origin
= GetClientAreaOrigin() ;
1092 GetClientSize( &w
, &h
) ;
1093 UMASetThemeWindowBackground( m_macWindowData
->m_macWindow
, m_macWindowData
->m_macWindowBackgroundTheme
, false ) ;
1094 Rect r
= { origin
.y
, origin
.x
, origin
.y
+h
, origin
.x
+w
} ;
1099 wxClientDC
dc(this);
1100 wxBrush
brush(GetBackgroundColour(), wxSOLID
);
1101 dc
.SetBackground(brush
);
1106 // Setup background and foreground colours correctly
1107 void wxWindow::SetupColours()
1110 SetBackgroundColour(GetParent()->GetBackgroundColour());
1113 void wxWindow::OnIdle(wxIdleEvent
& event
)
1116 // Check if we need to send a LEAVE event
1117 if (m_mouseInWindow)
1120 ::GetCursorPos(&pt);
1121 if (::WindowFromPoint(pt) != (HWND) GetHWND())
1123 // Generate a LEAVE event
1124 m_mouseInWindow = FALSE;
1125 MSWOnMouseLeave(pt.x, pt.y, 0);
1130 // This calls the UI-update mechanism (querying windows for
1131 // menu/toolbar/control state information)
1135 // Raise the window to the top of the Z order
1136 void wxWindow::Raise()
1141 // Lower the window to the bottom of the Z order
1142 void wxWindow::Lower()
1147 void wxWindow::DoSetClientSize(int width
, int height
)
1149 if ( width
!= -1 || height
!= -1 )
1152 if ( width
!= -1 && m_vScrollBar
)
1153 width
+= MAC_SCROLLBAR_SIZE
;
1154 if ( height
!= -1 && m_vScrollBar
)
1155 height
+= MAC_SCROLLBAR_SIZE
;
1157 DoSetSize( -1 , -1 , width
, height
) ;
1162 wxWindow
* wxWindow::s_lastMouseWindow
= NULL
;
1164 bool wxWindow::MacGetWindowFromPointSub( const wxPoint
&point
, wxWindow
** outWin
)
1166 if ((point
.x
< m_x
) || (point
.y
< m_y
) ||
1167 (point
.x
> (m_x
+ m_width
)) || (point
.y
> (m_y
+ m_height
)))
1170 WindowRef window
= GetMacRootWindow() ;
1172 wxPoint
newPoint( point
) ;
1177 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
1179 wxWindow
*child
= (wxWindow
*)node
->Data();
1180 if ( child
->GetMacRootWindow() == window
)
1182 if (child
->MacGetWindowFromPointSub(newPoint
, outWin
))
1191 bool wxWindow::MacGetWindowFromPoint( const wxPoint
&screenpoint
, wxWindow
** outWin
)
1194 Point pt
= { screenpoint
.y
, screenpoint
.x
} ;
1195 if ( ::FindWindow( pt
, &window
) == 3 )
1197 wxPoint
point( screenpoint
) ;
1198 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1199 win
->ScreenToClient( point
) ;
1200 return win
->MacGetWindowFromPointSub( point
, outWin
) ;
1205 extern int wxBusyCursorCount
;
1207 bool wxWindow::MacDispatchMouseEvent(wxMouseEvent
& event
)
1209 if ((event
.m_x
< m_x
) || (event
.m_y
< m_y
) ||
1210 (event
.m_x
> (m_x
+ m_width
)) || (event
.m_y
> (m_y
+ m_height
)))
1213 if ( IsKindOf( CLASSINFO ( wxStaticBox
) ) )
1216 WindowRef window
= GetMacRootWindow() ;
1224 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
1226 wxWindow
*child
= (wxWindow
*)node
->Data();
1227 if ( child
->GetMacRootWindow() == window
&& child
->IsShown() && child
->IsEnabled() )
1229 if (child
->MacDispatchMouseEvent(event
))
1237 if ( wxBusyCursorCount
== 0 )
1239 m_cursor
.MacInstall() ;
1241 GetEventHandler()->ProcessEvent( event
) ;
1245 void wxWindow::MacFireMouseEvent( EventRecord
*ev
)
1247 wxMouseEvent
event(wxEVT_LEFT_DOWN
);
1248 bool isDown
= !(ev
->modifiers
& btnState
) ; // 1 is for up
1249 bool controlDown
= ev
->modifiers
& controlKey
; // for simulating right mouse
1251 event
.m_leftDown
= isDown
&& !controlDown
;
1252 event
.m_middleDown
= FALSE
;
1253 event
.m_rightDown
= isDown
&& controlDown
;
1255 if ( ev
->what
== mouseDown
)
1258 event
.SetEventType(wxEVT_RIGHT_DOWN
) ;
1260 event
.SetEventType(wxEVT_LEFT_DOWN
) ;
1262 else if ( ev
->what
== mouseUp
)
1265 event
.SetEventType(wxEVT_RIGHT_UP
) ;
1267 event
.SetEventType(wxEVT_LEFT_UP
) ;
1271 event
.SetEventType(wxEVT_MOTION
) ;
1274 event
.m_shiftDown
= ev
->modifiers
& shiftKey
;
1275 event
.m_controlDown
= ev
->modifiers
& controlKey
;
1276 event
.m_altDown
= ev
->modifiers
& optionKey
;
1277 event
.m_metaDown
= ev
->modifiers
& cmdKey
;
1279 Point localwhere
= ev
->where
;
1282 ::GetPort( &port
) ;
1283 ::SetPort( UMAGetWindowPort( m_macWindowData
->m_macWindow
) ) ;
1284 ::GlobalToLocal( &localwhere
) ;
1287 event
.m_x
= localwhere
.h
;
1288 event
.m_y
= localwhere
.v
;
1293 wxPoint origin = GetClientAreaOrigin() ;
1295 event.m_x += origin.x ;
1296 event.m_y += origin.y ;
1299 event
.m_timeStamp
= ev
->when
;
1300 event
.SetEventObject(this);
1301 if ( wxTheApp
->s_captureWindow
)
1305 wxTheApp
->s_captureWindow
->ScreenToClient( &x
, &y
) ;
1308 wxTheApp
->s_captureWindow
->GetEventHandler()->ProcessEvent( event
) ;
1309 if ( ev
->what
== mouseUp
)
1311 wxTheApp
->s_captureWindow
= NULL
;
1312 if ( wxBusyCursorCount
== 0 )
1314 m_cursor
.MacInstall() ;
1320 MacDispatchMouseEvent( event
) ;
1324 void wxWindow::MacMouseDown( EventRecord
*ev
, short part
)
1326 MacFireMouseEvent( ev
) ;
1329 void wxWindow::MacMouseUp( EventRecord
*ev
, short part
)
1331 WindowPtr frontWindow
;
1336 MacFireMouseEvent( ev
) ;
1342 void wxWindow::MacMouseMoved( EventRecord
*ev
, short part
)
1344 WindowPtr frontWindow
;
1349 MacFireMouseEvent( ev
) ;
1354 void wxWindow::MacActivate( EventRecord
*ev
, bool inIsActivating
)
1356 wxActivateEvent
event(wxEVT_ACTIVATE
, inIsActivating
);
1357 event
.m_timeStamp
= ev
->when
;
1358 event
.SetEventObject(this);
1360 GetEventHandler()->ProcessEvent(event
);
1362 UMAHighlightAndActivateWindow( m_macWindowData
->m_macWindow
, inIsActivating
) ;
1365 void wxWindow::MacRedraw( RgnHandle updatergn
, long time
)
1367 // updatergn is always already clipped to our boundaries
1368 WindowRef window
= GetMacRootWindow() ;
1369 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1371 wxMacDrawingClientHelper
focus( this ) ;
1374 WindowRef window
= GetMacRootWindow() ;
1375 bool eraseBackground
= false ;
1376 if ( m_macWindowData
)
1377 eraseBackground
= true ;
1378 if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
) )
1380 UMASetThemeWindowBackground( window
, kThemeBrushDocumentWindowBackground
, false ) ;
1382 else if ( m_backgroundColour
== wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
1384 // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
1385 // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
1386 // either a non gray background color or a non control window
1389 wxWindow
* parent
= GetParent() ;
1392 if ( parent
->GetMacRootWindow() != window
)
1394 // we are in a different window on the mac system
1399 if( parent
->IsKindOf( CLASSINFO( wxControl
) ) && ((wxControl
*)parent
)->GetMacControl() )
1401 if ( parent
->m_backgroundColour
!= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
) )
1403 // if we have any other colours in the hierarchy
1404 RGBBackColor( &parent
->m_backgroundColour
.GetPixel()) ;
1407 // if we have the normal colours in the hierarchy but another control etc. -> use it's background
1408 if ( parent
->IsKindOf( CLASSINFO( wxNotebook
) ) || parent
->IsKindOf( CLASSINFO( wxTabCtrl
) ))
1410 ApplyThemeBackground(kThemeBackgroundTabPane
, &(**updatergn
).rgnBBox
, kThemeStateActive
,8,true);
1419 parent
= parent
->GetParent() ;
1423 // if there is nothing special -> use default
1424 UMASetThemeWindowBackground( window
, kThemeBrushDialogBackgroundActive
, false ) ;
1429 RGBBackColor( &m_backgroundColour
.GetPixel()) ;
1431 if ( GetParent() && m_backgroundColour
!= GetParent()->GetBackgroundColour() )
1432 eraseBackground
= true ;
1433 SetClip( updatergn
) ;
1434 if ( eraseBackground
)
1436 EraseRgn( updatergn
) ;
1442 m_updateRegion
= updatergn
;
1444 event
.m_timeStamp
= time
;
1445 event
.SetEventObject(this);
1447 GetEventHandler()->ProcessEvent(event
);
1449 RgnHandle childupdate
= NewRgn() ;
1451 for (wxNode
*node
= GetChildren().First(); node
; node
= node
->Next())
1453 wxWindow
*child
= (wxWindow
*)node
->Data();
1457 child
->GetClientSize( &width
, &height
) ;
1459 SetRectRgn( childupdate
, child
->m_x
, child
->m_y
, child
->m_x
+width
, child
->m_y
+ height
) ;
1460 SectRgn( childupdate
, m_updateRegion
.GetWXHRGN() , childupdate
) ;
1461 OffsetRgn( childupdate
, -child
->m_x
, -child
->m_y
) ;
1462 if ( child
->GetMacRootWindow() == window
&& child
->IsShown() )
1464 // because dialogs may also be children
1465 child
->MacRedraw( childupdate
, time
) ;
1468 DisposeRgn( childupdate
) ;
1469 // eventually a draw grow box here
1472 void wxWindow::MacUpdateImmediately()
1474 WindowRef window
= GetMacRootWindow() ;
1477 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1478 BeginUpdate( window
) ;
1482 if ( !EmptyRgn( window
->visRgn
) )
1485 win
->MacRedraw( window
->visRgn
, wxTheApp
->sm_lastMessageTime
) ;
1488 wxMacDrawingHelper help( win ) ;
1489 SetOrigin( 0 , 0 ) ;
1490 UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
1491 UMAUpdateControls( window , window->visRgn ) ;
1492 UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ;
1497 EndUpdate( window
) ;
1501 void wxWindow::MacUpdate( EventRecord
*ev
)
1503 WindowRef window
= (WindowRef
) ev
->message
;
1504 wxWindow
* win
= wxFindWinFromMacWindow( window
) ;
1506 BeginUpdate( window
) ;
1509 // if windowshade gives incompatibility , take the follwing out
1511 if ( !EmptyRgn( window
->visRgn
) )
1514 MacRedraw( window
->visRgn
, ev
->when
) ;
1517 wxMacDrawingHelper help( this ) ;
1518 SetOrigin( 0 , 0 ) ;
1519 UMASetThemeWindowBackground( m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
1520 UMAUpdateControls( window , window->visRgn ) ;
1521 UMASetThemeWindowBackground( m_macWindowData->m_macWindow , m_macWindowData->m_macWindowBackgroundTheme , false ) ;
1526 EndUpdate( window
) ;
1529 WindowRef
wxWindow::GetMacRootWindow() const
1531 WindowRef window
= NULL
;
1532 wxWindow
*iter
= (wxWindow
*)this ;
1536 if ( iter
->m_macWindowData
)
1537 return iter
->m_macWindowData
->m_macWindow
;
1539 iter
= iter
->GetParent() ;
1541 wxASSERT_MSG( 1 , "No valid mac root window" ) ;
1545 void wxWindow::MacCreateScrollBars( long style
)
1547 wxASSERT_MSG( m_vScrollBar
== NULL
&& m_hScrollBar
== NULL
, "attempt to create window twice" ) ;
1548 bool hasBoth
= ( style
& wxVSCROLL
) && ( style
& wxHSCROLL
) ;
1549 int adjust
= hasBoth
? MAC_SCROLLBAR_SIZE
- 1: 0 ;
1551 if ( style
& wxVSCROLL
)
1553 m_vScrollBar
= new wxScrollBar(this, wxWINDOW_VSCROLL
, wxPoint(m_width
-MAC_SCROLLBAR_SIZE
, 0),
1554 wxSize(MAC_SCROLLBAR_SIZE
, m_height
- adjust
), wxVERTICAL
);
1555 // m_vScrollBar->PushEventHandler( this ) ;
1557 if ( style
& wxHSCROLL
)
1559 m_hScrollBar
= new wxScrollBar(this, wxWINDOW_HSCROLL
, wxPoint(0 , m_height
-MAC_SCROLLBAR_SIZE
),
1560 wxSize( m_width
- adjust
, MAC_SCROLLBAR_SIZE
), wxHORIZONTAL
);
1561 // m_hScrollBar->PushEventHandler( this ) ;
1564 // because the create does not take into account the client area origin
1565 MacRepositionScrollBars() ; // we might have a real position shift
1568 void wxWindow::MacRepositionScrollBars()
1570 bool hasBoth
= ( m_hScrollBar
&& m_hScrollBar
->IsShown()) && ( m_vScrollBar
&& m_vScrollBar
->IsShown()) ;
1571 int adjust
= hasBoth
? MAC_SCROLLBAR_SIZE
- 1 : 0 ;
1575 m_vScrollBar
->SetSize( m_width
-MAC_SCROLLBAR_SIZE
, 0, MAC_SCROLLBAR_SIZE
, m_height
- adjust
, wxSIZE_USE_EXISTING
);
1579 m_hScrollBar
->SetSize( 0 , m_height
-MAC_SCROLLBAR_SIZE
,m_width
- adjust
, MAC_SCROLLBAR_SIZE
, wxSIZE_USE_EXISTING
);
1583 void wxWindow::MacKeyDown( EventRecord
*ev
)
1588 bool wxWindow::AcceptsFocus() const
1590 return MacCanFocus() && wxWindowBase::AcceptsFocus();
1593 ControlHandle
wxWindow::MacGetContainerForEmbedding()
1595 if ( m_macWindowData
)
1596 return m_macWindowData
->m_macRootControl
;
1598 return GetParent()->MacGetContainerForEmbedding() ;
1601 void wxWindow::MacSuperChangedPosition()
1603 // only window-absolute structures have to be moved i.e. controls
1605 wxNode
*node
= GetChildren().First();
1608 wxWindow
*child
= (wxWindow
*)node
->Data();
1609 child
->MacSuperChangedPosition() ;
1610 node
= node
->Next();
1614 bool wxWindow::MacSetupFocusPort( )
1622 MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1623 return MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1626 bool wxWindow::MacSetupFocusClientPort( )
1634 MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1635 return MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1638 bool wxWindow::MacSetupDrawingPort( )
1646 MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1647 return MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1650 bool wxWindow::MacSetupDrawingClientPort( )
1658 MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1659 return MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1663 bool wxWindow::MacSetPortFocusParams( const Point
& localOrigin
, const Rect
& clipRect
, WindowRef window
, wxWindow
* win
)
1665 if ( window
== NULL
)
1671 ::GetPort(&currPort
);
1672 port
= UMAGetWindowPort( window
) ;
1673 if (currPort
!= port
)
1676 ::SetOrigin(-localOrigin
.h
, -localOrigin
.v
);
1680 bool wxWindow::MacSetPortDrawingParams( const Point
& localOrigin
, const Rect
& clipRect
, WindowRef window
, wxWindow
* win
)
1682 if ( window
== NULL
)
1687 ::GetPort(&currPort
);
1688 port
= UMAGetWindowPort( window
) ;
1689 if (currPort
!= port
)
1692 ::SetOrigin(-localOrigin
.h
, -localOrigin
.v
);
1693 ::ClipRect(&clipRect
);
1696 ::RGBBackColor(& win
->GetBackgroundColour().GetPixel() ) ;
1697 ::RGBForeColor(& win
->GetForegroundColour().GetPixel() ) ;
1698 ::BackPat( &qd
.white
) ;
1699 ::UMASetThemeWindowBackground( win
->m_macWindowData
->m_macWindow
, win
->m_macWindowData
->m_macWindowBackgroundTheme
, false ) ;
1703 void wxWindow::MacGetPortParams(Point
* localOrigin
, Rect
* clipRect
, WindowRef
*window
, wxWindow
** rootwin
)
1705 if ( m_macWindowData
)
1711 clipRect
->right
= m_width
;
1712 clipRect
->bottom
= m_height
;
1713 *window
= m_macWindowData
->m_macWindow
;
1718 wxASSERT( GetParent() != NULL
) ;
1719 GetParent()->MacGetPortParams( localOrigin
, clipRect
, window
, rootwin
) ;
1720 localOrigin
->h
+= m_x
;
1721 localOrigin
->v
+= m_y
;
1722 OffsetRect(clipRect
, -m_x
, -m_y
);
1727 myClip
.right
= m_width
;
1728 myClip
.bottom
= m_height
;
1729 SectRect(clipRect
, &myClip
, clipRect
);
1733 void wxWindow::MacGetPortClientParams(Point
* localOrigin
, Rect
* clipRect
, WindowRef
*window
, wxWindow
** rootwin
)
1735 int width
, height
;
1736 GetClientSize( &width
, &height
) ;
1738 if ( m_macWindowData
)
1744 clipRect
->right
= m_width
;//width;
1745 clipRect
->bottom
= m_height
;// height;
1746 *window
= m_macWindowData
->m_macWindow
;
1751 wxASSERT( GetParent() != NULL
) ;
1753 GetParent()->MacGetPortClientParams( localOrigin
, clipRect
, window
, rootwin
) ;
1755 localOrigin
->h
+= m_x
;
1756 localOrigin
->v
+= m_y
;
1757 OffsetRect(clipRect
, -m_x
, -m_y
);
1762 myClip
.right
= width
;
1763 myClip
.bottom
= height
;
1764 SectRect(clipRect
, &myClip
, clipRect
);
1768 wxMacFocusHelper::wxMacFocusHelper( wxWindow
* theWindow
)
1775 m_currentPort
= NULL
;
1776 GetPort( &m_formerPort
) ;
1780 theWindow
->MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1781 m_currentPort
= UMAGetWindowPort( window
) ;
1782 theWindow
->MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1787 wxMacFocusHelper::~wxMacFocusHelper()
1791 SetOrigin( 0 , 0 ) ;
1793 if ( m_formerPort
!= m_currentPort
)
1794 SetPort( m_formerPort
) ;
1797 wxMacDrawingHelper::wxMacDrawingHelper( wxWindow
* theWindow
)
1804 m_currentPort
= NULL
;
1806 GetPort( &m_formerPort
) ;
1809 theWindow
->MacGetPortParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1810 m_currentPort
= UMAGetWindowPort( window
) ;
1811 if ( m_formerPort
!= m_currentPort
)
1812 SetPort( m_currentPort
) ;
1813 GetPenState( &m_savedPenState
) ;
1814 theWindow
->MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1819 wxMacDrawingHelper::~wxMacDrawingHelper()
1823 SetPenState( &m_savedPenState
) ;
1824 SetOrigin( 0 , 0 ) ;
1825 ClipRect( &m_currentPort
->portRect
) ;
1828 if ( m_formerPort
!= m_currentPort
)
1829 SetPort( m_formerPort
) ;
1832 wxMacFocusClientHelper::wxMacFocusClientHelper( wxWindow
* theWindow
)
1839 m_currentPort
= NULL
;
1841 GetPort( &m_formerPort
) ;
1845 theWindow
->MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1846 m_currentPort
= UMAGetWindowPort( window
) ;
1847 theWindow
->MacSetPortFocusParams( localOrigin
, clipRect
, window
, rootwin
) ;
1852 wxMacFocusClientHelper::~wxMacFocusClientHelper()
1856 SetOrigin( 0 , 0 ) ;
1858 if ( m_formerPort
!= m_currentPort
)
1859 SetPort( m_formerPort
) ;
1862 wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindow
* theWindow
)
1869 m_currentPort
= NULL
;
1871 GetPort( &m_formerPort
) ;
1875 theWindow
->MacGetPortClientParams( &localOrigin
, &clipRect
, &window
, &rootwin
) ;
1876 m_currentPort
= UMAGetWindowPort( window
) ;
1877 if ( m_formerPort
!= m_currentPort
)
1878 SetPort( m_currentPort
) ;
1879 GetPenState( &m_savedPenState
) ;
1880 theWindow
->MacSetPortDrawingParams( localOrigin
, clipRect
, window
, rootwin
) ;
1885 wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
1889 SetPenState( &m_savedPenState
) ;
1890 SetOrigin( 0 , 0 ) ;
1891 ClipRect( &m_currentPort
->portRect
) ;
1894 if ( m_formerPort
!= m_currentPort
)
1895 SetPort( m_formerPort
) ;