]>
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 | |
9 | // Licence: wxWindows license | |
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 | ||
30 | class WXDLLEXPORT wxFrame: public wxWindow { | |
31 | ||
32 | DECLARE_DYNAMIC_CLASS(wxFrame) | |
33 | ||
34 | public: | |
35 | wxFrame(void); | |
36 | inline wxFrame(wxWindow *parent, | |
debe6624 | 37 | wxWindowID id, |
2bda0e17 KB |
38 | const wxString& title, |
39 | const wxPoint& pos = wxDefaultPosition, | |
40 | const wxSize& size = wxDefaultSize, | |
debe6624 | 41 | long style = wxDEFAULT_FRAME_STYLE, |
2bda0e17 KB |
42 | const wxString& name = wxFrameNameStr) |
43 | { | |
44 | Create(parent, id, title, pos, size, style, name); | |
45 | } | |
46 | ||
47 | ~wxFrame(void); | |
48 | ||
49 | bool Create(wxWindow *parent, | |
debe6624 | 50 | wxWindowID id, |
2bda0e17 KB |
51 | const wxString& title, |
52 | const wxPoint& pos = wxDefaultPosition, | |
53 | const wxSize& size = wxDefaultSize, | |
debe6624 | 54 | long style = wxDEFAULT_FRAME_STYLE, |
2bda0e17 KB |
55 | const wxString& name = wxFrameNameStr); |
56 | ||
2bda0e17 | 57 | virtual bool Destroy(void); |
4fabb575 | 58 | |
debe6624 | 59 | void SetClientSize(int width, int height); |
4fabb575 JS |
60 | void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); } |
61 | ||
2bda0e17 | 62 | void GetClientSize(int *width, int *height) const; |
4fabb575 | 63 | wxSize GetClientSize() const { return wxWindow::GetClientSize(); } |
2bda0e17 KB |
64 | |
65 | void GetSize(int *width, int *height) const ; | |
4fabb575 JS |
66 | wxSize GetSize() const { return wxWindow::GetSize(); } |
67 | ||
2bda0e17 | 68 | void GetPosition(int *x, int *y) const ; |
4fabb575 JS |
69 | wxPoint GetPosition() const { return wxWindow::GetPosition(); } |
70 | ||
7b218dfa | 71 | virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
4fabb575 | 72 | |
7b218dfa | 73 | virtual void ClientToScreen(int *x, int *y) const; |
4fabb575 | 74 | |
7b218dfa | 75 | virtual void ScreenToClient(int *x, int *y) const; |
2bda0e17 | 76 | |
9123006f JS |
77 | virtual bool OnClose(void); |
78 | ||
2bda0e17 KB |
79 | void OnSize(wxSizeEvent& event); |
80 | void OnMenuHighlight(wxMenuEvent& event); | |
81 | void OnActivate(wxActivateEvent& event); | |
82 | void OnIdle(wxIdleEvent& event); | |
83 | void OnCloseWindow(wxCloseEvent& event); | |
84 | ||
debe6624 | 85 | bool Show(bool show); |
2bda0e17 KB |
86 | |
87 | // Set menu bar | |
88 | void SetMenuBar(wxMenuBar *menu_bar); | |
89 | virtual wxMenuBar *GetMenuBar(void) const ; | |
90 | ||
91 | // Set title | |
92 | void SetTitle(const wxString& title); | |
93 | wxString GetTitle(void) const ; | |
94 | ||
debe6624 | 95 | void Centre(int direction = wxBOTH); |
2bda0e17 KB |
96 | |
97 | // Call this to simulate a menu command | |
98 | virtual void Command(int id); | |
99 | virtual void ProcessCommand(int id); | |
100 | ||
101 | // Set icon | |
102 | virtual void SetIcon(const wxIcon& icon); | |
103 | ||
104 | // Create status line | |
81d66cf3 | 105 | virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, |
62448488 | 106 | const wxString& name = wxStatusLineNameStr); |
2bda0e17 | 107 | inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } |
d1c74ca9 | 108 | inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } |
81d66cf3 JS |
109 | virtual void PositionStatusBar(void); |
110 | virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id, | |
111 | const wxString& name); | |
112 | ||
113 | // Create toolbar | |
6a815808 VZ |
114 | virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, |
115 | wxWindowID id = -1, | |
116 | const wxString& name = wxToolBarNameStr); | |
81d66cf3 JS |
117 | virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); |
118 | // If made known to the frame, the frame will manage it automatically. | |
119 | virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } | |
120 | virtual inline wxToolBar *GetToolBar(void) const { return m_frameToolBar; } | |
121 | virtual void PositionToolBar(void); | |
2bda0e17 KB |
122 | |
123 | // Set status line text | |
debe6624 | 124 | virtual void SetStatusText(const wxString& text, int number = 0); |
2bda0e17 KB |
125 | |
126 | // Set status line widths | |
8b9518ee | 127 | virtual void SetStatusWidths(int n, const int widths_field[]); |
2bda0e17 KB |
128 | |
129 | // Hint to tell framework which status bar to use | |
130 | // TODO: should this go into a wxFrameworkSettings class perhaps? | |
131 | static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; | |
132 | static bool UsesNativeStatusBar(void) { return m_useNativeStatusBar; }; | |
133 | ||
134 | // Fit frame around subwindows | |
135 | virtual void Fit(void); | |
136 | ||
137 | // Iconize | |
debe6624 | 138 | virtual void Iconize(bool iconize); |
2bda0e17 KB |
139 | |
140 | virtual bool IsIconized(void) const ; | |
141 | ||
6f63ec3f JS |
142 | // Is it maximized? |
143 | virtual bool IsMaximized(void) const ; | |
144 | ||
2bda0e17 KB |
145 | // Compatibility |
146 | inline bool Iconized(void) const { return IsIconized(); } | |
147 | ||
debe6624 | 148 | virtual void Maximize(bool maximize); |
57a7b7c1 JS |
149 | // virtual bool LoadAccelerators(const wxString& table); |
150 | ||
81d66cf3 JS |
151 | // Responds to colour changes |
152 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
2bda0e17 KB |
153 | |
154 | // Query app for menu item updates (called from OnIdle) | |
155 | void DoMenuUpdates(void); | |
156 | void DoMenuUpdates(wxMenu* menu); | |
157 | ||
158 | WXHMENU GetWinMenu(void) const ; | |
159 | ||
81d66cf3 JS |
160 | // Checks if there is a toolbar, and returns the first free client position |
161 | virtual wxPoint GetClientAreaOrigin() const; | |
2bda0e17 KB |
162 | |
163 | // Handlers | |
164 | bool MSWOnPaint(void); | |
165 | WXHICON MSWOnQueryDragIcon(void); | |
debe6624 JS |
166 | void MSWOnSize(int x, int y, WXUINT flag); |
167 | bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
2bda0e17 | 168 | bool MSWOnClose(void); |
debe6624 | 169 | void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu); |
2bda0e17 | 170 | bool MSWProcessMessage(WXMSG *msg); |
57a7b7c1 | 171 | bool MSWTranslateMessage(WXMSG *msg); |
debe6624 JS |
172 | void MSWCreate(int id, wxWindow *parent, const char *WXUNUSED(wclass), wxWindow *wx_win, const char *title, |
173 | int x, int y, int width, int height, long style); | |
2bda0e17 KB |
174 | |
175 | protected: | |
d2aef312 VZ |
176 | // propagate our state change to all child frames |
177 | void IconizeChildFrames(bool bIconize); | |
178 | ||
2bda0e17 KB |
179 | wxMenuBar * m_frameMenuBar; |
180 | wxStatusBar * m_frameStatusBar; | |
181 | wxIcon m_icon; | |
182 | bool m_iconized; | |
183 | WXHICON m_defaultIcon; | |
184 | static bool m_useNativeStatusBar; | |
81d66cf3 | 185 | wxToolBar * m_frameToolBar ; |
2bda0e17 KB |
186 | |
187 | DECLARE_EVENT_TABLE() | |
188 | }; | |
189 | ||
190 | #endif | |
bbcdf8bc | 191 | // _WX_FRAME_H_ |