]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/classic/toplevel.h
Tweaks for demos on MacOSX
[wxWidgets.git] / include / wx / mac / classic / toplevel.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/classic/toplevel.h
3 // Purpose: wxTopLevelWindowMac is the Mac implementation of wxTLW
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 20.09.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2001 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSW_TOPLEVEL_H_
13 #define _WX_MSW_TOPLEVEL_H_
14
15 #if wxUSE_SYSTEM_OPTIONS
16 #define wxMAC_WINDOW_PLAIN_TRANSITION _T("mac.window-plain-transition")
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // wxTopLevelWindowMac
21 // ----------------------------------------------------------------------------
22
23 class WXDLLEXPORT wxTopLevelWindowMac : public wxTopLevelWindowBase
24 {
25 public:
26 // constructors and such
27 wxTopLevelWindowMac() { Init(); }
28
29 wxTopLevelWindowMac(wxWindow *parent,
30 wxWindowID id,
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)
36 {
37 Init();
38
39 (void)Create(parent, id, title, pos, size, style, name);
40 }
41
42 bool Create(wxWindow *parent,
43 wxWindowID id,
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);
49
50 virtual ~wxTopLevelWindowMac();
51
52 // implement base class pure virtuals
53 virtual void Maximize(bool maximize = true);
54 virtual bool IsMaximized() const;
55 virtual void Iconize(bool iconize = true);
56 virtual bool IsIconized() const;
57 virtual void SetIcon(const wxIcon& icon);
58 virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
59 virtual void Restore();
60
61 virtual bool SetShape(const wxRegion& region);
62
63 virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style) = wxFULLSCREEN_ALL)
64 { return false; }
65 virtual bool IsFullScreen() const { return false; }
66
67 // implementation from now on
68 // --------------------------
69
70 static void MacDelayedDeactivation(long timestamp);
71 virtual void MacCreateRealWindow( const wxString& title,
72 const wxPoint& pos,
73 const wxSize& size,
74 long style,
75 const wxString& name ) ;
76 static WXWindow MacGetWindowInUpdate() { return s_macWindowInUpdate ; }
77 virtual void MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXWindow *window , wxWindowMac** rootwin ) ;
78 virtual void ClearBackground() ;
79 virtual WXWidget MacGetContainerForEmbedding() ;
80 WXWindow MacGetWindowRef() { return m_macWindow ; }
81 virtual void MacActivate( long timestamp , bool inIsActivating ) ;
82 virtual void MacUpdate( long timestamp ) ;
83 #if !TARGET_CARBON
84 virtual void MacMouseDown( WXEVENTREF ev , short windowPart ) ;
85 virtual void MacMouseUp( WXEVENTREF ev , short windowPart ) ;
86 virtual void MacMouseMoved( WXEVENTREF ev , short windowPart ) ;
87 virtual void MacKeyDown( WXEVENTREF ev ) ;
88 #endif
89 virtual void MacFireMouseEvent( wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp ) ;
90
91 virtual void SetTitle( const wxString& title);
92 virtual wxString GetTitle() const;
93
94 virtual void Raise();
95 virtual void Lower();
96 virtual bool Show( bool show = true );
97 virtual void DoMoveWindow(int x, int y, int width, int height);
98 void MacInvalidate( const WXRECTPTR rect, bool eraseBackground ) ;
99 short MacGetWindowBackgroundTheme() const { return m_macWindowBackgroundTheme ; }
100 static bool MacEnableCompositing( bool useCompositing );
101 bool MacUsesCompositing() { return m_macUsesCompositing; }
102
103 #if TARGET_CARBON
104 WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
105 #endif
106 protected:
107 // common part of all ctors
108 void Init();
109
110 // is the frame currently iconized?
111 bool m_iconized;
112
113 // should the frame be maximized when it will be shown? set by Maximize()
114 // when it is called while the frame is hidden
115 bool m_maximizeOnShow;
116 bool m_macUsesCompositing ;
117
118 short m_macWindowBackgroundTheme ;
119 WXWindow m_macWindow ;
120 WXWidget m_macRootControl ;
121 wxWindowMac* m_macFocus ;
122 WXHRGN m_macNoEraseUpdateRgn ;
123 bool m_macNeedsErasing ;
124
125 static WXWindow s_macWindowInUpdate ;
126 static wxTopLevelWindowMac *s_macDeactivateWindow;
127 static bool s_macWindowCompositing ;
128 private :
129 #if TARGET_CARBON
130 WXEVENTHANDLERREF m_macEventHandler ;
131 #endif
132 };
133
134 // list of all frames and modeless dialogs
135 extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
136
137 // associate mac windows with wx counterparts
138
139 wxTopLevelWindowMac* wxFindWinFromMacWindow( WXWindow inWindow ) ;
140 void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) ;
141
142
143 #endif // _WX_MSW_TOPLEVEL_H_