]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
removed duplicated DYNCLASS macro
[wxWidgets.git] / include / wx / os2 / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.h
3 // Purpose: wxFrame class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/27/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FRAME_H_
13 #define _WX_FRAME_H_
14
15 //
16 // Get the default resource ID's for frames
17 //
18 #include "wx/os2/wxOs2.h"
19
20 class WXDLLEXPORT wxFrame : public wxFrameBase
21 {
22 public:
23 // construction
24 wxFrame() { Init(); }
25 wxFrame( wxWindow* pParent
26 ,wxWindowID vId
27 ,const wxString& rsTitle
28 ,const wxPoint& rPos = wxDefaultPosition
29 ,const wxSize& rSize = wxDefaultSize
30 ,long lStyle = wxDEFAULT_FRAME_STYLE
31 ,const wxString& rsName = wxFrameNameStr
32 )
33 {
34 Init();
35
36 Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
37 }
38
39 bool Create( wxWindow* pParent
40 ,wxWindowID vId
41 ,const wxString& rsTitle
42 ,const wxPoint& rPos = wxDefaultPosition
43 ,const wxSize& rSize = wxDefaultSize
44 ,long lStyle = wxDEFAULT_FRAME_STYLE
45 ,const wxString& rsName = wxFrameNameStr
46 );
47
48 virtual ~wxFrame();
49
50 // implement base class pure virtuals
51 virtual void Maximize(bool bMaximize = TRUE);
52 virtual bool IsMaximized(void) const;
53 virtual void Iconize(bool bIconize = TRUE);
54 virtual bool IsIconized(void) const;
55 virtual void Restore(void);
56 #if wxUSE_MENUS_NATIVE
57 virtual void SetMenuBar(wxMenuBar* pMenubar);
58 #endif
59 virtual void SetIcon(const wxIcon& rIcon);
60 virtual bool ShowFullScreen( bool bShow
61 ,long lStyle = wxFULLSCREEN_ALL
62 );
63 virtual bool IsFullScreen(void) const { return m_bFsIsShowing; };
64
65
66 // implementation only from now on
67 // -------------------------------
68
69 // override some more virtuals
70 virtual bool Show(bool bShow = TRUE);
71
72 // event handlers
73 void OnActivate(wxActivateEvent& rEvent);
74 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
75
76 // Toolbar
77 #if wxUSE_TOOLBAR
78 virtual wxToolBar* CreateToolBar( long lStyle = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT
79 ,wxWindowID vId = -1
80 ,const wxString& rsName = wxToolBarNameStr
81 );
82
83 virtual void PositionToolBar(void);
84 #endif // wxUSE_TOOLBAR
85
86 // Status bar
87 #if wxUSE_STATUSBAR
88 virtual wxStatusBar* OnCreateStatusBar( int nNumber = 1
89 ,long lStyle = wxST_SIZEGRIP
90 ,wxWindowID vId = 0
91 ,const wxString& rsName = wxStatusLineNameStr
92 );
93 virtual void PositionStatusBar(void);
94
95 // Hint to tell framework which status bar to use: the default is to use
96 // native one for the platforms which support it (Win32), the generic one
97 // otherwise
98
99 // TODO: should this go into a wxFrameworkSettings class perhaps?
100 static void UseNativeStatusBar(bool bUseNative)
101 { m_bUseNativeStatusBar = bUseNative; };
102 static bool UsesNativeStatusBar()
103 { return m_bUseNativeStatusBar; };
104 #endif // wxUSE_STATUSBAR
105
106 WXHMENU GetWinMenu() const { return m_hMenu; }
107
108 // Returns the origin of client area (may be different from (0,0) if the
109 // frame has a toolbar)
110 virtual wxPoint GetClientAreaOrigin() const;
111
112 // event handlers
113 bool HandlePaint(void);
114 bool HandleSize( int nX
115 ,int nY
116 ,WXUINT uFlag
117 );
118 bool HandleCommand( WXWORD wId
119 ,WXWORD wCmd
120 ,WXHWND wControl
121 );
122 bool HandleMenuSelect( WXWORD wItem
123 ,WXWORD wFlags
124 ,WXHMENU hMenu
125 );
126
127 bool OS2Create( int nId
128 ,wxWindow* pParent
129 ,const wxChar* zWclass
130 ,wxWindow* pWxWin
131 ,const wxChar* zTitle
132 ,int nX
133 ,int nY
134 ,int nWidth
135 ,int nHeight
136 ,long nStyle
137 );
138
139 // tooltip management
140 #if wxUSE_TOOLTIPS
141 WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
142 void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
143 #endif // tooltips
144
145 //
146 // Called by wxWindow whenever it gets focus
147 //
148 void SetLastFocus(wxWindow* pWin) { m_pWinLastFocused = pWin; }
149 wxWindow *GetLastFocus(void) const { return m_pWinLastFocused; }
150
151 void SetClient(WXHWND c_Hwnd);
152 void SetClient(wxWindow* c_Window);
153 wxWindow *GetClient();
154 HWND GetFrame(void) const { return m_hFrame; }
155
156 friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
157 friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
158
159 protected:
160 // common part of all ctors
161 void Init(void);
162
163 // common part of Iconize(), Maximize() and Restore()
164 void DoShowWindow(int nShowCmd);
165
166 // override base class virtuals
167 virtual void DoGetClientSize( int* pWidth
168 ,int* pHeight
169 ) const;
170 virtual void DoGetSize( int* pWidth
171 ,int* pHeight
172 ) const;
173 virtual void DoGetPosition( int* pX
174 ,int* pY
175 ) const;
176 virtual void DoSetClientSize( int nWidth
177 ,int nWeight
178 );
179
180 #if wxUSE_MENUS_NATIVE
181 // helper
182 void DetachMenuBar(void);
183 // perform MSW-specific action when menubar is changed
184 virtual void AttachMenuBar(wxMenuBar* pMenubar);
185 // a plug in for MDI frame classes which need to do something special when
186 // the menubar is set
187 virtual void InternalSetMenuBar(void);
188 #endif
189 // propagate our state change to all child frames
190 void IconizeChildFrames(bool bIconize);
191
192 // we add menu bar accel processing
193 bool OS2TranslateMessage(WXMSG* pMsg);
194
195 // window proc for the frames
196 MRESULT OS2WindowProc( WXUINT uMessage
197 ,WXWPARAM wParam
198 ,WXLPARAM lParam
199 );
200
201 bool m_bIconized;
202 WXHICON m_hDefaultIcon;
203
204 #if wxUSE_STATUSBAR
205 static bool m_bUseNativeStatusBar;
206 #endif // wxUSE_STATUSBAR
207
208 // Data to save/restore when calling ShowFullScreen
209 long m_lFsStyle; // Passed to ShowFullScreen
210 wxRect m_vFsOldSize;
211 long m_lFsOldWindowStyle;
212 int m_nFsStatusBarFields; // 0 for no status bar
213 int m_nFsStatusBarHeight;
214 int m_nFsToolBarHeight;
215 bool m_bFsIsMaximized;
216 bool m_bFsIsShowing;
217 bool m_bIsShown;
218 wxWindow* m_pWinLastFocused;
219
220 private:
221 #if wxUSE_TOOLTIPS
222 WXHWND m_hWndToolTip;
223 #endif // tooltips
224
225 //
226 // Handles to child windows of the Frame, and the frame itself,
227 // that we don't have child objects for (m_hWnd in wxWindow is the
228 // handle of the Frame's client window!
229 //
230 WXHWND m_hFrame;
231 WXHWND m_hTitleBar;
232 WXHWND m_hHScroll;
233 WXHWND m_hVScroll;
234
235 //
236 // Swp structures for various client data
237 // DW: Better off in attached RefData?
238 //
239 SWP m_vSwp;
240 SWP m_vSwpClient;
241 SWP m_vSwpTitleBar;
242 SWP m_vSwpMenuBar;
243 SWP m_vSwpHScroll;
244 SWP m_vSwpVScroll;
245 SWP m_vSwpStatusBar;
246 SWP m_vSwpToolBar;
247
248 DECLARE_EVENT_TABLE()
249 DECLARE_DYNAMIC_CLASS(wxFrame)
250 };
251
252 #endif
253 // _WX_FRAME_H_
254