1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/toplevel.h
3 // Purpose: wxTopLevelWindowMac is the Mac implementation of wxTLW
4 // Author: Stefan Csomor
8 // Copyright: (c) 2001 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_TOPLEVEL_H_
13 #define _WX_MSW_TOPLEVEL_H_
15 #if wxUSE_SYSTEM_OPTIONS
16 #define wxMAC_WINDOW_PLAIN_TRANSITION _T("mac.window-plain-transition")
19 // ----------------------------------------------------------------------------
20 // wxTopLevelWindowMac
21 // ----------------------------------------------------------------------------
23 class WXDLLEXPORT wxTopLevelWindowMac
: public wxTopLevelWindowBase
26 // constructors and such
27 wxTopLevelWindowMac() { Init(); }
29 wxTopLevelWindowMac(wxWindow
*parent
,
31 const wxString
& title
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
,
34 long style
= wxDEFAULT_FRAME_STYLE
,
35 const wxString
& name
= wxFrameNameStr
)
39 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
42 bool Create(wxWindow
*parent
,
44 const wxString
& title
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
47 long style
= wxDEFAULT_FRAME_STYLE
,
48 const wxString
& name
= wxFrameNameStr
);
50 virtual ~wxTopLevelWindowMac();
52 virtual wxPoint
GetClientAreaOrigin() const;
54 // Attracts the users attention to this window if the application is
55 // inactive (should be called when a background event occurs)
56 virtual void RequestUserAttention(int flags
= wxUSER_ATTENTION_INFO
);
58 // implement base class pure virtuals
59 virtual void Maximize(bool maximize
= true);
60 virtual bool IsMaximized() const;
61 virtual void Iconize(bool iconize
= true);
62 virtual bool IsIconized() const;
63 virtual void Restore();
65 virtual bool SetShape(const wxRegion
& region
);
67 virtual bool ShowFullScreen(bool show
, long style
= wxFULLSCREEN_ALL
) ;
68 virtual bool IsFullScreen() const ;
70 virtual bool SetTransparent(wxByte alpha
);
71 virtual bool CanSetTransparent();
73 virtual bool SetBackgroundStyle(wxBackgroundStyle style
);
75 // implementation from now on
76 // --------------------------
78 static void MacDelayedDeactivation(long timestamp
);
79 virtual void MacCreateRealWindow( const wxString
& title
,
83 const wxString
& name
) ;
84 virtual void ClearBackground() ;
86 WXWindow
MacGetWindowRef() { return m_macWindow
; }
87 virtual void MacActivate( long timestamp
, bool inIsActivating
) ;
88 virtual void MacPerformUpdates() ;
90 virtual void SetTitle( const wxString
& title
);
91 virtual wxString
GetTitle() const;
95 virtual bool Show( bool show
= true );
97 virtual bool ShowWithEffect(wxShowEffect effect
,
99 wxDirection dir
= wxBOTTOM
);
101 virtual bool HideWithEffect(wxShowEffect effect
,
102 unsigned timeout
= 0,
103 wxDirection dir
= wxBOTTOM
);
105 virtual void SetExtraStyle(long exStyle
) ;
107 virtual bool SetBackgroundColour( const wxColour
&colour
);
109 virtual void MacInstallTopLevelWindowEventHandler() ;
111 bool MacGetMetalAppearance() const ;
112 bool MacGetUnifiedAppearance() const ;
114 void MacChangeWindowAttributes( wxUint32 attributesToSet
, wxUint32 attributesToClear
) ;
115 wxUint32
MacGetWindowAttributes() const ;
117 WXEVENTHANDLERREF
MacGetEventHandler() { return m_macEventHandler
; }
119 virtual void MacGetContentAreaInset( int &left
, int &top
, int &right
, int &bottom
) ;
122 // common part of all ctors
125 virtual void DoGetPosition( int *x
, int *y
) const;
126 virtual void DoGetSize( int *width
, int *height
) const;
127 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
128 virtual void DoGetClientSize(int *width
, int *height
) const;
129 virtual void DoCentre(int dir
);
131 // is the frame currently iconized?
134 // should the frame be maximized when it will be shown? set by Maximize()
135 // when it is called while the frame is hidden
136 bool m_maximizeOnShow
;
138 WXWindow m_macWindow
;
140 wxWindowMac
* m_macFocus
;
141 void *m_macFullScreenData
;
143 static wxTopLevelWindowMac
*s_macDeactivateWindow
;
145 // KH: We cannot let this be called directly since the metal appearance is now managed by an
146 // extra style. Calling this function directly can result in blank white window backgrounds.
147 // This is because the ExtraStyle flags get out of sync with the metal appearance and the metal
148 // logic & checks cease to work as expected. To set the metal appearance, use SetExtraStyle.
149 void MacSetMetalAppearance( bool on
) ;
150 void MacSetUnifiedAppearance( bool on
) ;
151 // binary compatible workaround TODO REPLACE
152 void DoMacCreateRealWindow( wxWindow
*parent
, const wxString
& title
,
156 const wxString
& name
);
158 WXEVENTHANDLERREF m_macEventHandler
;
160 DECLARE_EVENT_TABLE()
163 // list of all frames and modeless dialogs
164 extern WXDLLEXPORT_DATA(wxWindowList
) wxModelessWindows
;
166 #endif // _WX_MSW_TOPLEVEL_H_