]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7c0ea335 | 2 | // Name: wx/msw/frame.h |
0d53fc34 | 3 | // Purpose: wxFrame class |
2bda0e17 KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
371a5b4e | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_FRAME_H_ |
13 | #define _WX_FRAME_H_ | |
2bda0e17 | 14 | |
0d53fc34 | 15 | class WXDLLEXPORT wxFrame : public wxFrameBase |
3a19e16d | 16 | { |
2bda0e17 | 17 | public: |
7c0ea335 | 18 | // construction |
0d53fc34 VS |
19 | wxFrame() { Init(); } |
20 | wxFrame(wxWindow *parent, | |
08b97268 WS |
21 | wxWindowID id, |
22 | const wxString& title, | |
23 | const wxPoint& pos = wxDefaultPosition, | |
24 | const wxSize& size = wxDefaultSize, | |
25 | long style = wxDEFAULT_FRAME_STYLE, | |
26 | const wxString& name = wxFrameNameStr) | |
3a19e16d | 27 | { |
7c0ea335 VZ |
28 | Init(); |
29 | ||
3a19e16d VZ |
30 | Create(parent, id, title, pos, size, style, name); |
31 | } | |
16f6dfd8 | 32 | |
3a19e16d VZ |
33 | bool Create(wxWindow *parent, |
34 | wxWindowID id, | |
35 | const wxString& title, | |
36 | const wxPoint& pos = wxDefaultPosition, | |
37 | const wxSize& size = wxDefaultSize, | |
38 | long style = wxDEFAULT_FRAME_STYLE, | |
39 | const wxString& name = wxFrameNameStr); | |
16f6dfd8 | 40 | |
0d53fc34 | 41 | virtual ~wxFrame(); |
16f6dfd8 | 42 | |
7c0ea335 | 43 | // implement base class pure virtuals |
a2327a9f | 44 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); |
82c9f85c | 45 | virtual void Raise(); |
42e69d6b | 46 | |
7c0ea335 VZ |
47 | // implementation only from now on |
48 | // ------------------------------- | |
16f6dfd8 | 49 | |
7c0ea335 | 50 | // event handlers |
7c0ea335 | 51 | void OnSysColourChanged(wxSysColourChangedEvent& event); |
16f6dfd8 | 52 | |
3a19e16d | 53 | // Toolbar |
d427503c | 54 | #if wxUSE_TOOLBAR |
f9dae779 | 55 | virtual wxToolBar* CreateToolBar(long style = -1, |
cbe874bd | 56 | wxWindowID id = wxID_ANY, |
3a19e16d VZ |
57 | const wxString& name = wxToolBarNameStr); |
58 | ||
3a19e16d | 59 | virtual void PositionToolBar(); |
d427503c | 60 | #endif // wxUSE_TOOLBAR |
16f6dfd8 | 61 | |
3a19e16d | 62 | // Status bar |
7c0ea335 VZ |
63 | #if wxUSE_STATUSBAR |
64 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
65 | long style = wxST_SIZEGRIP, | |
66 | wxWindowID id = 0, | |
67 | const wxString& name = wxStatusLineNameStr); | |
3a19e16d VZ |
68 | |
69 | virtual void PositionStatusBar(); | |
16f6dfd8 | 70 | |
7c0ea335 VZ |
71 | // Hint to tell framework which status bar to use: the default is to use |
72 | // native one for the platforms which support it (Win32), the generic one | |
73 | // otherwise | |
16f6dfd8 | 74 | |
3a19e16d | 75 | // TODO: should this go into a wxFrameworkSettings class perhaps? |
7c0ea335 VZ |
76 | static void UseNativeStatusBar(bool useNative) |
77 | { m_useNativeStatusBar = useNative; }; | |
78 | static bool UsesNativeStatusBar() | |
79 | { return m_useNativeStatusBar; }; | |
d427503c | 80 | #endif // wxUSE_STATUSBAR |
16f6dfd8 | 81 | |
cf8ff92f | 82 | #if wxUSE_MENUS |
42e69d6b | 83 | WXHMENU GetWinMenu() const { return m_hMenu; } |
cf8ff92f | 84 | #endif // wxUSE_MENUS |
16f6dfd8 | 85 | |
7c0ea335 | 86 | // event handlers |
42e69d6b VZ |
87 | bool HandlePaint(); |
88 | bool HandleSize(int x, int y, WXUINT flag); | |
89 | bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
90 | bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); | |
ccef86c7 | 91 | bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); |
42e69d6b | 92 | |
7c0ea335 | 93 | // tooltip management |
3a19e16d | 94 | #if wxUSE_TOOLTIPS |
a23fd0e1 VZ |
95 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } |
96 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
3a19e16d VZ |
97 | #endif // tooltips |
98 | ||
3cfcd50b GT |
99 | // a MSW only function which sends a size event to the window using its |
100 | // current size - this has an effect of refreshing the window layout | |
a4f25aef | 101 | virtual void SendSizeEvent(); |
3cfcd50b | 102 | |
6c7afb74 | 103 | virtual wxPoint GetClientAreaOrigin() const; |
cbe874bd | 104 | |
2bda0e17 | 105 | protected: |
7c0ea335 VZ |
106 | // common part of all ctors |
107 | void Init(); | |
108 | ||
a23fd0e1 VZ |
109 | // override base class virtuals |
110 | virtual void DoGetClientSize(int *width, int *height) const; | |
a23fd0e1 | 111 | virtual void DoSetClientSize(int width, int height); |
cc2b7472 | 112 | |
1e6feb95 | 113 | #if wxUSE_MENUS_NATIVE |
6522713c VZ |
114 | // perform MSW-specific action when menubar is changed |
115 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
116 | ||
42e69d6b VZ |
117 | // a plug in for MDI frame classes which need to do something special when |
118 | // the menubar is set | |
119 | virtual void InternalSetMenuBar(); | |
1e6feb95 | 120 | #endif // wxUSE_MENUS_NATIVE |
42e69d6b | 121 | |
3a19e16d VZ |
122 | // propagate our state change to all child frames |
123 | void IconizeChildFrames(bool bIconize); | |
16f6dfd8 | 124 | |
42e69d6b VZ |
125 | // we add menu bar accel processing |
126 | bool MSWTranslateMessage(WXMSG* pMsg); | |
127 | ||
a23fd0e1 | 128 | // window proc for the frames |
c140b7e7 | 129 | WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
bf505d28 | 130 | |
92f1a59c JS |
131 | // handle WM_INITMENUPOPUP message |
132 | bool HandleInitMenuPopup(WXHMENU hMenu); | |
e39af974 | 133 | |
cbe874bd | 134 | virtual bool IsMDIChild() const { return false; } |
a23fd0e1 | 135 | |
77ffb593 | 136 | // get default (wxWidgets) icon for the frame |
82c9f85c | 137 | virtual WXHICON GetDefaultIcon() const; |
d427503c VZ |
138 | |
139 | #if wxUSE_STATUSBAR | |
3a19e16d | 140 | static bool m_useNativeStatusBar; |
d427503c VZ |
141 | #endif // wxUSE_STATUSBAR |
142 | ||
cf8ff92f VZ |
143 | #if wxUSE_MENUS |
144 | // frame menu, NULL if none | |
145 | WXHMENU m_hMenu; | |
146 | #endif // wxUSE_MENUS | |
147 | ||
a23fd0e1 | 148 | private: |
3a19e16d VZ |
149 | #if wxUSE_TOOLTIPS |
150 | WXHWND m_hwndToolTip; | |
151 | #endif // tooltips | |
152 | ||
9327c3aa VZ |
153 | // used by IconizeChildFrames(), see comments there |
154 | bool m_wasMinimized; | |
155 | ||
3a19e16d | 156 | DECLARE_EVENT_TABLE() |
fc7a2a60 | 157 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) |
2bda0e17 KB |
158 | }; |
159 | ||
160 | #endif | |
bbcdf8bc | 161 | // _WX_FRAME_H_ |