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