]>
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 | ||
f38374d0 | 15 | class WXDLLEXPORT wxFrame : public wxFrameBase |
004fd0c8 | 16 | { |
54da4255 | 17 | public: |
f38374d0 DW |
18 | // construction |
19 | wxFrame() { Init(); } | |
178f951f DW |
20 | wxFrame( wxWindow* pParent |
21 | ,wxWindowID vId | |
22 | ,const wxString& rsTitle | |
23 | ,const wxPoint& rPos = wxDefaultPosition | |
24 | ,const wxSize& rSize = wxDefaultSize | |
25 | ,long lStyle = wxDEFAULT_FRAME_STYLE | |
26 | ,const wxString& rsName = wxFrameNameStr | |
27 | ) | |
21802234 | 28 | { |
f38374d0 DW |
29 | Init(); |
30 | ||
178f951f | 31 | Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName); |
21802234 | 32 | } |
0e320a79 | 33 | |
178f951f DW |
34 | bool Create( wxWindow* pParent |
35 | ,wxWindowID vId | |
36 | ,const wxString& rsTitle | |
37 | ,const wxPoint& rPos = wxDefaultPosition | |
38 | ,const wxSize& rSize = wxDefaultSize | |
39 | ,long lStyle = wxDEFAULT_FRAME_STYLE | |
40 | ,const wxString& rsName = wxFrameNameStr | |
41 | ); | |
21802234 | 42 | |
f38374d0 | 43 | virtual ~wxFrame(); |
21802234 | 44 | |
f38374d0 | 45 | // implement base class pure virtuals |
178f951f DW |
46 | virtual void Maximize(bool bMaximize = TRUE); |
47 | virtual bool IsMaximized(void) const; | |
48 | virtual void Iconize(bool bIconize = TRUE); | |
49 | virtual bool IsIconized(void) const; | |
50 | virtual void Restore(void); | |
51 | virtual void SetMenuBar(wxMenuBar* pMenubar); | |
52 | virtual void SetIcon(const wxIcon& rIcon); | |
53 | virtual bool ShowFullScreen( bool bShow | |
54 | ,long lStyle = wxFULLSCREEN_ALL | |
55 | ); | |
80d83cbc | 56 | virtual bool IsFullScreen(void) const { return m_bFfsIsShowing; }; |
178f951f | 57 | |
21802234 | 58 | |
f38374d0 DW |
59 | // implementation only from now on |
60 | // ------------------------------- | |
21802234 | 61 | |
f38374d0 | 62 | // override some more virtuals |
178f951f | 63 | virtual bool Show(bool bShow = TRUE); |
21802234 | 64 | |
f38374d0 | 65 | // event handlers |
178f951f DW |
66 | void OnActivate(wxActivateEvent& rEvent); |
67 | void OnSysColourChanged(wxSysColourChangedEvent& rEvent); | |
21802234 DW |
68 | |
69 | // Toolbar | |
70 | #if wxUSE_TOOLBAR | |
178f951f DW |
71 | virtual wxToolBar* CreateToolBar( long lStyle = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT |
72 | ,wxWindowID vId = -1 | |
73 | ,const wxString& rsName = wxToolBarNameStr | |
74 | ); | |
21802234 | 75 | |
178f951f | 76 | virtual void PositionToolBar(void); |
21802234 DW |
77 | #endif // wxUSE_TOOLBAR |
78 | ||
21802234 | 79 | // Status bar |
f38374d0 | 80 | #if wxUSE_STATUSBAR |
178f951f DW |
81 | virtual wxStatusBar* OnCreateStatusBar( int nNumber = 1 |
82 | ,long lStyle = wxST_SIZEGRIP | |
83 | ,wxWindowID vId = 0 | |
84 | ,const wxString& rsName = wxStatusLineNameStr | |
85 | ); | |
86 | virtual void PositionStatusBar(void); | |
21802234 | 87 | |
f38374d0 DW |
88 | // Hint to tell framework which status bar to use: the default is to use |
89 | // native one for the platforms which support it (Win32), the generic one | |
90 | // otherwise | |
21802234 | 91 | |
21802234 | 92 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
178f951f | 93 | static void UseNativeStatusBar(bool bUseNative) |
80d83cbc | 94 | { m_bUseNativeStatusBar = bUseNative; }; |
f38374d0 | 95 | static bool UsesNativeStatusBar() |
80d83cbc | 96 | { return m_bUseNativeStatusBar; }; |
21802234 DW |
97 | #endif // wxUSE_STATUSBAR |
98 | ||
21802234 DW |
99 | WXHMENU GetWinMenu() const { return m_hMenu; } |
100 | ||
101 | // Returns the origin of client area (may be different from (0,0) if the | |
102 | // frame has a toolbar) | |
103 | virtual wxPoint GetClientAreaOrigin() const; | |
104 | ||
f38374d0 | 105 | // event handlers |
178f951f DW |
106 | bool HandlePaint(void); |
107 | bool HandleSize( int nX | |
108 | ,int nY | |
109 | ,WXUINT uFlag | |
110 | ); | |
111 | bool HandleCommand( WXWORD wId | |
112 | ,WXWORD wCmd | |
113 | ,WXHWND wControl | |
114 | ); | |
115 | bool HandleMenuSelect( WXWORD wItem | |
116 | ,WXWORD wFlags | |
117 | ,WXHMENU hMenu | |
118 | ); | |
119 | ||
120 | bool OS2Create( int nId | |
121 | ,wxWindow* pParent | |
122 | ,const wxChar* zWclass | |
123 | ,wxWindow* pWxWin | |
124 | ,const wxChar* zTitle | |
125 | ,int nX | |
126 | ,int nY | |
127 | ,int nWidth | |
128 | ,int nHeight | |
129 | ,long nStyle | |
130 | ); | |
21802234 | 131 | |
f38374d0 | 132 | // tooltip management |
21802234 | 133 | #if wxUSE_TOOLTIPS |
80d83cbc DW |
134 | WXHWND GetToolTipCtrl(void) const { return m_hHwndToolTip; } |
135 | void SetToolTipCtrl(WXHWND hHwndTT) { m_hHwndToolTip = hHwndTT; } | |
21802234 | 136 | #endif // tooltips |
0e320a79 DW |
137 | |
138 | protected: | |
f38374d0 | 139 | // common part of all ctors |
178f951f | 140 | void Init(void); |
f38374d0 DW |
141 | |
142 | // common part of Iconize(), Maximize() and Restore() | |
178f951f | 143 | void DoShowWindow(int nShowCmd); |
f38374d0 | 144 | |
21802234 | 145 | // override base class virtuals |
178f951f DW |
146 | virtual void DoGetClientSize( int* pWidth |
147 | ,int* pHeight | |
148 | ) const; | |
149 | virtual void DoGetSize( int* pWidth | |
150 | ,int* pHeight | |
151 | ) const; | |
152 | virtual void DoGetPosition( int* pX | |
153 | ,int* pY | |
154 | ) const; | |
155 | virtual void DoSetClientSize( int nWidth | |
156 | ,int nWeight | |
157 | ); | |
e6ebb514 | 158 | |
f38374d0 | 159 | // helper |
178f951f | 160 | void DetachMenuBar(void); |
f38374d0 | 161 | |
21802234 DW |
162 | // a plug in for MDI frame classes which need to do something special when |
163 | // the menubar is set | |
178f951f | 164 | virtual void InternalSetMenuBar(void); |
21802234 DW |
165 | |
166 | // propagate our state change to all child frames | |
167 | void IconizeChildFrames(bool bIconize); | |
168 | ||
169 | // we add menu bar accel processing | |
170 | bool OS2TranslateMessage(WXMSG* pMsg); | |
171 | ||
172 | // window proc for the frames | |
178f951f DW |
173 | MRESULT OS2WindowProc( WXUINT uMessage |
174 | ,WXWPARAM wParam | |
175 | ,WXLPARAM lParam | |
176 | ); | |
21802234 | 177 | |
178f951f DW |
178 | bool m_bIconized; |
179 | WXHICON m_hDefaultIcon; | |
21802234 DW |
180 | |
181 | #if wxUSE_STATUSBAR | |
178f951f | 182 | static bool m_bUseNativeStatusBar; |
21802234 DW |
183 | #endif // wxUSE_STATUSBAR |
184 | ||
178f951f DW |
185 | // Data to save/restore when calling ShowFullScreen |
186 | long m_lFsStyle; // Passed to ShowFullScreen | |
187 | wxRect m_vFsOldSize; | |
188 | long m_lFsOldWindowStyle; | |
189 | int m_nFsStatusBarFields; // 0 for no status bar | |
190 | int m_nFsStatusBarHeight; | |
191 | int m_nFsToolBarHeight; | |
192 | bool m_bFsIsMaximized; | |
193 | bool m_bFsIsShowing; | |
194 | ||
21802234 DW |
195 | private: |
196 | #if wxUSE_TOOLTIPS | |
80d83cbc | 197 | WXHWND m_hWndToolTip; |
21802234 DW |
198 | #endif // tooltips |
199 | ||
200 | DECLARE_EVENT_TABLE() | |
f38374d0 | 201 | DECLARE_DYNAMIC_CLASS(wxFrame) |
0e320a79 DW |
202 | }; |
203 | ||
204 | #endif | |
205 | // _WX_FRAME_H_ | |
21802234 | 206 |