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