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