]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
New scrolling code.
[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/06/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 #ifdef __GNUG__
16 #pragma interface "frame.h"
17 #endif
18
19 #include "wx/window.h"
20 #include "wx/toolbar.h"
21 #include "wx/os2/accel.h"
22 #include "wx/icon.h"
23
24 WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
25 WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
26 WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
27
28 class WXDLLEXPORT wxMenuBar;
29 class WXDLLEXPORT wxStatusBar;
30
31 class WXDLLEXPORT wxFrame: public wxWindow {
32
33 DECLARE_DYNAMIC_CLASS(wxFrame)
34
35 public:
36 wxFrame();
37 inline wxFrame( wxWindow* parent
38 ,wxWindowID id
39 ,const wxString& title
40 ,const wxPoint& pos = wxDefaultPosition
41 ,const wxSize& size = wxDefaultSize
42 ,long style = wxDEFAULT_FRAME_STYLE
43 ,const wxString& name = wxFrameNameStr
44 )
45 {
46 Create(parent, id, title, pos, size, style, name);
47 }
48
49 ~wxFrame();
50
51 bool Create( wxWindow* parent
52 ,wxWindowID id
53 ,const wxString& title
54 ,const wxPoint& pos = wxDefaultPosition
55 ,const wxSize& size = wxDefaultSize
56 ,long style = wxDEFAULT_FRAME_STYLE
57 ,const wxString& name = wxFrameNameStr
58 );
59
60 virtual bool Destroy();
61
62 virtual void ClientToScreen(int *x, int *y) const;
63 virtual void ScreenToClient(int *x, int *y) const;
64
65 void SetClientSize(int width, int height);
66 void GetClientSize(int *width, int *height) const;
67
68 void OnSize(wxSizeEvent& event);
69 void OnMenuHighlight(wxMenuEvent& event);
70 void OnActivate(wxActivateEvent& event);
71 void OnIdle(wxIdleEvent& event);
72 void OnCloseWindow(wxCloseEvent& event);
73
74 bool Show(bool show);
75
76 void DetachMenuBar();
77
78 // Set menu bar
79 void SetMenuBar(wxMenuBar *menu_bar);
80 virtual wxMenuBar *GetMenuBar() const ;
81
82 // Call this to simulate a menu command
83 inline bool Command(int id) { return ProcessCommand(id); }
84
85 // process menu command: returns TRUE if processed
86 bool ProcessCommand(int id);
87
88 // make the window modal (all other windows unresponsive)
89 virtual void MakeModal(bool modal = TRUE);
90
91 // Set icon
92 virtual void SetIcon(const wxIcon& icon);
93
94 // Toolbar
95 #if wxUSE_TOOLBAR
96 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
97 wxWindowID id = -1,
98 const wxString& name = wxToolBarNameStr);
99
100 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
101
102 virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
103 virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
104
105 virtual void PositionToolBar();
106 #endif // wxUSE_TOOLBAR
107
108 #if wxUSE_STATUSBAR
109 // Status bar
110 virtual wxStatusBar* CreateStatusBar(int number = 1,
111 long style = wxST_SIZEGRIP,
112 wxWindowID id = 0,
113 const wxString& name = wxStatusLineNameStr);
114
115 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
116 void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
117
118 virtual void PositionStatusBar();
119 virtual wxStatusBar *OnCreateStatusBar(int number,
120 long style,
121 wxWindowID id,
122 const wxString& name);
123
124 // Set status line text
125 virtual void SetStatusText(const wxString& text, int number = 0);
126
127 // Set status line widths
128 virtual void SetStatusWidths(int n, const int widths_field[]);
129
130 // Hint to tell framework which status bar to use
131 // TODO: should this go into a wxFrameworkSettings class perhaps?
132 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
133 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
134 #endif // wxUSE_STATUSBAR
135
136 // Iconize
137 virtual void Iconize(bool iconize);
138
139 virtual bool IsIconized() const;
140
141 // Is it maximized?
142 virtual bool IsMaximized() const;
143
144 // Compatibility
145 bool Iconized() const { return IsIconized(); }
146
147 virtual void Maximize(bool maximize);
148 // virtual bool LoadAccelerators(const wxString& table);
149
150 // Responds to colour changes
151 void OnSysColourChanged(wxSysColourChangedEvent& event);
152
153 // Query app for menu item updates (called from OnIdle)
154 void DoMenuUpdates();
155 void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
156
157 WXHMENU GetWinMenu() const { return m_hMenu; }
158
159 // Returns the origin of client area (may be different from (0,0) if the
160 // frame has a toolbar)
161 virtual wxPoint GetClientAreaOrigin() const;
162
163 // Implementation only from here
164 // event handlers
165 bool HandlePaint();
166 bool HandleSize(int x, int y, WXUINT flag);
167 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
168 bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
169
170 bool OS2Create(int id, wxWindow *parent, const wxChar *wclass,
171 wxWindow *wx_win, const wxChar *title,
172 int x, int y, int width, int height, long style);
173
174 // tooltip management
175 #if wxUSE_TOOLTIPS
176 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
177 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
178 #endif // tooltips
179
180 protected:
181 // override base class virtuals
182 virtual void DoGetClientSize(int *width, int *height) const;
183 virtual void DoGetSize(int *width, int *height) const;
184 virtual void DoGetPosition(int *x, int *y) const;
185
186 virtual void DoSetClientSize(int width, int height);
187
188 // a plug in for MDI frame classes which need to do something special when
189 // the menubar is set
190 virtual void InternalSetMenuBar();
191
192 // propagate our state change to all child frames
193 void IconizeChildFrames(bool bIconize);
194
195 // we add menu bar accel processing
196 bool OS2TranslateMessage(WXMSG* pMsg);
197
198 // window proc for the frames
199 MRESULT OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
200
201 wxMenuBar * m_frameMenuBar;
202 wxIcon m_icon;
203 bool m_iconized;
204 WXHICON m_defaultIcon;
205
206 #if wxUSE_STATUSBAR
207 wxStatusBar * m_frameStatusBar;
208
209 static bool m_useNativeStatusBar;
210 #endif // wxUSE_STATUSBAR
211
212 #if wxUSE_TOOLBAR
213 wxToolBar * m_frameToolBar;
214 #endif // wxUSE_TOOLBAR
215
216 private:
217 #if wxUSE_TOOLTIPS
218 WXHWND m_hwndToolTip;
219 #endif // tooltips
220
221 DECLARE_EVENT_TABLE()
222 };
223
224 #endif
225 // _WX_FRAME_H_
226