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