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