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