]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/frame.h
Fix showing MDI child from wxDocManager::ActivateDocument().
[wxWidgets.git] / include / wx / msw / frame.h
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 WXDLLIMPEXP_CORE 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
46 // implementation only from now on
47 // -------------------------------
48
49 // event handlers
50 void OnSysColourChanged(wxSysColourChangedEvent& event);
51
52 // Toolbar
53 #if wxUSE_TOOLBAR
54 virtual wxToolBar* CreateToolBar(long style = -1,
55 wxWindowID id = wxID_ANY,
56 const wxString& name = wxToolBarNameStr);
57 #endif // wxUSE_TOOLBAR
58
59 // Status bar
60 #if wxUSE_STATUSBAR
61 virtual wxStatusBar* OnCreateStatusBar(int number = 1,
62 long style = wxSTB_DEFAULT_STYLE,
63 wxWindowID id = 0,
64 const wxString& name = wxStatusLineNameStr);
65
66 // Hint to tell framework which status bar to use: the default is to use
67 // native one for the platforms which support it (Win32), the generic one
68 // otherwise
69
70 // TODO: should this go into a wxFrameworkSettings class perhaps?
71 static void UseNativeStatusBar(bool useNative)
72 { m_useNativeStatusBar = useNative; }
73 static bool UsesNativeStatusBar()
74 { return m_useNativeStatusBar; }
75 #endif // wxUSE_STATUSBAR
76
77 // event handlers
78 bool HandleSize(int x, int y, WXUINT flag);
79 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
80 bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
81
82 // tooltip management
83 #if wxUSE_TOOLTIPS
84 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
85 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
86 #endif // tooltips
87
88 // override the base class function to handle iconized/maximized frames
89 virtual void SendSizeEvent(int flags = 0);
90
91 virtual wxPoint GetClientAreaOrigin() const;
92
93 // override base class version to add menu bar accel processing
94 virtual bool MSWTranslateMessage(WXMSG *msg)
95 {
96 return MSWDoTranslateMessage(this, msg);
97 }
98
99 // window proc for the frames
100 virtual WXLRESULT MSWWindowProc(WXUINT message,
101 WXWPARAM wParam,
102 WXLPARAM lParam);
103
104 #if wxUSE_MENUS
105 // get the currently active menu: this is the same as the frame menu for
106 // normal frames but is overridden by wxMDIParentFrame
107 virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; }
108 #endif // wxUSE_MENUS
109
110 protected:
111 // common part of all ctors
112 void Init();
113
114 // override base class virtuals
115 virtual void DoGetClientSize(int *width, int *height) const;
116 virtual void DoSetClientSize(int width, int height);
117
118 #if wxUSE_MENUS_NATIVE
119 // perform MSW-specific action when menubar is changed
120 virtual void AttachMenuBar(wxMenuBar *menubar);
121
122 // a plug in for MDI frame classes which need to do something special when
123 // the menubar is set
124 virtual void InternalSetMenuBar();
125 #endif // wxUSE_MENUS_NATIVE
126
127 // propagate our state change to all child frames
128 void IconizeChildFrames(bool bIconize);
129
130 // the real implementation of MSWTranslateMessage(), also used by
131 // wxMDIChildFrame
132 bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg);
133
134 #if wxUSE_MENUS
135 // handle WM_EXITMENULOOP message for Win95 only
136 bool HandleExitMenuLoop(WXWORD isPopup);
137
138 // handle WM_(UN)INITMENUPOPUP message to generate wxEVT_MENU_OPEN/CLOSE
139 bool HandleMenuPopup(wxEventType evtType, WXHMENU hMenu);
140
141 // Command part of HandleMenuPopup() and HandleExitMenuLoop().
142 bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup);
143 #endif // wxUSE_MENUS
144
145
146 virtual bool IsMDIChild() const { return false; }
147
148 // get default (wxWidgets) icon for the frame
149 virtual WXHICON GetDefaultIcon() const;
150
151 #if wxUSE_TOOLBAR
152 virtual void PositionToolBar();
153 #endif // wxUSE_TOOLBAR
154
155 #if wxUSE_STATUSBAR
156 virtual void PositionStatusBar();
157
158 static bool m_useNativeStatusBar;
159 #endif // wxUSE_STATUSBAR
160
161 #if wxUSE_MENUS
162 // frame menu, NULL if none
163 WXHMENU m_hMenu;
164 #endif // wxUSE_MENUS
165
166 private:
167 #if wxUSE_TOOLTIPS
168 WXHWND m_hwndToolTip;
169 #endif // tooltips
170
171 // used by IconizeChildFrames(), see comments there
172 bool m_wasMinimized;
173
174 DECLARE_EVENT_TABLE()
175 DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame)
176 };
177
178 #endif
179 // _WX_FRAME_H_