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