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