]>
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 |
65571936 | 9 | // Licence: wxWindows licence |
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 | // | |
1d3d992e | 18 | #include "wx/os2/wxrsc.h" |
61243a51 | 19 | |
53a2db12 | 20 | class WXDLLIMPEXP_CORE 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 |
19193a2c | 51 | #if wxUSE_MENUS_NATIVE |
178f951f | 52 | virtual void SetMenuBar(wxMenuBar* pMenubar); |
19193a2c | 53 | #endif |
178f951f DW |
54 | virtual bool ShowFullScreen( bool bShow |
55 | ,long lStyle = wxFULLSCREEN_ALL | |
56 | ); | |
178f951f | 57 | |
21802234 | 58 | |
f38374d0 DW |
59 | // implementation only from now on |
60 | // ------------------------------- | |
21802234 | 61 | |
3011bf2b | 62 | virtual void Raise(void); |
21802234 | 63 | |
f38374d0 | 64 | // event handlers |
178f951f | 65 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); |
21802234 DW |
66 | |
67 | // Toolbar | |
68 | #if wxUSE_TOOLBAR | |
f9dae779 | 69 | virtual wxToolBar* CreateToolBar( long lStyle = -1 |
178f951f DW |
70 | ,wxWindowID vId = -1 |
71 | ,const wxString& rsName = wxToolBarNameStr | |
72 | ); | |
21802234 | 73 | |
d697657f DW |
74 | virtual wxToolBar* OnCreateToolBar( long lStyle |
75 | ,wxWindowID vId | |
76 | ,const wxString& rsName | |
77 | ); | |
178f951f | 78 | virtual void PositionToolBar(void); |
21802234 DW |
79 | #endif // wxUSE_TOOLBAR |
80 | ||
21802234 | 81 | // Status bar |
f38374d0 | 82 | #if wxUSE_STATUSBAR |
178f951f DW |
83 | virtual wxStatusBar* OnCreateStatusBar( int nNumber = 1 |
84 | ,long lStyle = wxST_SIZEGRIP | |
85 | ,wxWindowID vId = 0 | |
86 | ,const wxString& rsName = wxStatusLineNameStr | |
87 | ); | |
88 | virtual void PositionStatusBar(void); | |
21802234 | 89 | |
f38374d0 DW |
90 | // Hint to tell framework which status bar to use: the default is to use |
91 | // native one for the platforms which support it (Win32), the generic one | |
92 | // otherwise | |
21802234 | 93 | |
21802234 | 94 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
178f951f | 95 | static void UseNativeStatusBar(bool bUseNative) |
80d83cbc | 96 | { m_bUseNativeStatusBar = bUseNative; }; |
f38374d0 | 97 | static bool UsesNativeStatusBar() |
80d83cbc | 98 | { return m_bUseNativeStatusBar; }; |
21802234 DW |
99 | #endif // wxUSE_STATUSBAR |
100 | ||
21802234 DW |
101 | WXHMENU GetWinMenu() const { return m_hMenu; } |
102 | ||
103 | // Returns the origin of client area (may be different from (0,0) if the | |
104 | // frame has a toolbar) | |
105 | virtual wxPoint GetClientAreaOrigin() const; | |
106 | ||
f38374d0 | 107 | // event handlers |
178f951f DW |
108 | bool HandlePaint(void); |
109 | bool HandleSize( int nX | |
110 | ,int nY | |
111 | ,WXUINT uFlag | |
112 | ); | |
113 | bool HandleCommand( WXWORD wId | |
114 | ,WXWORD wCmd | |
115 | ,WXHWND wControl | |
116 | ); | |
117 | bool HandleMenuSelect( WXWORD wItem | |
118 | ,WXWORD wFlags | |
119 | ,WXHMENU hMenu | |
120 | ); | |
121 | ||
f38374d0 | 122 | // tooltip management |
21802234 | 123 | #if wxUSE_TOOLTIPS |
a885d89a DW |
124 | WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; } |
125 | void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; } | |
21802234 | 126 | #endif // tooltips |
0e320a79 | 127 | |
f5526d36 DW |
128 | void SetClient(WXHWND c_Hwnd); |
129 | void SetClient(wxWindow* c_Window); | |
130 | wxWindow *GetClient(); | |
131 | ||
60161cfa DW |
132 | friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam); |
133 | friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam); | |
134 | ||
0e320a79 | 135 | protected: |
f38374d0 | 136 | // common part of all ctors |
178f951f | 137 | void Init(void); |
f38374d0 | 138 | |
3011bf2b | 139 | virtual WXHICON GetDefaultIcon(void) const; |
21802234 | 140 | // override base class virtuals |
178f951f DW |
141 | virtual void DoGetClientSize( int* pWidth |
142 | ,int* pHeight | |
143 | ) const; | |
178f951f DW |
144 | virtual void DoSetClientSize( int nWidth |
145 | ,int nWeight | |
146 | ); | |
3011bf2b | 147 | inline virtual bool IsMDIChild(void) const { return FALSE; } |
e6ebb514 | 148 | |
19193a2c | 149 | #if wxUSE_MENUS_NATIVE |
f38374d0 | 150 | // helper |
178f951f | 151 | void DetachMenuBar(void); |
6835592c DW |
152 | // perform MSW-specific action when menubar is changed |
153 | virtual void AttachMenuBar(wxMenuBar* pMenubar); | |
21802234 DW |
154 | // a plug in for MDI frame classes which need to do something special when |
155 | // the menubar is set | |
178f951f | 156 | virtual void InternalSetMenuBar(void); |
6835592c | 157 | #endif |
21802234 DW |
158 | // propagate our state change to all child frames |
159 | void IconizeChildFrames(bool bIconize); | |
160 | ||
161 | // we add menu bar accel processing | |
162 | bool OS2TranslateMessage(WXMSG* pMsg); | |
163 | ||
164 | // window proc for the frames | |
178f951f DW |
165 | MRESULT OS2WindowProc( WXUINT uMessage |
166 | ,WXWPARAM wParam | |
167 | ,WXLPARAM lParam | |
168 | ); | |
21802234 | 169 | |
178f951f DW |
170 | bool m_bIconized; |
171 | WXHICON m_hDefaultIcon; | |
21802234 DW |
172 | |
173 | #if wxUSE_STATUSBAR | |
178f951f | 174 | static bool m_bUseNativeStatusBar; |
21802234 DW |
175 | #endif // wxUSE_STATUSBAR |
176 | ||
178f951f DW |
177 | // Data to save/restore when calling ShowFullScreen |
178 | long m_lFsStyle; // Passed to ShowFullScreen | |
179 | wxRect m_vFsOldSize; | |
180 | long m_lFsOldWindowStyle; | |
181 | int m_nFsStatusBarFields; // 0 for no status bar | |
182 | int m_nFsStatusBarHeight; | |
183 | int m_nFsToolBarHeight; | |
184 | bool m_bFsIsMaximized; | |
185 | bool m_bFsIsShowing; | |
fb49f3b3 | 186 | bool m_bWasMinimized; |
760ac9ab | 187 | bool m_bIsShown; |
178f951f | 188 | |
21802234 DW |
189 | private: |
190 | #if wxUSE_TOOLTIPS | |
80d83cbc | 191 | WXHWND m_hWndToolTip; |
21802234 DW |
192 | #endif // tooltips |
193 | ||
40bd6154 | 194 | // |
60161cfa DW |
195 | // Handles to child windows of the Frame, and the frame itself, |
196 | // that we don't have child objects for (m_hWnd in wxWindow is the | |
197 | // handle of the Frame's client window! | |
40bd6154 DW |
198 | // |
199 | WXHWND m_hTitleBar; | |
200 | WXHWND m_hHScroll; | |
201 | WXHWND m_hVScroll; | |
202 | ||
203 | // | |
f6bcfd97 | 204 | // Swp structures for various client data |
40bd6154 DW |
205 | // DW: Better off in attached RefData? |
206 | // | |
40bd6154 DW |
207 | SWP m_vSwpTitleBar; |
208 | SWP m_vSwpMenuBar; | |
209 | SWP m_vSwpHScroll; | |
210 | SWP m_vSwpVScroll; | |
211 | SWP m_vSwpStatusBar; | |
212 | SWP m_vSwpToolBar; | |
213 | ||
21802234 | 214 | DECLARE_EVENT_TABLE() |
0d53fc34 | 215 | DECLARE_DYNAMIC_CLASS(wxFrame) |
0e320a79 DW |
216 | }; |
217 | ||
ac10ea91 SN |
218 | MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam); |
219 | MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam); | |
0e320a79 DW |
220 | #endif |
221 | // _WX_FRAME_H_ | |
21802234 | 222 |