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