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