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