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