]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
Start of actual filling in of wxFrame.
[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 class WXDLLEXPORT wxFrame : public wxFrameBase
16 {
17 public:
18 // construction
19 wxFrame() { Init(); }
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 )
28 {
29 Init();
30
31 Create(pParent, vId, rsTitle, rPos, rSize, lStyle, rsName);
32 }
33
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 );
42
43 virtual ~wxFrame();
44
45 // implement base class pure virtuals
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 );
56 virtual bool IsFullScreen(void) const { return m_fsIsShowing; };
57
58
59 // implementation only from now on
60 // -------------------------------
61
62 // override some more virtuals
63 virtual bool Show(bool bShow = TRUE);
64
65 // event handlers
66 void OnActivate(wxActivateEvent& rEvent);
67 void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
68
69 // Toolbar
70 #if wxUSE_TOOLBAR
71 virtual wxToolBar* CreateToolBar( long lStyle = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT
72 ,wxWindowID vId = -1
73 ,const wxString& rsName = wxToolBarNameStr
74 );
75
76 virtual void PositionToolBar(void);
77 #endif // wxUSE_TOOLBAR
78
79 // Status bar
80 #if wxUSE_STATUSBAR
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);
87
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
91
92 // TODO: should this go into a wxFrameworkSettings class perhaps?
93 static void UseNativeStatusBar(bool bUseNative)
94 { m_useNativeStatusBar = useNative; };
95 static bool UsesNativeStatusBar()
96 { return m_useNativeStatusBar; };
97 #endif // wxUSE_STATUSBAR
98
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
105 // event handlers
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 );
131
132 // tooltip management
133 #if wxUSE_TOOLTIPS
134 WXHWND GetToolTipCtrl(void) const { return m_hwndToolTip; }
135 void SetToolTipCtrl(WXHWND hHwndTT) { m_hwndToolTip = hwndTT; }
136 #endif // tooltips
137
138 protected:
139 // common part of all ctors
140 void Init(void);
141
142 // common part of Iconize(), Maximize() and Restore()
143 void DoShowWindow(int nShowCmd);
144
145 // override base class virtuals
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 );
158
159 // helper
160 void DetachMenuBar(void);
161
162 // a plug in for MDI frame classes which need to do something special when
163 // the menubar is set
164 virtual void InternalSetMenuBar(void);
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
173 MRESULT OS2WindowProc( WXUINT uMessage
174 ,WXWPARAM wParam
175 ,WXLPARAM lParam
176 );
177
178 bool m_bIconized;
179 WXHICON m_hDefaultIcon;
180
181 #if wxUSE_STATUSBAR
182 static bool m_bUseNativeStatusBar;
183 #endif // wxUSE_STATUSBAR
184
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
195 private:
196 #if wxUSE_TOOLTIPS
197 WXHWND m_hHwndToolTip;
198 #endif // tooltips
199
200 DECLARE_EVENT_TABLE()
201 DECLARE_DYNAMIC_CLASS(wxFrame)
202 };
203
204 #endif
205 // _WX_FRAME_H_
206