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