]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / os2 / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/frame.h
3 // Purpose: wxFrame class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/27/99
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_FRAME_H_
12 #define _WX_FRAME_H_
13
14 //
15 // Get the default resource ID's for frames
16 //
17 #include "wx/os2/wxrsc.h"
18
19 class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
20 {
21 public:
22 // construction
23 wxFrame() { Init(); }
24 wxFrame( wxWindow* pParent
25 ,wxWindowID vId
26 ,const wxString& rsTitle
27 ,const wxPoint& rPos = wxDefaultPosition
28 ,const wxSize& rSize = wxDefaultSize
29 ,long lStyle = wxDEFAULT_FRAME_STYLE
30 ,const wxString& rsName = wxFrameNameStr
31 )
32 {
33 Init();
34
35 Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
36 }
37
38 bool Create( wxWindow* pParent
39 ,wxWindowID vId
40 ,const wxString& rsTitle
41 ,const wxPoint& rPos = wxDefaultPosition
42 ,const wxSize& rSize = wxDefaultSize
43 ,long lStyle = wxDEFAULT_FRAME_STYLE
44 ,const wxString& rsName = wxFrameNameStr
45 );
46
47 virtual ~wxFrame();
48
49 // implement base class pure virtuals
50 #if wxUSE_MENUS_NATIVE
51 virtual void SetMenuBar(wxMenuBar* pMenubar);
52 #endif
53 virtual bool ShowFullScreen( bool bShow
54 ,long lStyle = wxFULLSCREEN_ALL
55 );
56
57
58 // implementation only from now on
59 // -------------------------------
60
61 virtual void Raise(void);
62
63 // event handlers
64 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
65
66 // Toolbar
67 #if wxUSE_TOOLBAR
68 virtual wxToolBar* CreateToolBar( long lStyle = -1
69 ,wxWindowID vId = -1
70 ,const wxString& rsName = wxToolBarNameStr
71 );
72
73 virtual wxToolBar* OnCreateToolBar( long lStyle
74 ,wxWindowID vId
75 ,const wxString& rsName
76 );
77 virtual void PositionToolBar(void);
78 #endif // wxUSE_TOOLBAR
79
80 // Status bar
81 #if wxUSE_STATUSBAR
82 virtual wxStatusBar* OnCreateStatusBar( int nNumber = 1
83 ,long lStyle = wxSTB_DEFAULT_STYLE
84 ,wxWindowID vId = 0
85 ,const wxString& rsName = wxStatusLineNameStr
86 );
87 virtual void PositionStatusBar(void);
88
89 // Hint to tell framework which status bar to use: the default is to use
90 // native one for the platforms which support it (Win32), the generic one
91 // otherwise
92
93 // TODO: should this go into a wxFrameworkSettings class perhaps?
94 static void UseNativeStatusBar(bool bUseNative)
95 { m_bUseNativeStatusBar = bUseNative; }
96 static bool UsesNativeStatusBar()
97 { return m_bUseNativeStatusBar; }
98 #endif // wxUSE_STATUSBAR
99
100 WXHMENU GetWinMenu() const { return m_hMenu; }
101
102 // Returns the origin of client area (may be different from (0,0) if the
103 // frame has a toolbar)
104 virtual wxPoint GetClientAreaOrigin() const;
105
106 // event handlers
107 bool HandlePaint(void);
108 bool HandleSize( int nX
109 ,int nY
110 ,WXUINT uFlag
111 );
112 bool HandleCommand( WXWORD wId
113 ,WXWORD wCmd
114 ,WXHWND wControl
115 );
116 bool HandleMenuSelect( WXWORD wItem
117 ,WXWORD wFlags
118 ,WXHMENU hMenu
119 );
120
121 // tooltip management
122 #if wxUSE_TOOLTIPS
123 WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
124 void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
125 #endif // tooltips
126
127 void SetClient(WXHWND c_Hwnd);
128 void SetClient(wxWindow* c_Window);
129 wxWindow *GetClient();
130
131 friend MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
132 friend MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
133
134 protected:
135 // common part of all ctors
136 void Init(void);
137
138 virtual WXHICON GetDefaultIcon(void) const;
139 // override base class virtuals
140 virtual void DoGetClientSize( int* pWidth
141 ,int* pHeight
142 ) const;
143 virtual void DoSetClientSize( int nWidth
144 ,int nWeight
145 );
146 inline virtual bool IsMDIChild(void) const { return FALSE; }
147
148 #if wxUSE_MENUS_NATIVE
149 // helper
150 void DetachMenuBar(void);
151 // perform MSW-specific action when menubar is changed
152 virtual void AttachMenuBar(wxMenuBar* pMenubar);
153 // a plug in for MDI frame classes which need to do something special when
154 // the menubar is set
155 virtual void InternalSetMenuBar(void);
156 #endif
157 // propagate our state change to all child frames
158 void IconizeChildFrames(bool bIconize);
159
160 // we add menu bar accel processing
161 bool OS2TranslateMessage(WXMSG* pMsg);
162
163 // window proc for the frames
164 MRESULT OS2WindowProc( WXUINT uMessage
165 ,WXWPARAM wParam
166 ,WXLPARAM lParam
167 );
168
169 bool m_bIconized;
170 WXHICON m_hDefaultIcon;
171
172 #if wxUSE_STATUSBAR
173 static bool m_bUseNativeStatusBar;
174 #endif // wxUSE_STATUSBAR
175
176 // Data to save/restore when calling ShowFullScreen
177 long m_lFsStyle; // Passed to ShowFullScreen
178 wxRect m_vFsOldSize;
179 long m_lFsOldWindowStyle;
180 int m_nFsStatusBarFields; // 0 for no status bar
181 int m_nFsStatusBarHeight;
182 int m_nFsToolBarHeight;
183 bool m_bFsIsMaximized;
184 bool m_bFsIsShowing;
185 bool m_bWasMinimized;
186 bool m_bIsShown;
187
188 private:
189 #if wxUSE_TOOLTIPS
190 WXHWND m_hWndToolTip;
191 #endif // tooltips
192
193 //
194 // Handles to child windows of the Frame, and the frame itself,
195 // that we don't have child objects for (m_hWnd in wxWindow is the
196 // handle of the Frame's client window!
197 //
198 WXHWND m_hTitleBar;
199 WXHWND m_hHScroll;
200 WXHWND m_hVScroll;
201
202 //
203 // Swp structures for various client data
204 // DW: Better off in attached RefData?
205 //
206 SWP m_vSwpTitleBar;
207 SWP m_vSwpMenuBar;
208 SWP m_vSwpHScroll;
209 SWP m_vSwpVScroll;
210 SWP m_vSwpStatusBar;
211 SWP m_vSwpToolBar;
212
213 DECLARE_EVENT_TABLE()
214 DECLARE_DYNAMIC_CLASS(wxFrame)
215 };
216
217 MRESULT EXPENTRY wxFrameWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
218 MRESULT EXPENTRY wxFrameMainWndProc(HWND hWnd,ULONG ulMsg, MPARAM wParam, MPARAM lParam);
219 #endif
220 // _WX_FRAME_H_
221