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