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