]>
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 | ||
210a651b | 20 | class WXDLLEXPORT wxFrameOS2 : public wxFrameBase |
004fd0c8 | 21 | { |
54da4255 | 22 | public: |
f38374d0 | 23 | // construction |
210a651b DW |
24 | wxFrameOS2() { Init(); } |
25 | wxFrameOS2( 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 | ) | |
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 | |
210a651b | 48 | virtual ~wxFrameOS2(); |
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 | |
f38374d0 | 69 | // override some more virtuals |
178f951f | 70 | virtual bool Show(bool bShow = TRUE); |
21802234 | 71 | |
f38374d0 | 72 | // event handlers |
178f951f DW |
73 | void OnActivate(wxActivateEvent& rEvent); |
74 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); | |
21802234 DW |
75 | |
76 | // Toolbar | |
77 | #if wxUSE_TOOLBAR | |
178f951f DW |
78 | virtual wxToolBar* CreateToolBar( long lStyle = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT |
79 | ,wxWindowID vId = -1 | |
80 | ,const wxString& rsName = wxToolBarNameStr | |
81 | ); | |
21802234 | 82 | |
178f951f | 83 | virtual void PositionToolBar(void); |
21802234 DW |
84 | #endif // wxUSE_TOOLBAR |
85 | ||
21802234 | 86 | // Status bar |
f38374d0 | 87 | #if wxUSE_STATUSBAR |
178f951f DW |
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); | |
21802234 | 94 | |
f38374d0 DW |
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 | |
21802234 | 98 | |
21802234 | 99 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
178f951f | 100 | static void UseNativeStatusBar(bool bUseNative) |
80d83cbc | 101 | { m_bUseNativeStatusBar = bUseNative; }; |
f38374d0 | 102 | static bool UsesNativeStatusBar() |
80d83cbc | 103 | { return m_bUseNativeStatusBar; }; |
21802234 DW |
104 | #endif // wxUSE_STATUSBAR |
105 | ||
21802234 DW |
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 | ||
f38374d0 | 112 | // event handlers |
178f951f DW |
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 | ); | |
21802234 | 138 | |
f38374d0 | 139 | // tooltip management |
21802234 | 140 | #if wxUSE_TOOLTIPS |
a885d89a DW |
141 | WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; } |
142 | void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; } | |
21802234 | 143 | #endif // tooltips |
0e320a79 | 144 | |
1ec46a5b DW |
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 | ||
f5526d36 DW |
151 | void SetClient(WXHWND c_Hwnd); |
152 | void SetClient(wxWindow* c_Window); | |
153 | wxWindow *GetClient(); | |
b7084589 | 154 | HWND GetFrame(void) const { return m_hFrame; } |
f5526d36 | 155 | |
60161cfa DW |
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 | ||
0e320a79 | 159 | protected: |
f38374d0 | 160 | // common part of all ctors |
178f951f | 161 | void Init(void); |
f38374d0 DW |
162 | |
163 | // common part of Iconize(), Maximize() and Restore() | |
178f951f | 164 | void DoShowWindow(int nShowCmd); |
f38374d0 | 165 | |
21802234 | 166 | // override base class virtuals |
178f951f DW |
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 | ); | |
e6ebb514 | 179 | |
19193a2c | 180 | #if wxUSE_MENUS_NATIVE |
f38374d0 | 181 | // helper |
178f951f | 182 | void DetachMenuBar(void); |
6835592c DW |
183 | // perform MSW-specific action when menubar is changed |
184 | virtual void AttachMenuBar(wxMenuBar* pMenubar); | |
21802234 DW |
185 | // a plug in for MDI frame classes which need to do something special when |
186 | // the menubar is set | |
178f951f | 187 | virtual void InternalSetMenuBar(void); |
6835592c | 188 | #endif |
21802234 DW |
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 | |
178f951f DW |
196 | MRESULT OS2WindowProc( WXUINT uMessage |
197 | ,WXWPARAM wParam | |
198 | ,WXLPARAM lParam | |
199 | ); | |
21802234 | 200 | |
178f951f DW |
201 | bool m_bIconized; |
202 | WXHICON m_hDefaultIcon; | |
21802234 DW |
203 | |
204 | #if wxUSE_STATUSBAR | |
178f951f | 205 | static bool m_bUseNativeStatusBar; |
21802234 DW |
206 | #endif // wxUSE_STATUSBAR |
207 | ||
178f951f DW |
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; | |
760ac9ab DW |
217 | bool m_bIsShown; |
218 | wxWindow* m_pWinLastFocused; | |
178f951f | 219 | |
21802234 DW |
220 | private: |
221 | #if wxUSE_TOOLTIPS | |
80d83cbc | 222 | WXHWND m_hWndToolTip; |
21802234 DW |
223 | #endif // tooltips |
224 | ||
40bd6154 | 225 | // |
60161cfa DW |
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! | |
40bd6154 | 229 | // |
60161cfa | 230 | WXHWND m_hFrame; |
40bd6154 DW |
231 | WXHWND m_hTitleBar; |
232 | WXHWND m_hHScroll; | |
233 | WXHWND m_hVScroll; | |
234 | ||
235 | // | |
f6bcfd97 | 236 | // Swp structures for various client data |
40bd6154 DW |
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 | ||
21802234 | 248 | DECLARE_EVENT_TABLE() |
0e320a79 DW |
249 | }; |
250 | ||
251 | #endif | |
252 | // _WX_FRAME_H_ | |
21802234 | 253 |