1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/nonownedwnd.h
3 // Purpose: declares wxNonOwnedWindow class
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: nonownedwnd.h 46993 2007-06-28 08:46:04Z VS $
8 // Copyright: (c) 2008 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MAC_NONOWNEDWND_H_
13 #define _WX_MAC_NONOWNEDWND_H_
15 #include "wx/window.h"
17 #if wxUSE_SYSTEM_OPTIONS
18 #define wxMAC_WINDOW_PLAIN_TRANSITION _T("mac.window-plain-transition")
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 // This class represents "non-owned" window. A window is owned by another
26 // window if it has a parent and is positioned within the parent. For example,
27 // wxFrame is non-owned, because even though it can have a parent, it's
28 // location is independent of it. This class is for internal use only, it's
29 // the base class for wxTopLevelWindow and wxPopupWindow.
31 class WXDLLIMPEXP_CORE wxNonOwnedWindow
: public wxWindow
34 // constructors and such
35 wxNonOwnedWindow() { Init(); }
37 wxNonOwnedWindow(wxWindow
*parent
,
39 const wxPoint
& pos
= wxDefaultPosition
,
40 const wxSize
& size
= wxDefaultSize
,
42 const wxString
& name
= wxPanelNameStr
)
46 (void)Create(parent
, id
, pos
, size
, style
, name
);
49 bool Create(wxWindow
*parent
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
54 const wxString
& name
= wxPanelNameStr
);
56 virtual ~wxNonOwnedWindow();
58 virtual wxPoint
GetClientAreaOrigin() const;
60 // implement base class pure virtuals
62 virtual bool SetShape(const wxRegion
& region
);
64 virtual bool SetTransparent(wxByte alpha
);
65 virtual bool CanSetTransparent();
67 virtual bool SetBackgroundStyle(wxBackgroundStyle style
);
69 // implementation from now on
70 // --------------------------
72 static void MacDelayedDeactivation(long timestamp
);
73 virtual void MacCreateRealWindow( const wxPoint
& pos
,
76 const wxString
& name
) ;
78 WXWindow
MacGetWindowRef() { return m_macWindow
; }
79 virtual void MacActivate( long timestamp
, bool inIsActivating
) ;
80 virtual void MacPerformUpdates() ;
84 virtual bool Show( bool show
= true );
86 virtual bool ShowWithEffect(wxShowEffect effect
,
88 { return MacShowWithEffect(true, effect
, timeout
); }
90 virtual bool HideWithEffect(wxShowEffect effect
,
92 { return MacShowWithEffect(false, effect
, timeout
); }
94 virtual void SetExtraStyle(long exStyle
) ;
96 virtual bool SetBackgroundColour( const wxColour
&colour
);
98 virtual void MacInstallTopLevelWindowEventHandler() ;
100 bool MacGetMetalAppearance() const ;
101 bool MacGetUnifiedAppearance() const ;
103 void MacChangeWindowAttributes( wxUint32 attributesToSet
, wxUint32 attributesToClear
) ;
104 wxUint32
MacGetWindowAttributes() const ;
106 WXEVENTHANDLERREF
MacGetEventHandler() { return m_macEventHandler
; }
108 virtual void MacGetContentAreaInset( int &left
, int &top
, int &right
, int &bottom
) ;
111 // common part of all ctors
114 bool MacShowWithEffect(bool show
, wxShowEffect effect
, unsigned timeout
);
116 virtual void DoGetPosition( int *x
, int *y
) const;
117 virtual void DoGetSize( int *width
, int *height
) const;
118 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
119 virtual void DoGetClientSize(int *width
, int *height
) const;
121 WXWindow m_macWindow
;
123 wxWindowMac
* m_macFocus
;
125 static wxNonOwnedWindow
*s_macDeactivateWindow
;
127 // KH: We cannot let this be called directly since the metal appearance is now managed by an
128 // extra style. Calling this function directly can result in blank white window backgrounds.
129 // This is because the ExtraStyle flags get out of sync with the metal appearance and the metal
130 // logic & checks cease to work as expected. To set the metal appearance, use SetExtraStyle.
131 void MacSetMetalAppearance( bool on
) ;
132 void MacSetUnifiedAppearance( bool on
) ;
133 // binary compatible workaround TODO REPLACE
134 void DoMacCreateRealWindow( wxWindow
*parent
,
138 const wxString
& name
);
140 WXEVENTHANDLERREF m_macEventHandler
;
143 // list of all frames and modeless dialogs
144 extern WXDLLIMPEXP_DATA_CORE(wxWindowList
) wxModelessWindows
;
147 #endif // _WX_MAC_NONOWNEDWND_H_