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