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