]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
f8bd78661c1b8dd62abb743b3f93fd13f60f2bfe
[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 licence
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/wxrsc.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 #if wxUSE_MENUS_NATIVE
52 virtual void SetMenuBar(wxMenuBar* pMenubar);
53 #endif
54 virtual bool ShowFullScreen( bool bShow
55 ,long lStyle = wxFULLSCREEN_ALL
56 );
57
58
59 // implementation only from now on
60 // -------------------------------
61
62 virtual void Raise(void);
63
64 // event handlers
65 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
66
67 // Toolbar
68 #if wxUSE_TOOLBAR
69 virtual wxToolBar* CreateToolBar( long lStyle = -1
70 ,wxWindowID vId = -1
71 ,const wxString& rsName = wxToolBarNameStr
72 );
73
74 virtual wxToolBar* OnCreateToolBar( long lStyle
75 ,wxWindowID vId
76 ,const wxString& rsName
77 );
78 virtual void PositionToolBar(void);
79 #endif // wxUSE_TOOLBAR
80
81 // Status bar
82 #if wxUSE_STATUSBAR
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);
89
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
93
94 // TODO: should this go into a wxFrameworkSettings class perhaps?
95 static void UseNativeStatusBar(bool bUseNative)
96 { m_bUseNativeStatusBar = bUseNative; };
97 static bool UsesNativeStatusBar()
98 { return m_bUseNativeStatusBar; };
99 #endif // wxUSE_STATUSBAR
100
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
107 // event handlers
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
122 // tooltip management
123 #if wxUSE_TOOLTIPS
124 WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
125 void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
126 #endif // tooltips
127
128 virtual void SendSizeEvent(void);
129
130 void SetClient(WXHWND c_Hwnd);
131 void SetClient(wxWindow* c_Window);
132 wxWindow *GetClient();
133
134 friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
135 friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
136
137 protected:
138 // common part of all ctors
139 void Init(void);
140
141 virtual WXHICON GetDefaultIcon(void) const;
142 // override base class virtuals
143 virtual void DoGetClientSize( int* pWidth
144 ,int* pHeight
145 ) const;
146 virtual void DoSetClientSize( int nWidth
147 ,int nWeight
148 );
149 inline virtual bool IsMDIChild(void) const { return FALSE; }
150
151 #if wxUSE_MENUS_NATIVE
152 // helper
153 void DetachMenuBar(void);
154 // perform MSW-specific action when menubar is changed
155 virtual void AttachMenuBar(wxMenuBar* pMenubar);
156 // a plug in for MDI frame classes which need to do something special when
157 // the menubar is set
158 virtual void InternalSetMenuBar(void);
159 #endif
160 // propagate our state change to all child frames
161 void IconizeChildFrames(bool bIconize);
162
163 // we add menu bar accel processing
164 bool OS2TranslateMessage(WXMSG* pMsg);
165
166 // window proc for the frames
167 MRESULT OS2WindowProc( WXUINT uMessage
168 ,WXWPARAM wParam
169 ,WXLPARAM lParam
170 );
171
172 bool m_bIconized;
173 WXHICON m_hDefaultIcon;
174
175 #if wxUSE_STATUSBAR
176 static bool m_bUseNativeStatusBar;
177 #endif // wxUSE_STATUSBAR
178
179 // Data to save/restore when calling ShowFullScreen
180 long m_lFsStyle; // Passed to ShowFullScreen
181 wxRect m_vFsOldSize;
182 long m_lFsOldWindowStyle;
183 int m_nFsStatusBarFields; // 0 for no status bar
184 int m_nFsStatusBarHeight;
185 int m_nFsToolBarHeight;
186 bool m_bFsIsMaximized;
187 bool m_bFsIsShowing;
188 bool m_bWasMinimized;
189 bool m_bIsShown;
190
191 private:
192 #if wxUSE_TOOLTIPS
193 WXHWND m_hWndToolTip;
194 #endif // tooltips
195
196 //
197 // Handles to child windows of the Frame, and the frame itself,
198 // that we don't have child objects for (m_hWnd in wxWindow is the
199 // handle of the Frame's client window!
200 //
201 WXHWND m_hTitleBar;
202 WXHWND m_hHScroll;
203 WXHWND m_hVScroll;
204
205 //
206 // Swp structures for various client data
207 // DW: Better off in attached RefData?
208 //
209 SWP m_vSwpTitleBar;
210 SWP m_vSwpMenuBar;
211 SWP m_vSwpHScroll;
212 SWP m_vSwpVScroll;
213 SWP m_vSwpStatusBar;
214 SWP m_vSwpToolBar;
215
216 DECLARE_EVENT_TABLE()
217 DECLARE_DYNAMIC_CLASS(wxFrame)
218 };
219
220 #endif
221 // _WX_FRAME_H_
222