]> 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 void OnSize(wxSizeEvent& event);
59 void OnMenuHighlight(wxMenuEvent& event);
60 void OnActivate(wxActivateEvent& event);
61 void OnIdle(wxIdleEvent& event);
62 void OnCloseWindow(wxCloseEvent& event);
63
64 bool Show(bool show);
65
66 void DetachMenuBar();
67 // Set menu bar
68 void SetMenuBar(wxMenuBar *menu_bar);
69 virtual wxMenuBar *GetMenuBar() const ;
70
71 // Call this to simulate a menu command
72 inline bool Command(int id) { return ProcessCommand(id); }
73
74 // process menu command: returns TRUE if processed
75 bool ProcessCommand(int id);
76
77 // make the window modal (all other windows unresponsive)
78 virtual void MakeModal(bool modal = TRUE);
79
80 // Set icon
81 virtual void SetIcon(const wxIcon& icon);
82
83 // Toolbar
84 #if wxUSE_TOOLBAR
85 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
86 wxWindowID id = -1,
87 const wxString& name = wxToolBarNameStr);
88
89 virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
90
91 virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
92 virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
93
94 virtual void PositionToolBar();
95 #endif // wxUSE_TOOLBAR
96
97 #if wxUSE_STATUSBAR
98 // Status bar
99 virtual wxStatusBar* CreateStatusBar(int number = 1,
100 long style = wxST_SIZEGRIP,
101 wxWindowID id = 0,
102 const wxString& name = wxStatusLineNameStr);
103
104 wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
105 void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; }
106
107 virtual void PositionStatusBar();
108 virtual wxStatusBar *OnCreateStatusBar(int number,
109 long style,
110 wxWindowID id,
111 const wxString& name);
112
113 // Set status line text
114 virtual void SetStatusText(const wxString& text, int number = 0);
115
116 // Set status line widths
117 virtual void SetStatusWidths(int n, const int widths_field[]);
118
119 // Hint to tell framework which status bar to use
120 // TODO: should this go into a wxFrameworkSettings class perhaps?
121 static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; };
122 static bool UsesNativeStatusBar() { return m_useNativeStatusBar; };
123 #endif // wxUSE_STATUSBAR
124
125 // Iconize
126 virtual void Iconize(bool iconize);
127
128 virtual bool IsIconized() const;
129
130 // Is it maximized?
131 virtual bool IsMaximized() const;
132
133 // Compatibility
134 bool Iconized() const { return IsIconized(); }
135
136 virtual void Maximize(bool maximize);
137 // virtual bool LoadAccelerators(const wxString& table);
138
139 // Responds to colour changes
140 void OnSysColourChanged(wxSysColourChangedEvent& event);
141
142 // Query app for menu item updates (called from OnIdle)
143 void DoMenuUpdates();
144 void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
145
146 WXHMENU GetWinMenu() const { return m_hMenu; }
147
148 // Returns the origin of client area (may be different from (0,0) if the
149 // frame has a toolbar)
150 virtual wxPoint GetClientAreaOrigin() const;
151
152 // Implementation only from here
153 // event handlers
154 bool HandlePaint();
155 bool HandleSize(int x, int y, WXUINT flag);
156 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
157 bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
158
159 bool OS2Create(int id, wxWindow *parent, const wxChar *wclass,
160 wxWindow *wx_win, const wxChar *title,
161 int x, int y, int width, int height, long style);
162
163 // tooltip management
164 #if wxUSE_TOOLTIPS
165 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
166 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
167 #endif // tooltips
168
169 protected:
170 // override base class virtuals
171 virtual void DoGetClientSize(int *width, int *height) const;
172 virtual void DoGetSize(int *width, int *height) const;
173 virtual void DoGetPosition(int *x, int *y) const;
174
175 virtual void DoSetClientSize(int width, int height);
176
177 virtual void DoClientToScreen(int *x, int *y) const;
178 virtual void DoScreenToClient(int *x, int *y) const;
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