simplified RTTI chain: wxFrame base class is now directly wxWindow, not wxFrameMSW
[wxWidgets.git] / include / wx / msw / frame.h
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 SetMenuBar(wxMenuBar *menubar);
54 virtual void SetIcon(const wxIcon& icon);
55 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
56 virtual bool IsFullScreen() const { return m_fsIsShowing; };
57
58 // implementation only from now on
59 // -------------------------------
60
61 // override some more virtuals
62 virtual bool Show(bool show = TRUE);
63
64 // event handlers
65 void OnActivate(wxActivateEvent& event);
66 void OnSysColourChanged(wxSysColourChangedEvent& event);
67
68 // Toolbar
69 #if wxUSE_TOOLBAR
70 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
71 wxWindowID id = -1,
72 const wxString& name = wxToolBarNameStr);
73
74 virtual void PositionToolBar();
75 #endif // wxUSE_TOOLBAR
76
77 // Status bar
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);
83
84 virtual void PositionStatusBar();
85
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
89
90 // TODO: should this go into a wxFrameworkSettings class perhaps?
91 static void UseNativeStatusBar(bool useNative)
92 { m_useNativeStatusBar = useNative; };
93 static bool UsesNativeStatusBar()
94 { return m_useNativeStatusBar; };
95 #endif // wxUSE_STATUSBAR
96
97 WXHMENU GetWinMenu() const { return m_hMenu; }
98
99 // event handlers
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
105 bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass,
106 wxWindow *wx_win, const wxChar *title,
107 int x, int y, int width, int height, long style);
108
109 // tooltip management
110 #if wxUSE_TOOLTIPS
111 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
112 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
113 #endif // tooltips
114
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
119 // called by wxWindow whenever it gets focus
120 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
121 wxWindow *GetLastFocus() const { return m_winLastFocused; }
122
123 protected:
124 // common part of all ctors
125 void Init();
126
127 // common part of Iconize(), Maximize() and Restore()
128 void DoShowWindow(int nShowCmd);
129
130 // override base class virtuals
131 virtual void DoGetClientSize(int *width, int *height) const;
132 virtual void DoGetSize(int *width, int *height) const;
133 virtual void DoGetPosition(int *x, int *y) const;
134
135 virtual void DoSetClientSize(int width, int height);
136
137 // helper
138 void DetachMenuBar();
139
140 #if wxUSE_MENUS_NATIVE
141 // a plug in for MDI frame classes which need to do something special when
142 // the menubar is set
143 virtual void InternalSetMenuBar();
144 #endif // wxUSE_MENUS_NATIVE
145
146 // propagate our state change to all child frames
147 void IconizeChildFrames(bool bIconize);
148
149 // we add menu bar accel processing
150 bool MSWTranslateMessage(WXMSG* pMsg);
151
152 // window proc for the frames
153 long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
154
155 virtual bool IsMDIChild() const { return FALSE; }
156
157 // is the frame currently iconized?
158 bool m_iconized;
159
160 // should the frame be maximized when it will be shown? set by Maximize()
161 // when it is called while the frame is hidden
162 bool m_maximizeOnShow;
163
164 WXHICON m_defaultIcon;
165
166 #if wxUSE_STATUSBAR
167 static bool m_useNativeStatusBar;
168 #endif // wxUSE_STATUSBAR
169
170 // the last focused child: we restore focus to it on activation
171 wxWindow *m_winLastFocused;
172
173 // Data to save/restore when calling ShowFullScreen
174 long m_fsStyle; // Passed to ShowFullScreen
175 wxRect m_fsOldSize;
176 long m_fsOldWindowStyle;
177 int m_fsStatusBarFields; // 0 for no status bar
178 int m_fsStatusBarHeight;
179 int m_fsToolBarHeight;
180 // WXHMENU m_fsMenu;
181 bool m_fsIsMaximized;
182 bool m_fsIsShowing;
183
184 private:
185 #if wxUSE_TOOLTIPS
186 WXHWND m_hwndToolTip;
187 #endif // tooltips
188
189 DECLARE_EVENT_TABLE()
190 };
191
192 #endif
193 // _WX_FRAME_H_