]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: frame.h | |
01b2eeec KB |
3 | // Purpose: wxFrame class |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
9 | // Licence: wxWindows licence | |
7c78e7c7 RR |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
01b2eeec KB |
12 | #ifndef _WX_FRAME_H_ |
13 | #define _WX_FRAME_H_ | |
7c78e7c7 RR |
14 | |
15 | #ifdef __GNUG__ | |
01b2eeec | 16 | #pragma interface "frame.h" |
7c78e7c7 RR |
17 | #endif |
18 | ||
7c78e7c7 | 19 | #include "wx/window.h" |
01b2eeec KB |
20 | #include "wx/toolbar.h" |
21 | #include "wx/accel.h" | |
7c78e7c7 | 22 | |
01b2eeec KB |
23 | WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr; |
24 | WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr; | |
7c78e7c7 | 25 | |
01b2eeec KB |
26 | class WXDLLEXPORT wxMenuBar; |
27 | class WXDLLEXPORT wxStatusBar; | |
7c78e7c7 | 28 | |
01b2eeec | 29 | class WXDLLEXPORT wxFrame: public wxWindow { |
7c78e7c7 | 30 | |
7c78e7c7 | 31 | DECLARE_DYNAMIC_CLASS(wxFrame) |
7c78e7c7 | 32 | |
01b2eeec | 33 | public: |
7c78e7c7 | 34 | wxFrame(); |
01b2eeec KB |
35 | inline wxFrame(wxWindow *parent, |
36 | wxWindowID id, | |
37 | const wxString& title, | |
38 | const wxPoint& pos = wxDefaultPosition, | |
39 | const wxSize& size = wxDefaultSize, | |
40 | long style = wxDEFAULT_FRAME_STYLE, | |
41 | const wxString& name = wxFrameNameStr) | |
42 | { | |
43 | Create(parent, id, title, pos, size, style, name); | |
44 | } | |
45 | ||
7c78e7c7 | 46 | ~wxFrame(); |
7c78e7c7 | 47 | |
01b2eeec KB |
48 | bool Create(wxWindow *parent, |
49 | wxWindowID id, | |
50 | const wxString& title, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | long style = wxDEFAULT_FRAME_STYLE, | |
54 | const wxString& name = wxFrameNameStr); | |
55 | ||
56 | virtual bool Destroy(); | |
57 | void SetClientSize(int width, int height); | |
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 ; | |
62 | void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); | |
63 | ||
64 | virtual bool OnClose(); | |
65 | ||
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 | ||
72 | bool Show(bool show); | |
73 | ||
74 | // Set menu bar | |
75 | void SetMenuBar(wxMenuBar *menu_bar); | |
76 | virtual wxMenuBar *GetMenuBar() const ; | |
77 | ||
78 | // Set title | |
79 | void SetTitle(const wxString& title); | |
80 | wxString GetTitle() const ; | |
7c78e7c7 | 81 | |
01b2eeec | 82 | void Centre(int direction = wxBOTH); |
7c78e7c7 | 83 | |
01b2eeec KB |
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 | |
7c78e7c7 RR |
92 | virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, |
93 | const wxString& name = "statusBar"); | |
01b2eeec KB |
94 | inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } |
95 | virtual void PositionStatusBar(); | |
96 | virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id, | |
97 | const wxString& name); | |
98 | ||
99 | // Create toolbar | |
100 | virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr); | |
101 | virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); | |
102 | // If made known to the frame, the frame will manage it automatically. | |
103 | virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } | |
104 | virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; } | |
105 | virtual void PositionToolBar(); | |
106 | ||
107 | // Set status line text | |
108 | virtual void SetStatusText(const wxString& text, int number = 0); | |
109 | ||
110 | // Set status line widths | |
111 | virtual void SetStatusWidths(int n, const int widths_field[]); | |
112 | ||
113 | // Hint to tell framework which status bar to use | |
114 | // TODO: should this go into a wxFrameworkSettings class perhaps? | |
115 | static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; | |
116 | static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; | |
117 | ||
118 | // Fit frame around subwindows | |
119 | virtual void Fit(); | |
7c78e7c7 | 120 | |
01b2eeec KB |
121 | // Iconize |
122 | virtual void Iconize(bool iconize); | |
7c78e7c7 | 123 | |
01b2eeec KB |
124 | virtual bool IsIconized() const ; |
125 | ||
126 | // Compatibility | |
127 | inline bool Iconized() const { return IsIconized(); } | |
128 | ||
129 | virtual void Maximize(bool maximize); | |
130 | ||
131 | virtual void SetAcceleratorTable(const wxAcceleratorTable& accel); | |
132 | ||
133 | // Responds to colour changes | |
134 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
135 | ||
136 | // Query app for menu item updates (called from OnIdle) | |
7c78e7c7 RR |
137 | void DoMenuUpdates(); |
138 | void DoMenuUpdates(wxMenu* menu); | |
139 | ||
01b2eeec KB |
140 | // Checks if there is a toolbar, and returns the first free client position |
141 | virtual wxPoint GetClientAreaOrigin() const; | |
142 | ||
143 | protected: | |
144 | wxMenuBar * m_frameMenuBar; | |
145 | wxStatusBar * m_frameStatusBar; | |
146 | wxIcon m_icon; | |
147 | bool m_iconized; | |
148 | static bool m_useNativeStatusBar; | |
149 | wxToolBar * m_frameToolBar ; | |
150 | wxAcceleratorTable m_acceleratorTable; | |
7c78e7c7 RR |
151 | |
152 | DECLARE_EVENT_TABLE() | |
153 | }; | |
154 | ||
01b2eeec KB |
155 | #endif |
156 | // _WX_FRAME_H_ |