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