]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7c0ea335 | 2 | // Name: wx/msw/frame.h |
2bda0e17 KB |
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 | |
16f6dfd8 | 9 | // Licence: wxWindows license |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_FRAME_H_ |
13 | #define _WX_FRAME_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
42e69d6b | 16 | #pragma interface "frame.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
7c0ea335 | 19 | class WXDLLEXPORT wxFrame : public wxFrameBase |
3a19e16d | 20 | { |
2bda0e17 | 21 | public: |
7c0ea335 VZ |
22 | // construction |
23 | wxFrame() { Init(); } | |
3a19e16d | 24 | wxFrame(wxWindow *parent, |
7c0ea335 VZ |
25 | wxWindowID id, |
26 | const wxString& title, | |
27 | const wxPoint& pos = wxDefaultPosition, | |
28 | const wxSize& size = wxDefaultSize, | |
29 | long style = wxDEFAULT_FRAME_STYLE, | |
30 | const wxString& name = wxFrameNameStr) | |
3a19e16d | 31 | { |
7c0ea335 VZ |
32 | Init(); |
33 | ||
3a19e16d VZ |
34 | Create(parent, id, title, pos, size, style, name); |
35 | } | |
16f6dfd8 | 36 | |
3a19e16d VZ |
37 | bool Create(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); | |
16f6dfd8 | 44 | |
7c0ea335 | 45 | virtual ~wxFrame(); |
16f6dfd8 | 46 | |
7c0ea335 VZ |
47 | // implement base class pure virtuals |
48 | virtual void Maximize(bool maximize = TRUE); | |
49 | virtual bool IsMaximized() const; | |
50 | virtual void Iconize(bool iconize = TRUE); | |
51 | virtual bool IsIconized() const; | |
52 | virtual void Restore(); | |
53 | virtual void SetMenuBar(wxMenuBar *menubar); | |
54 | virtual void SetIcon(const wxIcon& icon); | |
a2327a9f JS |
55 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); |
56 | virtual bool IsFullScreen() const { return m_fsIsShowing; }; | |
42e69d6b | 57 | |
7c0ea335 VZ |
58 | // implementation only from now on |
59 | // ------------------------------- | |
16f6dfd8 | 60 | |
7c0ea335 VZ |
61 | // override some more virtuals |
62 | virtual bool Show(bool show = TRUE); | |
b5423899 | 63 | |
7c0ea335 VZ |
64 | // event handlers |
65 | void OnActivate(wxActivateEvent& event); | |
66 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
16f6dfd8 | 67 | |
3a19e16d | 68 | // Toolbar |
d427503c | 69 | #if wxUSE_TOOLBAR |
3a19e16d VZ |
70 | virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, |
71 | wxWindowID id = -1, | |
72 | const wxString& name = wxToolBarNameStr); | |
73 | ||
3a19e16d | 74 | virtual void PositionToolBar(); |
d427503c | 75 | #endif // wxUSE_TOOLBAR |
16f6dfd8 | 76 | |
3a19e16d | 77 | // Status bar |
7c0ea335 VZ |
78 | #if wxUSE_STATUSBAR |
79 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
80 | long style = wxST_SIZEGRIP, | |
81 | wxWindowID id = 0, | |
82 | const wxString& name = wxStatusLineNameStr); | |
3a19e16d VZ |
83 | |
84 | virtual void PositionStatusBar(); | |
16f6dfd8 | 85 | |
7c0ea335 VZ |
86 | // Hint to tell framework which status bar to use: the default is to use |
87 | // native one for the platforms which support it (Win32), the generic one | |
88 | // otherwise | |
16f6dfd8 | 89 | |
3a19e16d | 90 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
7c0ea335 VZ |
91 | static void UseNativeStatusBar(bool useNative) |
92 | { m_useNativeStatusBar = useNative; }; | |
93 | static bool UsesNativeStatusBar() | |
94 | { return m_useNativeStatusBar; }; | |
d427503c | 95 | #endif // wxUSE_STATUSBAR |
16f6dfd8 | 96 | |
42e69d6b | 97 | WXHMENU GetWinMenu() const { return m_hMenu; } |
16f6dfd8 | 98 | |
7c0ea335 | 99 | // event handlers |
42e69d6b VZ |
100 | bool HandlePaint(); |
101 | bool HandleSize(int x, int y, WXUINT flag); | |
102 | bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
103 | bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); | |
104 | ||
9df8c2df OK |
105 | bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass, |
106 | wxWindow *wx_win, const wxChar *title, | |
debe6624 | 107 | int x, int y, int width, int height, long style); |
2bda0e17 | 108 | |
7c0ea335 | 109 | // tooltip management |
3a19e16d | 110 | #if wxUSE_TOOLTIPS |
a23fd0e1 VZ |
111 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } |
112 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
3a19e16d VZ |
113 | #endif // tooltips |
114 | ||
3cfcd50b GT |
115 | // a MSW only function which sends a size event to the window using its |
116 | // current size - this has an effect of refreshing the window layout | |
117 | void SendSizeEvent(); | |
118 | ||
2bda0e17 | 119 | protected: |
7c0ea335 VZ |
120 | // common part of all ctors |
121 | void Init(); | |
122 | ||
123 | // common part of Iconize(), Maximize() and Restore() | |
124 | void DoShowWindow(int nShowCmd); | |
125 | ||
a23fd0e1 VZ |
126 | // override base class virtuals |
127 | virtual void DoGetClientSize(int *width, int *height) const; | |
42e69d6b VZ |
128 | virtual void DoGetSize(int *width, int *height) const; |
129 | virtual void DoGetPosition(int *x, int *y) const; | |
a23fd0e1 | 130 | |
a23fd0e1 | 131 | virtual void DoSetClientSize(int width, int height); |
cc2b7472 | 132 | |
7c0ea335 VZ |
133 | // helper |
134 | void DetachMenuBar(); | |
135 | ||
42e69d6b VZ |
136 | // a plug in for MDI frame classes which need to do something special when |
137 | // the menubar is set | |
138 | virtual void InternalSetMenuBar(); | |
139 | ||
3a19e16d VZ |
140 | // propagate our state change to all child frames |
141 | void IconizeChildFrames(bool bIconize); | |
16f6dfd8 | 142 | |
42e69d6b VZ |
143 | // we add menu bar accel processing |
144 | bool MSWTranslateMessage(WXMSG* pMsg); | |
145 | ||
a23fd0e1 VZ |
146 | // window proc for the frames |
147 | long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
91dd52fe VS |
148 | |
149 | virtual bool IsMDIChild() const { return FALSE; } | |
a23fd0e1 | 150 | |
3a19e16d VZ |
151 | bool m_iconized; |
152 | WXHICON m_defaultIcon; | |
d427503c VZ |
153 | |
154 | #if wxUSE_STATUSBAR | |
3a19e16d | 155 | static bool m_useNativeStatusBar; |
d427503c VZ |
156 | #endif // wxUSE_STATUSBAR |
157 | ||
f6bcfd97 BP |
158 | // the last focused child: we restore focus to it on activation |
159 | wxWindow *m_winLastFocused; | |
160 | ||
a2327a9f JS |
161 | // Data to save/restore when calling ShowFullScreen |
162 | long m_fsStyle; // Passed to ShowFullScreen | |
163 | wxRect m_fsOldSize; | |
164 | long m_fsOldWindowStyle; | |
165 | int m_fsStatusBarFields; // 0 for no status bar | |
166 | int m_fsStatusBarHeight; | |
167 | int m_fsToolBarHeight; | |
168 | // WXHMENU m_fsMenu; | |
169 | bool m_fsIsMaximized; | |
170 | bool m_fsIsShowing; | |
171 | ||
a23fd0e1 | 172 | private: |
3a19e16d VZ |
173 | #if wxUSE_TOOLTIPS |
174 | WXHWND m_hwndToolTip; | |
175 | #endif // tooltips | |
176 | ||
3a19e16d | 177 | DECLARE_EVENT_TABLE() |
7c0ea335 | 178 | DECLARE_DYNAMIC_CLASS(wxFrame) |
2bda0e17 KB |
179 | }; |
180 | ||
181 | #endif | |
bbcdf8bc | 182 | // _WX_FRAME_H_ |