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 wxDirection dir
= wxBOTTOM
);
90 virtual bool HideWithEffect(wxShowEffect effect
,
92 wxDirection dir
= wxBOTTOM
);
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 virtual void DoGetPosition( int *x
, int *y
) const;
115 virtual void DoGetSize( int *width
, int *height
) const;
116 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
117 virtual void DoGetClientSize(int *width
, int *height
) const;
119 WXWindow m_macWindow
;
121 wxWindowMac
* m_macFocus
;
123 static wxNonOwnedWindow
*s_macDeactivateWindow
;
125 // KH: We cannot let this be called directly since the metal appearance is now managed by an
126 // extra style. Calling this function directly can result in blank white window backgrounds.
127 // This is because the ExtraStyle flags get out of sync with the metal appearance and the metal
128 // logic & checks cease to work as expected. To set the metal appearance, use SetExtraStyle.
129 void MacSetMetalAppearance( bool on
) ;
130 void MacSetUnifiedAppearance( bool on
) ;
131 // binary compatible workaround TODO REPLACE
132 void DoMacCreateRealWindow( wxWindow
*parent
,
136 const wxString
& name
);
138 WXEVENTHANDLERREF m_macEventHandler
;
141 // list of all frames and modeless dialogs
142 extern WXDLLIMPEXP_DATA_CORE(wxWindowList
) wxModelessWindows
;
145 #endif // _WX_MAC_NONOWNEDWND_H_