mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 04:14:53 +00:00
[BROWSEUI] Implement toggling the folders and search band with the toolbar and make their buttons appear pressed when they are shown.
CBaseBarSite: Ask the CBaseBar to close itself when the x button is pressed. CBaseBar: Hide the bar and inform its site that it is closing when it gets the close command. CShellBrowser: Cache the guid of the current vertical bar and use it to report correct command status to the toolbar. Also implement toggling the Folders, Favorites, History and search commands. CInternetToolbar: Query the Folders and Search command status from the site so that they can be properly be shown as pressed.
This commit is contained in:
parent
84ae36c78d
commit
a0c5cafce5
5 changed files with 103 additions and 14 deletions
|
@ -692,17 +692,10 @@ LRESULT CBaseBarSite::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bH
|
||||||
|
|
||||||
LRESULT CBaseBarSite::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
LRESULT CBaseBarSite::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
HRESULT hResult;
|
|
||||||
CComPtr<IDockingWindow> parentSite;
|
|
||||||
|
|
||||||
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDM_BASEBAR_CLOSE)
|
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDM_BASEBAR_CLOSE)
|
||||||
{
|
{
|
||||||
hResult = fDeskBarSite->QueryInterface(IID_PPV_ARG(IDockingWindow, &parentSite));
|
/* Tell the base bar to hide */
|
||||||
if (!SUCCEEDED(hResult))
|
IUnknown_Exec(fDeskBarSite, IID_IDeskBarClient, 0, 0, NULL, NULL);
|
||||||
{
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
parentSite->ShowDW(FALSE);
|
|
||||||
bHandled = TRUE;
|
bHandled = TRUE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -749,6 +749,16 @@ HRESULT CInternetToolbar::LockUnlockToolbars(bool locked)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CInternetToolbar::SetState(const GUID *pguidCmdGroup, long commandID, OLECMD* pcmd)
|
||||||
|
{
|
||||||
|
long state = 0;
|
||||||
|
if (pcmd->cmdf & OLECMDF_ENABLED)
|
||||||
|
state |= TBSTATE_ENABLED;
|
||||||
|
if (pcmd->cmdf & OLECMDF_LATCHED)
|
||||||
|
state |= TBSTATE_CHECKED;
|
||||||
|
return SetState(pguidCmdGroup, commandID, state);
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT CInternetToolbar::CommandStateChanged(bool newValue, int commandID)
|
HRESULT CInternetToolbar::CommandStateChanged(bool newValue, int commandID)
|
||||||
{
|
{
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
@ -762,6 +772,18 @@ HRESULT CInternetToolbar::CommandStateChanged(bool newValue, int commandID)
|
||||||
// if up, QueryStatus for up state and update it
|
// if up, QueryStatus for up state and update it
|
||||||
//
|
//
|
||||||
//for buttons in fCommandCategory, update with QueryStatus of fCommandTarget
|
//for buttons in fCommandCategory, update with QueryStatus of fCommandTarget
|
||||||
|
|
||||||
|
OLECMD commandList[4];
|
||||||
|
commandList[0].cmdID = 0x1c;
|
||||||
|
commandList[1].cmdID = 0x1d;
|
||||||
|
commandList[2].cmdID = 0x1e;
|
||||||
|
commandList[3].cmdID = 0x23;
|
||||||
|
IUnknown_QueryStatus(fSite, CGID_Explorer, 4, commandList, NULL);
|
||||||
|
SetState(&CLSID_CommonButtons, gSearchCommandID, &commandList[0]);
|
||||||
|
SetState(&CLSID_CommonButtons, gFoldersCommandID, &commandList[3]);
|
||||||
|
//SetState(&CLSID_CommonButtons, gFavoritesCommandID, &commandList[2]);
|
||||||
|
//SetState(&CLSID_CommonButtons, gHistoryCommandID, &commandList[1]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// forward
|
// forward
|
||||||
|
@ -1504,7 +1526,13 @@ LRESULT CInternetToolbar::OnUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
|
||||||
|
|
||||||
LRESULT CInternetToolbar::OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
LRESULT CInternetToolbar::OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
return IUnknown_Exec(fSite, CLSID_CommonButtons, 0x123, 1, NULL, NULL);
|
OLECMD cmd;
|
||||||
|
cmd.cmdID = 0x1c;
|
||||||
|
IUnknown_QueryStatus(fSite, CGID_Explorer, 1, &cmd, NULL);
|
||||||
|
if (cmd.cmdf & OLECMDF_LATCHED)
|
||||||
|
return IUnknown_Exec(fSite, CGID_Explorer, 0x1c, 1, NULL, NULL);
|
||||||
|
else
|
||||||
|
return IUnknown_Exec(fSite, CLSID_CommonButtons, 0x123, 1, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CInternetToolbar::OnFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
LRESULT CInternetToolbar::OnFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||||
|
|
|
@ -104,6 +104,7 @@ public:
|
||||||
HRESULT CreateAndInitBandProxy();
|
HRESULT CreateAndInitBandProxy();
|
||||||
HRESULT IsBandVisible(int BandID);
|
HRESULT IsBandVisible(int BandID);
|
||||||
HRESULT ToggleBandVisibility(int BandID);
|
HRESULT ToggleBandVisibility(int BandID);
|
||||||
|
HRESULT SetState(const GUID *pguidCmdGroup, long commandID, OLECMD* pcmd);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// *** IInputObject specific methods ***
|
// *** IInputObject specific methods ***
|
||||||
|
|
|
@ -261,8 +261,17 @@ HRESULT STDMETHODCALLTYPE CBaseBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID
|
||||||
switch (nCmdID)
|
switch (nCmdID)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
{
|
||||||
// hide current band
|
// hide current band
|
||||||
|
ShowDW(0);
|
||||||
|
|
||||||
|
// Inform our site that we closed
|
||||||
|
VARIANT var;
|
||||||
|
V_VT(&var) = VT_UNKNOWN;
|
||||||
|
V_UNKNOWN(&var) = static_cast<IDeskBar *>(this);
|
||||||
|
IUnknown_Exec(fSite, CGID_Explorer, 0x22, 0, &var, NULL);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
// switch bands
|
// switch bands
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -299,6 +299,7 @@ private:
|
||||||
CComPtr<ITravelLog> fTravelLog;
|
CComPtr<ITravelLog> fTravelLog;
|
||||||
HMENU fCurrentMenuBar;
|
HMENU fCurrentMenuBar;
|
||||||
CABINETSTATE fCabinetState;
|
CABINETSTATE fCabinetState;
|
||||||
|
GUID fCurrentVertBar; //The guid of the built in vertical bar that is being shown
|
||||||
// The next three fields support persisted history for shell views.
|
// The next three fields support persisted history for shell views.
|
||||||
// They do not need to be reference counted.
|
// They do not need to be reference counted.
|
||||||
IOleObject *fHistoryObject;
|
IOleObject *fHistoryObject;
|
||||||
|
@ -1276,6 +1277,12 @@ HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
|
if (vertical)
|
||||||
|
{
|
||||||
|
fCurrentVertBar = classID;
|
||||||
|
FireCommandStateChangeAll();
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1939,15 +1946,28 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatus(const GUID *pguidCmdGroup,
|
||||||
{
|
{
|
||||||
case 0x1c: // search
|
case 0x1c: // search
|
||||||
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
||||||
|
if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
|
||||||
|
IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
|
||||||
|
IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
|
||||||
|
IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
|
||||||
|
{
|
||||||
|
prgCmds->cmdf |= OLECMDF_LATCHED;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0x1d: // history
|
case 0x1d: // history
|
||||||
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
||||||
|
if (IsEqualCLSID(CLSID_SH_HistBand, fCurrentVertBar))
|
||||||
|
prgCmds->cmdf |= OLECMDF_LATCHED;
|
||||||
break;
|
break;
|
||||||
case 0x1e: // favorites
|
case 0x1e: // favorites
|
||||||
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
||||||
|
if (IsEqualCLSID(CLSID_SH_FavBand, fCurrentVertBar))
|
||||||
|
prgCmds->cmdf |= OLECMDF_LATCHED;
|
||||||
break;
|
break;
|
||||||
case 0x23: // folders
|
case 0x23: // folders
|
||||||
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED | OLECMDF_LATCHED;
|
prgCmds->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
|
||||||
|
if (IsEqualCLSID(CLSID_ExplorerBand, fCurrentVertBar))
|
||||||
|
prgCmds->cmdf |= OLECMDF_LATCHED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
prgCmds->cmdf = 0;
|
prgCmds->cmdf = 0;
|
||||||
|
@ -1990,8 +2010,46 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::Exec(const GUID *pguidCmdGroup, DWORD n
|
||||||
{
|
{
|
||||||
switch (nCmdID)
|
switch (nCmdID)
|
||||||
{
|
{
|
||||||
case 0x23:
|
case 0x1c: //Toggle Search
|
||||||
hResult = ShowBand(CLSID_ExplorerBand, true);
|
if (IsEqualCLSID(CLSID_SH_SearchBand, fCurrentVertBar) ||
|
||||||
|
IsEqualCLSID(CLSID_SearchBand, fCurrentVertBar) ||
|
||||||
|
IsEqualCLSID(CLSID_IE_SearchBand, fCurrentVertBar) ||
|
||||||
|
IsEqualCLSID(CLSID_FileSearchBand, fCurrentVertBar))
|
||||||
|
{
|
||||||
|
hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
|
||||||
|
memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
|
||||||
|
FireCommandStateChangeAll();
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
case 0x1d: //Toggle History
|
||||||
|
case 0x1e: //Toggle Favorites
|
||||||
|
case 0x23: //Toggle Folders
|
||||||
|
const GUID* pclsid;
|
||||||
|
if (nCmdID == 0x1d) pclsid = &CLSID_SH_HistBand;
|
||||||
|
else if (nCmdID == 0x1e) pclsid = &CLSID_SH_FavBand;
|
||||||
|
else pclsid = &CLSID_ExplorerBand;
|
||||||
|
|
||||||
|
if (IsEqualCLSID(*pclsid, fCurrentVertBar))
|
||||||
|
{
|
||||||
|
hResult = IUnknown_ShowDW(fClientBars[BIVerticalBaseBar].clientBar.p, FALSE);
|
||||||
|
memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
|
||||||
|
FireCommandStateChangeAll();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hResult = ShowBand(*pclsid, true);
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
case 0x22:
|
||||||
|
//Sent when a band closes
|
||||||
|
if (V_VT(pvaIn) != VT_UNKNOWN)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (IUnknownIsEqual(V_UNKNOWN(pvaIn), fClientBars[BIVerticalBaseBar].clientBar.p))
|
||||||
|
{
|
||||||
|
memset(&fCurrentVertBar, 0, sizeof(fCurrentVertBar));
|
||||||
|
FireCommandStateChangeAll();
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
case 0x27:
|
case 0x27:
|
||||||
if (nCmdexecopt == 1)
|
if (nCmdexecopt == 1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue