4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef _internettoolbar_h
22 #define _internettoolbar_h
24 static const int gBackCommandID
= 0xa121;
25 static const int gForwardCommandID
= 0xa122;
26 static const int gUpLevelCommandID
= 0xa022;
27 static const int gSearchCommandID
= 1003;
28 static const int gFoldersCommandID
= 1004;
29 static const int gMoveToCommandID
= 0x701f;
30 static const int gCopyToCommandID
= 0x701e;
31 static const int gDeleteCommandID
= 0x7011;
32 static const int gUndoCommandID
= 0x701b;
33 static const int gViewsCommandID
= 0x7031;
34 static const int gStopCommandID
= 1010;
35 static const int gRefreshCommandID
= 0xa220;
36 static const int gHomeCommandID
= 1012;
37 static const int gMapDriveCommandID
= 41089;
38 static const int gDisconnectCommandID
= 41090;
39 static const int gFavoritesCommandID
= 1015;
40 static const int gHistoryCommandID
= 1016;
41 static const int gFullScreenCommandID
= 1017;
42 static const int gPropertiesCommandID
= 0x7013;
43 static const int gCutCommandID
= 0x7018;
44 static const int gCopyCommandID
= 0x7019;
45 static const int gPasteCommandID
= 0x701a;
46 static const int gFolderOptionsCommandID
= 41251;
49 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
50 public IShellMenuCallback
53 CComPtr
<IShellMenu
> fFavoritesMenu
;
58 HRESULT STDMETHODCALLTYPE
GetObject(LPSMDATA psmd
, REFIID riid
, void **ppvObject
);
60 // *** IShellMenuCallback methods ***
61 virtual HRESULT STDMETHODCALLTYPE
CallbackSM(LPSMDATA psmd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
63 BEGIN_COM_MAP(CMenuCallback
)
64 COM_INTERFACE_ENTRY_IID(IID_IShellMenuCallback
, IShellMenuCallback
)
68 class CInternetToolbar
:
69 public CWindowImpl
<CInternetToolbar
, CWindow
, CControlWinTraits
>,
70 public CComCoClass
<CInternetToolbar
, &CLSID_InternetToolbar
>,
71 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
73 public IDockingWindow
,
74 public IPersistStreamInit
,
75 public IOleCommandTarget
,
77 public IExplorerToolbar
,
78 public IShellChangeNotify
,
79 public IObjectWithSite
,
80 public IServiceProvider
,
81 public IWinEventHandler
,
85 CComPtr
<IUnknown
> fSite
; // our site
86 HWND fMainReBar
; // rebar for top of window
87 bool fLocked
; // is bar locked to prevent changes?
88 CComPtr
<IShellMenu
> fMenuBar
; // the menu rebar
90 HWND fNavigationWindow
;
91 CComPtr
<IUnknown
> fLogoBar
; // the reactos logo
92 CComPtr
<IUnknown
> fControlsBar
; // navigation controls
93 CComPtr
<IUnknown
> fNavigationBar
; // address bar
94 CComObject
<CMenuCallback
> fMenuCallback
;
95 CComPtr
<IOleCommandTarget
> fCommandTarget
;
96 GUID fCommandCategory
;
99 CComPtr
<IBandProxy
> fBandProxy
;
103 void AddDockItem(IUnknown
*newItem
, int bandID
, int flags
);
104 HRESULT
ReserveBorderSpace();
105 HRESULT
CreateMenuBar(IShellMenu
**menuBar
);
106 HRESULT
CreateBrandBand(IUnknown
**logoBar
);
107 HRESULT
CreateToolsBar(IUnknown
**toolsBar
);
108 HRESULT
CreateAddressBand(IUnknown
**toolsBar
);
109 HRESULT
LockUnlockToolbars(bool locked
);
110 HRESULT
CommandStateChanged(bool newValue
, int commandID
);
111 HRESULT
CreateAndInitBandProxy();
113 // *** IInputObject specific methods ***
114 virtual HRESULT STDMETHODCALLTYPE
UIActivateIO(BOOL fActivate
, LPMSG lpMsg
);
115 virtual HRESULT STDMETHODCALLTYPE
HasFocusIO();
116 virtual HRESULT STDMETHODCALLTYPE
TranslateAcceleratorIO(LPMSG lpMsg
);
118 // *** IOleWindow methods ***
119 virtual HRESULT STDMETHODCALLTYPE
GetWindow(HWND
*lphwnd
);
120 virtual HRESULT STDMETHODCALLTYPE
ContextSensitiveHelp(BOOL fEnterMode
);
122 // *** IDockingWindow methods ***
123 virtual HRESULT STDMETHODCALLTYPE
ShowDW(BOOL fShow
);
124 virtual HRESULT STDMETHODCALLTYPE
CloseDW(DWORD dwReserved
);
125 virtual HRESULT STDMETHODCALLTYPE
ResizeBorderDW(LPCRECT prcBorder
, IUnknown
*punkToolbarSite
, BOOL fReserved
);
127 // *** IPersist methods ***
128 virtual HRESULT STDMETHODCALLTYPE
GetClassID(CLSID
*pClassID
);
130 // *** IPersistStreamInit methods ***
131 virtual HRESULT STDMETHODCALLTYPE
IsDirty();
132 virtual HRESULT STDMETHODCALLTYPE
Load(IStream
*pStm
);
133 virtual HRESULT STDMETHODCALLTYPE
Save(IStream
*pStm
, BOOL fClearDirty
);
134 virtual HRESULT STDMETHODCALLTYPE
GetSizeMax(ULARGE_INTEGER
*pcbSize
);
135 virtual HRESULT STDMETHODCALLTYPE
InitNew();
137 // *** IOleCommandTarget methods ***
138 virtual HRESULT STDMETHODCALLTYPE
QueryStatus(const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[ ], OLECMDTEXT
*pCmdText
);
139 virtual HRESULT STDMETHODCALLTYPE
Exec(const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
);
141 // *** IDispatch methods ***
142 virtual HRESULT STDMETHODCALLTYPE
GetTypeInfoCount(UINT
*pctinfo
);
143 virtual HRESULT STDMETHODCALLTYPE
GetTypeInfo(UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
);
144 virtual HRESULT STDMETHODCALLTYPE
GetIDsOfNames(REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
);
145 virtual HRESULT STDMETHODCALLTYPE
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
);
147 // *** IExplorerToolbar methods ***
148 virtual HRESULT STDMETHODCALLTYPE
SetCommandTarget(IUnknown
*theTarget
, GUID
*category
, long param14
);
149 virtual HRESULT STDMETHODCALLTYPE
Unknown1();
150 virtual HRESULT STDMETHODCALLTYPE
AddButtons(const GUID
*pguidCmdGroup
, long buttonCount
, TBBUTTON
*buttons
);
151 virtual HRESULT STDMETHODCALLTYPE
AddString(const GUID
*pguidCmdGroup
, HINSTANCE param10
, LPCTSTR param14
, long *param18
);
152 virtual HRESULT STDMETHODCALLTYPE
GetButton(const GUID
*pguidCmdGroup
, long param10
, long param14
);
153 virtual HRESULT STDMETHODCALLTYPE
GetState(const GUID
*pguidCmdGroup
, long commandID
, long *theState
);
154 virtual HRESULT STDMETHODCALLTYPE
SetState(const GUID
*pguidCmdGroup
, long commandID
, long theState
);
155 virtual HRESULT STDMETHODCALLTYPE
AddBitmap(const GUID
*pguidCmdGroup
, long param10
, long buttonCount
, TBADDBITMAP
*lParam
, long *newIndex
, COLORREF param20
);
156 virtual HRESULT STDMETHODCALLTYPE
GetBitmapSize(long *paramC
);
157 virtual HRESULT STDMETHODCALLTYPE
SendToolbarMsg(const GUID
*pguidCmdGroup
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*result
);
158 virtual HRESULT STDMETHODCALLTYPE
SetImageList(const GUID
*pguidCmdGroup
, HIMAGELIST param10
, HIMAGELIST param14
, HIMAGELIST param18
);
159 virtual HRESULT STDMETHODCALLTYPE
ModifyButton(const GUID
*pguidCmdGroup
, long param10
, long param14
);
161 // *** IShellChangeNotify methods ***
162 virtual HRESULT STDMETHODCALLTYPE
OnChange(LONG lEvent
, LPCITEMIDLIST pidl1
, LPCITEMIDLIST pidl2
);
164 // *** IObjectWithSite methods ***
165 virtual HRESULT STDMETHODCALLTYPE
SetSite(IUnknown
*pUnkSite
);
166 virtual HRESULT STDMETHODCALLTYPE
GetSite(REFIID riid
, void **ppvSite
);
168 // *** IServiceProvider methods ***
169 virtual HRESULT STDMETHODCALLTYPE
QueryService(REFGUID guidService
, REFIID riid
, void **ppvObject
);
171 // *** IWinEventHandler methods ***
172 virtual HRESULT STDMETHODCALLTYPE
OnWinEvent(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
);
173 virtual HRESULT STDMETHODCALLTYPE
IsWindowOwner(HWND hWnd
);
175 // *** IBandSite specific methods ***
176 virtual HRESULT STDMETHODCALLTYPE
AddBand(IUnknown
*punk
);
177 virtual HRESULT STDMETHODCALLTYPE
EnumBands(UINT uBand
, DWORD
*pdwBandID
);
178 virtual HRESULT STDMETHODCALLTYPE
QueryBand(DWORD dwBandID
, IDeskBand
**ppstb
, DWORD
*pdwState
, LPWSTR pszName
, int cchName
);
179 virtual HRESULT STDMETHODCALLTYPE
SetBandState(DWORD dwBandID
, DWORD dwMask
, DWORD dwState
);
180 virtual HRESULT STDMETHODCALLTYPE
RemoveBand(DWORD dwBandID
);
181 virtual HRESULT STDMETHODCALLTYPE
GetBandObject(DWORD dwBandID
, REFIID riid
, void **ppv
);
182 virtual HRESULT STDMETHODCALLTYPE
SetBandSiteInfo(const BANDSITEINFO
*pbsinfo
);
183 virtual HRESULT STDMETHODCALLTYPE
GetBandSiteInfo(BANDSITEINFO
*pbsinfo
);
186 LRESULT
OnTravelBack(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
&bHandled
);
187 LRESULT
OnTravelForward(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
&bHandled
);
188 LRESULT
OnUpLevel(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
&bHandled
);
189 LRESULT
OnSearch(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
&bHandled
);
190 LRESULT
OnFolders(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
&bHandled
);
191 LRESULT
OnForwardToCommandTarget(WORD wNotifyCode
, WORD wID
, HWND hWndCtl
, BOOL
&bHandled
);
192 LRESULT
OnMenuDropDown(UINT idControl
, NMHDR
*pNMHDR
, BOOL
&bHandled
);
193 LRESULT
OnQueryInsert(UINT idControl
, NMHDR
*pNMHDR
, BOOL
&bHandled
);
194 LRESULT
OnQueryDelete(UINT idControl
, NMHDR
*pNMHDR
, BOOL
&bHandled
);
195 LRESULT
OnNavigateCommand(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
&bHandled
);
196 LRESULT
OnContextMenu(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
&bHandled
);
197 LRESULT
OnSize(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
&bHandled
);
198 LRESULT
OnSetCursor(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
&bHandled
);
199 LRESULT
OnTipText(UINT idControl
, NMHDR
*pNMHDR
, BOOL
&bHandled
);
200 LRESULT
OnNotify(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, BOOL
&bHandled
);
202 BEGIN_MSG_MAP(CInternetToolbar
)
203 COMMAND_ID_HANDLER(gBackCommandID
, OnTravelBack
)
204 COMMAND_ID_HANDLER(gForwardCommandID
, OnTravelForward
)
205 COMMAND_ID_HANDLER(gUpLevelCommandID
, OnUpLevel
)
206 COMMAND_ID_HANDLER(gSearchCommandID
, OnSearch
)
207 COMMAND_ID_HANDLER(gFoldersCommandID
, OnFolders
)
208 COMMAND_RANGE_HANDLER(0x7000, 0x7fff, OnForwardToCommandTarget
)
209 NOTIFY_HANDLER(0, TBN_DROPDOWN
, OnMenuDropDown
)
210 NOTIFY_HANDLER(0, TBN_QUERYINSERT
, OnQueryInsert
)
211 NOTIFY_HANDLER(0, TBN_QUERYDELETE
, OnQueryDelete
)
212 MESSAGE_HANDLER(WM_COMMAND
, OnNavigateCommand
)
213 MESSAGE_HANDLER(WM_CONTEXTMENU
, OnContextMenu
)
214 MESSAGE_HANDLER(WM_SIZE
, OnSize
)
215 MESSAGE_HANDLER(WM_SETCURSOR
, OnSetCursor
)
216 NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW
, OnTipText
)
217 MESSAGE_HANDLER(WM_NOTIFY
, OnNotify
)
220 DECLARE_REGISTRY_RESOURCEID(IDR_INTERNETTOOLBAR
)
221 DECLARE_NOT_AGGREGATABLE(CInternetToolbar
)
223 DECLARE_PROTECT_FINAL_CONSTRUCT()
225 BEGIN_COM_MAP(CInternetToolbar
)
226 COM_INTERFACE_ENTRY_IID(IID_IInputObject
, IInputObject
)
227 COM_INTERFACE_ENTRY_IID(IID_IOleWindow
, IOleWindow
)
228 COM_INTERFACE_ENTRY_IID(IID_IDockingWindow
, IDockingWindow
)
229 COM_INTERFACE_ENTRY_IID(IID_IPersist
, IPersist
)
230 // COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
231 COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit
, IPersistStreamInit
)
232 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget
, IOleCommandTarget
)
233 COM_INTERFACE_ENTRY_IID(IID_IDispatch
, IDispatch
)
234 COM_INTERFACE_ENTRY_IID(IID_IExplorerToolbar
, IExplorerToolbar
)
235 COM_INTERFACE_ENTRY_IID(IID_IShellChangeNotify
, IShellChangeNotify
)
236 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite
, IObjectWithSite
)
237 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider
, IServiceProvider
)
238 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler
, IWinEventHandler
)
239 COM_INTERFACE_ENTRY_IID(IID_IBandSite
, IBandSite
)
243 #endif // _internettoolbar_h