]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/msw/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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FRAME_H_ | |
13 | #define _WX_FRAME_H_ | |
14 | ||
15 | class WXDLLEXPORT wxFrame : public wxFrameBase | |
16 | { | |
17 | public: | |
18 | // construction | |
19 | wxFrame() { Init(); } | |
20 | wxFrame(wxWindow *parent, | |
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) | |
27 | { | |
28 | Init(); | |
29 | ||
30 | Create(parent, id, title, pos, size, style, name); | |
31 | } | |
32 | ||
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); | |
40 | ||
41 | virtual ~wxFrame(); | |
42 | ||
43 | // implement base class pure virtuals | |
44 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
45 | virtual void Raise(); | |
46 | ||
47 | // implementation only from now on | |
48 | // ------------------------------- | |
49 | ||
50 | // event handlers | |
51 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
52 | ||
53 | // Toolbar | |
54 | #if wxUSE_TOOLBAR | |
55 | virtual wxToolBar* CreateToolBar(long style = -1, | |
56 | wxWindowID id = wxID_ANY, | |
57 | const wxString& name = wxToolBarNameStr); | |
58 | ||
59 | virtual void PositionToolBar(); | |
60 | #endif // wxUSE_TOOLBAR | |
61 | ||
62 | // Status bar | |
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); | |
68 | ||
69 | virtual void PositionStatusBar(); | |
70 | ||
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 | |
74 | ||
75 | // TODO: should this go into a wxFrameworkSettings class perhaps? | |
76 | static void UseNativeStatusBar(bool useNative) | |
77 | { m_useNativeStatusBar = useNative; }; | |
78 | static bool UsesNativeStatusBar() | |
79 | { return m_useNativeStatusBar; }; | |
80 | #endif // wxUSE_STATUSBAR | |
81 | ||
82 | #if wxUSE_MENUS | |
83 | WXHMENU GetWinMenu() const { return m_hMenu; } | |
84 | #endif // wxUSE_MENUS | |
85 | ||
86 | // event handlers | |
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); | |
91 | bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); | |
92 | ||
93 | // tooltip management | |
94 | #if wxUSE_TOOLTIPS | |
95 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } | |
96 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
97 | #endif // tooltips | |
98 | ||
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 | |
101 | virtual void SendSizeEvent(); | |
102 | ||
103 | virtual wxPoint GetClientAreaOrigin() const; | |
104 | ||
105 | protected: | |
106 | // common part of all ctors | |
107 | void Init(); | |
108 | ||
109 | // override base class virtuals | |
110 | virtual void DoGetClientSize(int *width, int *height) const; | |
111 | virtual void DoSetClientSize(int width, int height); | |
112 | ||
113 | #if wxUSE_MENUS_NATIVE | |
114 | // perform MSW-specific action when menubar is changed | |
115 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
116 | ||
117 | // a plug in for MDI frame classes which need to do something special when | |
118 | // the menubar is set | |
119 | virtual void InternalSetMenuBar(); | |
120 | #endif // wxUSE_MENUS_NATIVE | |
121 | ||
122 | // propagate our state change to all child frames | |
123 | void IconizeChildFrames(bool bIconize); | |
124 | ||
125 | // override base class version to add menu bar accel processing | |
126 | virtual bool MSWTranslateMessage(WXMSG *msg) | |
127 | { | |
128 | return MSWDoTranslateMessage(this, msg); | |
129 | } | |
130 | ||
131 | // the real implementation of MSWTranslateMessage(), also used by | |
132 | // wxMDIChildFrame | |
133 | bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg); | |
134 | ||
135 | // window proc for the frames | |
136 | virtual WXLRESULT MSWWindowProc(WXUINT message, | |
137 | WXWPARAM wParam, | |
138 | WXLPARAM lParam); | |
139 | ||
140 | // handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN | |
141 | bool HandleInitMenuPopup(WXHMENU hMenu); | |
142 | ||
143 | virtual bool IsMDIChild() const { return false; } | |
144 | ||
145 | // get default (wxWidgets) icon for the frame | |
146 | virtual WXHICON GetDefaultIcon() const; | |
147 | ||
148 | #if wxUSE_STATUSBAR | |
149 | static bool m_useNativeStatusBar; | |
150 | #endif // wxUSE_STATUSBAR | |
151 | ||
152 | #if wxUSE_MENUS | |
153 | // frame menu, NULL if none | |
154 | WXHMENU m_hMenu; | |
155 | #endif // wxUSE_MENUS | |
156 | ||
157 | private: | |
158 | #if wxUSE_TOOLTIPS | |
159 | WXHWND m_hwndToolTip; | |
160 | #endif // tooltips | |
161 | ||
162 | // used by IconizeChildFrames(), see comments there | |
163 | bool m_wasMinimized; | |
164 | ||
165 | DECLARE_EVENT_TABLE() | |
166 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) | |
167 | }; | |
168 | ||
169 | #endif | |
170 | // _WX_FRAME_H_ |