]>
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); |
21802234 | 69 | |
f38374d0 | 70 | // event handlers |
178f951f DW |
71 | void OnActivate(wxActivateEvent& rEvent); |
72 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); | |
21802234 DW |
73 | |
74 | // Toolbar | |
75 | #if wxUSE_TOOLBAR | |
178f951f DW |
76 | virtual wxToolBar* CreateToolBar( long lStyle = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT |
77 | ,wxWindowID vId = -1 | |
78 | ,const wxString& rsName = wxToolBarNameStr | |
79 | ); | |
21802234 | 80 | |
178f951f | 81 | virtual void PositionToolBar(void); |
21802234 DW |
82 | #endif // wxUSE_TOOLBAR |
83 | ||
21802234 | 84 | // Status bar |
f38374d0 | 85 | #if wxUSE_STATUSBAR |
178f951f DW |
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); | |
21802234 | 92 | |
f38374d0 DW |
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 | |
21802234 | 96 | |
21802234 | 97 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
178f951f | 98 | static void UseNativeStatusBar(bool bUseNative) |
80d83cbc | 99 | { m_bUseNativeStatusBar = bUseNative; }; |
f38374d0 | 100 | static bool UsesNativeStatusBar() |
80d83cbc | 101 | { return m_bUseNativeStatusBar; }; |
21802234 DW |
102 | #endif // wxUSE_STATUSBAR |
103 | ||
21802234 DW |
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 | ||
f38374d0 | 110 | // event handlers |
178f951f DW |
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 | ); | |
21802234 | 136 | |
f38374d0 | 137 | // tooltip management |
21802234 | 138 | #if wxUSE_TOOLTIPS |
a885d89a DW |
139 | WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; } |
140 | void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; } | |
21802234 | 141 | #endif // tooltips |
0e320a79 | 142 | |
f5526d36 DW |
143 | void SetClient(WXHWND c_Hwnd); |
144 | void SetClient(wxWindow* c_Window); | |
145 | wxWindow *GetClient(); | |
146 | ||
0e320a79 | 147 | protected: |
f38374d0 | 148 | // common part of all ctors |
178f951f | 149 | void Init(void); |
f38374d0 DW |
150 | |
151 | // common part of Iconize(), Maximize() and Restore() | |
178f951f | 152 | void DoShowWindow(int nShowCmd); |
f38374d0 | 153 | |
21802234 | 154 | // override base class virtuals |
178f951f DW |
155 | virtual void DoGetClientSize( int* pWidth |
156 | ,int* pHeight | |
157 | ) const; | |
158 | virtual void DoGetSize( int* pWidth | |
159 | ,int* pHeight | |
160 | ) const; | |
161 | virtual void DoGetPosition( int* pX | |
162 | ,int* pY | |
163 | ) const; | |
164 | virtual void DoSetClientSize( int nWidth | |
165 | ,int nWeight | |
166 | ); | |
e6ebb514 | 167 | |
f38374d0 | 168 | // helper |
178f951f | 169 | void DetachMenuBar(void); |
f38374d0 | 170 | |
21802234 DW |
171 | // a plug in for MDI frame classes which need to do something special when |
172 | // the menubar is set | |
178f951f | 173 | virtual void InternalSetMenuBar(void); |
21802234 DW |
174 | |
175 | // propagate our state change to all child frames | |
176 | void IconizeChildFrames(bool bIconize); | |
177 | ||
178 | // we add menu bar accel processing | |
179 | bool OS2TranslateMessage(WXMSG* pMsg); | |
180 | ||
181 | // window proc for the frames | |
178f951f DW |
182 | MRESULT OS2WindowProc( WXUINT uMessage |
183 | ,WXWPARAM wParam | |
184 | ,WXLPARAM lParam | |
185 | ); | |
21802234 | 186 | |
178f951f DW |
187 | bool m_bIconized; |
188 | WXHICON m_hDefaultIcon; | |
21802234 DW |
189 | |
190 | #if wxUSE_STATUSBAR | |
178f951f | 191 | static bool m_bUseNativeStatusBar; |
21802234 DW |
192 | #endif // wxUSE_STATUSBAR |
193 | ||
178f951f DW |
194 | // Data to save/restore when calling ShowFullScreen |
195 | long m_lFsStyle; // Passed to ShowFullScreen | |
196 | wxRect m_vFsOldSize; | |
197 | long m_lFsOldWindowStyle; | |
198 | int m_nFsStatusBarFields; // 0 for no status bar | |
199 | int m_nFsStatusBarHeight; | |
200 | int m_nFsToolBarHeight; | |
201 | bool m_bFsIsMaximized; | |
202 | bool m_bFsIsShowing; | |
760ac9ab DW |
203 | bool m_bIsShown; |
204 | wxWindow* m_pWinLastFocused; | |
178f951f | 205 | |
21802234 DW |
206 | private: |
207 | #if wxUSE_TOOLTIPS | |
80d83cbc | 208 | WXHWND m_hWndToolTip; |
21802234 DW |
209 | #endif // tooltips |
210 | ||
40bd6154 DW |
211 | // |
212 | // Handles to child windows of the Frame that we don't have child objects for | |
213 | // | |
214 | WXHWND m_hTitleBar; | |
215 | WXHWND m_hHScroll; | |
216 | WXHWND m_hVScroll; | |
217 | ||
218 | // | |
f6bcfd97 | 219 | // Swp structures for various client data |
40bd6154 DW |
220 | // DW: Better off in attached RefData? |
221 | // | |
222 | SWP m_vSwp; | |
223 | SWP m_vSwpClient; | |
224 | SWP m_vSwpTitleBar; | |
225 | SWP m_vSwpMenuBar; | |
226 | SWP m_vSwpHScroll; | |
227 | SWP m_vSwpVScroll; | |
228 | SWP m_vSwpStatusBar; | |
229 | SWP m_vSwpToolBar; | |
230 | ||
21802234 | 231 | DECLARE_EVENT_TABLE() |
f38374d0 | 232 | DECLARE_DYNAMIC_CLASS(wxFrame) |
0e320a79 DW |
233 | }; |
234 | ||
235 | #endif | |
236 | // _WX_FRAME_H_ | |
21802234 | 237 |