]>
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__ | |
16 | #pragma interface "frame.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/window.h" | |
81d66cf3 | 20 | #include "wx/toolbar.h" |
57a7b7c1 | 21 | #include "wx/msw/accel.h" |
2bda0e17 KB |
22 | |
23 | WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr; | |
81d66cf3 | 24 | WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr; |
62448488 | 25 | WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr; |
2bda0e17 KB |
26 | |
27 | class WXDLLEXPORT wxMenuBar; | |
28 | class WXDLLEXPORT wxStatusBar; | |
29 | ||
3a19e16d VZ |
30 | class WXDLLEXPORT wxFrame : public wxWindow |
31 | { | |
32 | DECLARE_DYNAMIC_CLASS(wxFrame) | |
2bda0e17 KB |
33 | |
34 | public: | |
3a19e16d VZ |
35 | wxFrame(); |
36 | wxFrame(wxWindow *parent, | |
37 | wxWindowID id, | |
38 | const wxString& title, | |
39 | const wxPoint& pos = wxDefaultPosition, | |
40 | const wxSize& size = wxDefaultSize, | |
41 | long style = wxDEFAULT_FRAME_STYLE, | |
42 | const wxString& name = wxFrameNameStr) | |
43 | { | |
44 | Create(parent, id, title, pos, size, style, name); | |
45 | } | |
16f6dfd8 | 46 | |
3a19e16d | 47 | ~wxFrame(); |
16f6dfd8 | 48 | |
3a19e16d VZ |
49 | bool Create(wxWindow *parent, |
50 | wxWindowID id, | |
51 | const wxString& title, | |
52 | const wxPoint& pos = wxDefaultPosition, | |
53 | const wxSize& size = wxDefaultSize, | |
54 | long style = wxDEFAULT_FRAME_STYLE, | |
55 | const wxString& name = wxFrameNameStr); | |
16f6dfd8 | 56 | |
3a19e16d | 57 | virtual bool Destroy(); |
16f6dfd8 | 58 | |
3a19e16d | 59 | void GetClientSize(int *width, int *height) const; |
3a19e16d | 60 | void GetSize(int *width, int *height) const ; |
3a19e16d | 61 | void GetPosition(int *x, int *y) const ; |
16f6dfd8 | 62 | |
3a19e16d | 63 | virtual void ClientToScreen(int *x, int *y) const; |
16f6dfd8 | 64 | |
3a19e16d | 65 | virtual void ScreenToClient(int *x, int *y) const; |
16f6dfd8 | 66 | |
3a19e16d VZ |
67 | void OnSize(wxSizeEvent& event); |
68 | void OnMenuHighlight(wxMenuEvent& event); | |
69 | void OnActivate(wxActivateEvent& event); | |
70 | void OnIdle(wxIdleEvent& event); | |
71 | void OnCloseWindow(wxCloseEvent& event); | |
16f6dfd8 | 72 | |
3a19e16d | 73 | bool Show(bool show); |
16f6dfd8 | 74 | |
3a19e16d VZ |
75 | // Set menu bar |
76 | void SetMenuBar(wxMenuBar *menu_bar); | |
77 | virtual wxMenuBar *GetMenuBar() const ; | |
16f6dfd8 | 78 | |
3a19e16d VZ |
79 | // Set title |
80 | void SetTitle(const wxString& title); | |
81 | wxString GetTitle() const ; | |
16f6dfd8 | 82 | |
3a19e16d | 83 | void Centre(int direction = wxBOTH); |
16f6dfd8 | 84 | |
3a19e16d VZ |
85 | // Call this to simulate a menu command |
86 | virtual void Command(int id); | |
87 | virtual void ProcessCommand(int id); | |
16f6dfd8 | 88 | |
3a19e16d VZ |
89 | // Set icon |
90 | virtual void SetIcon(const wxIcon& icon); | |
16f6dfd8 | 91 | |
3a19e16d VZ |
92 | // Toolbar |
93 | virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, | |
94 | wxWindowID id = -1, | |
95 | const wxString& name = wxToolBarNameStr); | |
96 | ||
97 | virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); | |
98 | ||
99 | virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } | |
100 | virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } | |
101 | ||
102 | virtual void PositionToolBar(); | |
16f6dfd8 | 103 | |
3a19e16d VZ |
104 | // Status bar |
105 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
106 | long style = wxST_SIZEGRIP, | |
107 | wxWindowID id = 0, | |
108 | const wxString& name = wxStatusLineNameStr); | |
109 | ||
110 | wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } | |
111 | void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } | |
112 | ||
113 | virtual void PositionStatusBar(); | |
114 | virtual wxStatusBar *OnCreateStatusBar(int number, | |
115 | long style, | |
116 | wxWindowID id, | |
117 | const wxString& name); | |
16f6dfd8 | 118 | |
3a19e16d VZ |
119 | // Set status line text |
120 | virtual void SetStatusText(const wxString& text, int number = 0); | |
16f6dfd8 | 121 | |
3a19e16d VZ |
122 | // Set status line widths |
123 | virtual void SetStatusWidths(int n, const int widths_field[]); | |
16f6dfd8 | 124 | |
3a19e16d VZ |
125 | // Hint to tell framework which status bar to use |
126 | // TODO: should this go into a wxFrameworkSettings class perhaps? | |
127 | static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; | |
128 | static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; | |
16f6dfd8 | 129 | |
3a19e16d VZ |
130 | // Fit frame around subwindows |
131 | virtual void Fit(); | |
16f6dfd8 | 132 | |
3a19e16d VZ |
133 | // Iconize |
134 | virtual void Iconize(bool iconize); | |
16f6dfd8 | 135 | |
3a19e16d | 136 | virtual bool IsIconized() const ; |
16f6dfd8 | 137 | |
3a19e16d VZ |
138 | // Is it maximized? |
139 | virtual bool IsMaximized() const ; | |
16f6dfd8 | 140 | |
3a19e16d VZ |
141 | // Compatibility |
142 | bool Iconized() const { return IsIconized(); } | |
16f6dfd8 | 143 | |
3a19e16d VZ |
144 | virtual void Maximize(bool maximize); |
145 | // virtual bool LoadAccelerators(const wxString& table); | |
16f6dfd8 | 146 | |
3a19e16d VZ |
147 | // Responds to colour changes |
148 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
16f6dfd8 | 149 | |
3a19e16d VZ |
150 | // Query app for menu item updates (called from OnIdle) |
151 | void DoMenuUpdates(); | |
152 | void DoMenuUpdates(wxMenu* menu); | |
16f6dfd8 | 153 | |
3a19e16d | 154 | WXHMENU GetWinMenu() const ; |
16f6dfd8 | 155 | |
3a19e16d VZ |
156 | // Returns the origin of client area (may be different from (0,0) if the |
157 | // frame has a toolbar) | |
158 | virtual wxPoint GetClientAreaOrigin() const; | |
16f6dfd8 | 159 | |
3a19e16d VZ |
160 | // Implementation only from here |
161 | // event handlers | |
162 | bool MSWOnPaint(); | |
163 | WXHICON MSWOnQueryDragIcon(); | |
164 | void MSWOnSize(int x, int y, WXUINT flag); | |
165 | bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
166 | bool MSWOnClose(); | |
167 | void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu); | |
168 | bool MSWProcessMessage(WXMSG *msg); | |
169 | bool MSWTranslateMessage(WXMSG *msg); | |
170 | void MSWCreate(int id, wxWindow *parent, const char *wclass, | |
171 | wxWindow *wx_win, const char *title, | |
debe6624 | 172 | int x, int y, int width, int height, long style); |
2bda0e17 | 173 | |
16f6dfd8 | 174 | // tooltip management |
3a19e16d | 175 | #if wxUSE_TOOLTIPS |
16f6dfd8 VZ |
176 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } |
177 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
3a19e16d VZ |
178 | #endif // tooltips |
179 | ||
2bda0e17 | 180 | protected: |
3a19e16d VZ |
181 | // propagate our state change to all child frames |
182 | void IconizeChildFrames(bool bIconize); | |
16f6dfd8 | 183 | |
3a19e16d VZ |
184 | wxMenuBar * m_frameMenuBar; |
185 | wxStatusBar * m_frameStatusBar; | |
186 | wxIcon m_icon; | |
187 | bool m_iconized; | |
188 | WXHICON m_defaultIcon; | |
189 | wxToolBar * m_frameToolBar ; | |
190 | ||
191 | static bool m_useNativeStatusBar; | |
192 | ||
193 | #if wxUSE_TOOLTIPS | |
194 | WXHWND m_hwndToolTip; | |
195 | #endif // tooltips | |
196 | ||
bfc6fde4 VZ |
197 | virtual void DoSetSize(int x, int y, |
198 | int width, int height, | |
199 | int sizeFlags = wxSIZE_AUTO); | |
200 | virtual void DoSetClientSize(int width, int height); | |
201 | ||
3a19e16d VZ |
202 | private: |
203 | DECLARE_EVENT_TABLE() | |
2bda0e17 KB |
204 | }; |
205 | ||
206 | #endif | |
bbcdf8bc | 207 | // _WX_FRAME_H_ |