mirror of
https://github.com/reactos/reactos.git
synced 2024-07-13 08:05:12 +00:00
[BROWSEUI]
- Implement showing and hiding the Go button. Patch by Barrett Karish. CORE-10154 svn path=/trunk/; revision=69473
This commit is contained in:
parent
89c70e0fde
commit
29fb77c656
|
@ -23,6 +23,7 @@ HKCR,"CLSID\%CLSID_Internet%\Shell\OpenHomePage\Command",,,"""%16422%\Internet E
|
||||||
HKCR,"CLSID\%CLSID_Internet%\ShellFolder",,2,"0x24"
|
HKCR,"CLSID\%CLSID_Internet%\ShellFolder",,2,"0x24"
|
||||||
|
|
||||||
[Settings.Reg]
|
[Settings.Reg]
|
||||||
|
HKCU,"Software\Microsoft\Internet Explorer\Main","ShowGoButton",2,"yes"
|
||||||
#HKCU,"Software\Microsoft\Internet Explorer\Main","Start Page",2,"http://www.winehq.org"
|
#HKCU,"Software\Microsoft\Internet Explorer\Main","Start Page",2,"http://www.winehq.org"
|
||||||
HKCU,"Software\Microsoft\Internet Explorer\Main","Start Page",2,"http://www.reactos.org"
|
HKCU,"Software\Microsoft\Internet Explorer\Main","Start Page",2,"http://www.reactos.org"
|
||||||
HKCU,"Software\Microsoft\Internet Explorer\Main","Search Page",2,"http://www.google.com"
|
HKCU,"Software\Microsoft\Internet Explorer\Main","Search Page",2,"http://www.google.com"
|
||||||
|
|
|
@ -34,8 +34,6 @@ TODO:
|
||||||
****Add command handler for show/hide Go button to OnWinEvent
|
****Add command handler for show/hide Go button to OnWinEvent
|
||||||
****Add tooltip notify handler
|
****Add tooltip notify handler
|
||||||
**Properly implement GetBandInfo
|
**Properly implement GetBandInfo
|
||||||
**Add support for showing/hiding Go button
|
|
||||||
**Fix so Go button will be shown/hidden properly on load
|
|
||||||
**Add correct text to Go button
|
**Add correct text to Go button
|
||||||
**Implement TranslateAcceleratorIO
|
**Implement TranslateAcceleratorIO
|
||||||
Implement Exec
|
Implement Exec
|
||||||
|
@ -112,6 +110,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
HWND parentWindow;
|
HWND parentWindow;
|
||||||
HWND combobox;
|
HWND combobox;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
IImageList *piml;
|
||||||
|
|
||||||
if (pUnkSite == NULL)
|
if (pUnkSite == NULL)
|
||||||
{
|
{
|
||||||
|
@ -136,11 +135,21 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
// create combo box ex
|
// create combo box ex
|
||||||
combobox = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE |
|
combobox = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE |
|
||||||
WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED,
|
WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED,
|
||||||
0, 0, 500, 250, parentWindow, (HMENU)0xa205, _AtlBaseModule.GetModuleInstance(), 0);
|
0, 0, 500, 250, parentWindow, (HMENU)IDM_TOOLBARS_ADDRESSBAR, _AtlBaseModule.GetModuleInstance(), 0);
|
||||||
if (combobox == NULL)
|
if (combobox == NULL)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
SubclassWindow(combobox);
|
SubclassWindow(combobox);
|
||||||
|
|
||||||
|
HRESULT hr = SHGetImageList(SHIL_SMALL, IID_PPV_ARG(IImageList, &piml));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
{
|
||||||
|
SendMessageW(combobox, CBEM_SETIMAGELIST, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendMessageW(combobox, CBEM_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(piml));
|
||||||
|
}
|
||||||
|
|
||||||
SendMessage(CBEM_SETEXTENDEDSTYLE,
|
SendMessage(CBEM_SETEXTENDEDSTYLE,
|
||||||
CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
|
CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
|
||||||
|
|
||||||
|
@ -170,47 +179,9 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
// TODO: properly initialize this from registry
|
fGoButtonShown = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
|
||||||
fGoButtonShown = true;
|
|
||||||
|
|
||||||
if (fGoButtonShown)
|
if (fGoButtonShown)
|
||||||
{
|
CreateGoButton();
|
||||||
const TBBUTTON buttonInfo [] = { { 0, 1, TBSTATE_ENABLED, 0 } };
|
|
||||||
HIMAGELIST normalImagelist;
|
|
||||||
HIMAGELIST hotImageList;
|
|
||||||
HINSTANCE shellInstance;
|
|
||||||
|
|
||||||
shellInstance = GetModuleHandle(_T("shell32.dll"));
|
|
||||||
normalImagelist = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL),
|
|
||||||
20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
|
||||||
hotImageList = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_HOT),
|
|
||||||
20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
|
||||||
|
|
||||||
fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD | WS_CLIPSIBLINGS |
|
|
||||||
WS_CLIPCHILDREN | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER |
|
|
||||||
CCS_NOPARENTALIGN | CCS_NORESIZE,
|
|
||||||
0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
|
|
||||||
SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
|
||||||
SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
|
|
||||||
if (normalImagelist)
|
|
||||||
SendMessage(fGoButton, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(normalImagelist));
|
|
||||||
if (hotImageList)
|
|
||||||
SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, reinterpret_cast<LPARAM>(hotImageList));
|
|
||||||
SendMessage(fGoButton, TB_ADDSTRINGW,
|
|
||||||
reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()), IDS_GOBUTTONLABEL);
|
|
||||||
SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM) &buttonInfo);
|
|
||||||
|
|
||||||
IImageList * piml;
|
|
||||||
HRESULT hr = SHGetImageList(SHIL_SMALL, IID_PPV_ARG(IImageList, &piml));
|
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
|
||||||
{
|
|
||||||
SendMessageW(combobox, CBEM_SETIMAGELIST, 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SendMessageW(combobox, CBEM_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(piml));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// take advice to watch events
|
// take advice to watch events
|
||||||
hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
|
hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
|
||||||
|
@ -333,6 +304,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
|
||||||
{
|
{
|
||||||
CComPtr<IWinEventHandler> winEventHandler;
|
CComPtr<IWinEventHandler> winEventHandler;
|
||||||
HRESULT hResult;
|
HRESULT hResult;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
*theResult = 0;
|
*theResult = 0;
|
||||||
|
|
||||||
|
@ -343,8 +315,13 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if (wParam == IDM_TOOLBARS_GOBUTTON)
|
if (wParam == IDM_TOOLBARS_GOBUTTON)
|
||||||
{
|
{
|
||||||
// toggle whether the Go button is displayed
|
fGoButtonShown = !SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
|
||||||
// setting is Yes or No, stored in key "Software\Microsoft\Internet Explorer\Main" in value ShowGoButton
|
SHRegSetUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", REG_SZ, fGoButtonShown ? (LPVOID)L"yes" : (LPVOID)L"no", fGoButtonShown ? 8 : 6, SHREGSET_FORCE_HKCU);
|
||||||
|
if (!fGoButton)
|
||||||
|
CreateGoButton();
|
||||||
|
::ShowWindow(fGoButton,fGoButtonShown ? SW_HIDE : SW_SHOW);
|
||||||
|
GetWindowRect(&rect);
|
||||||
|
SendMessage(m_hWnd,WM_SIZE,0,MAKELPARAM(rect.right-rect.left,rect.bottom-rect.top));
|
||||||
// broadcast change notification to all explorer windows
|
// broadcast change notification to all explorer windows
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -600,6 +577,9 @@ LRESULT CAddressBand::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHan
|
||||||
newHeight = HIWORD(lParam);
|
newHeight = HIWORD(lParam);
|
||||||
newWidth = LOWORD(lParam);
|
newWidth = LOWORD(lParam);
|
||||||
|
|
||||||
|
if (!fGoButton)
|
||||||
|
CreateGoButton();
|
||||||
|
|
||||||
SendMessage(fGoButton, TB_GETITEMRECT, 0, reinterpret_cast<LPARAM>(&buttonBounds));
|
SendMessage(fGoButton, TB_GETITEMRECT, 0, reinterpret_cast<LPARAM>(&buttonBounds));
|
||||||
buttonWidth = buttonBounds.right - buttonBounds.left;
|
buttonWidth = buttonBounds.right - buttonBounds.left;
|
||||||
buttonHeight = buttonBounds.bottom - buttonBounds.top;
|
buttonHeight = buttonBounds.bottom - buttonBounds.top;
|
||||||
|
@ -636,6 +616,9 @@ LRESULT CAddressBand::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fGoButton)
|
||||||
|
CreateGoButton();
|
||||||
|
|
||||||
positionInfoCopy = *reinterpret_cast<WINDOWPOS *>(lParam);
|
positionInfoCopy = *reinterpret_cast<WINDOWPOS *>(lParam);
|
||||||
newHeight = positionInfoCopy.cy;
|
newHeight = positionInfoCopy.cy;
|
||||||
newWidth = positionInfoCopy.cx;
|
newWidth = positionInfoCopy.cx;
|
||||||
|
@ -663,3 +646,32 @@ HRESULT CreateAddressBand(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
return ShellObjectCreator<CAddressBand>(riid, ppv);
|
return ShellObjectCreator<CAddressBand>(riid, ppv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAddressBand::CreateGoButton()
|
||||||
|
{
|
||||||
|
const TBBUTTON buttonInfo [] = { { 0, 1, TBSTATE_ENABLED, 0 } };
|
||||||
|
HIMAGELIST normalImagelist;
|
||||||
|
HIMAGELIST hotImageList;
|
||||||
|
HINSTANCE shellInstance;
|
||||||
|
|
||||||
|
|
||||||
|
shellInstance = GetModuleHandle(_T("shell32.dll"));
|
||||||
|
normalImagelist = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL),
|
||||||
|
20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
||||||
|
hotImageList = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_HOT),
|
||||||
|
20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
||||||
|
|
||||||
|
fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD | WS_CLIPSIBLINGS |
|
||||||
|
WS_CLIPCHILDREN | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER |
|
||||||
|
CCS_NOPARENTALIGN | CCS_NORESIZE,
|
||||||
|
0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
|
||||||
|
SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||||
|
SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
|
||||||
|
if (normalImagelist)
|
||||||
|
SendMessage(fGoButton, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(normalImagelist));
|
||||||
|
if (hotImageList)
|
||||||
|
SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, reinterpret_cast<LPARAM>(hotImageList));
|
||||||
|
SendMessage(fGoButton, TB_ADDSTRINGW,
|
||||||
|
reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()), IDS_GOBUTTONLABEL);
|
||||||
|
SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM) &buttonInfo);
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
virtual ~CAddressBand();
|
virtual ~CAddressBand();
|
||||||
private:
|
private:
|
||||||
void FocusChange(BOOL bFocus);
|
void FocusChange(BOOL bFocus);
|
||||||
|
void CreateGoButton();
|
||||||
public:
|
public:
|
||||||
// *** IDeskBand methods ***
|
// *** IDeskBand methods ***
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
|
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
|
||||||
|
|
|
@ -1663,6 +1663,7 @@ LRESULT CInternetToolbar::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||||
RBHITTESTINFO hitTestInfo;
|
RBHITTESTINFO hitTestInfo;
|
||||||
REBARBANDINFOW rebarBandInfo;
|
REBARBANDINFOW rebarBandInfo;
|
||||||
int bandID;
|
int bandID;
|
||||||
|
BOOL goButtonChecked;
|
||||||
|
|
||||||
clickLocation.x = LOWORD(lParam);
|
clickLocation.x = LOWORD(lParam);
|
||||||
clickLocation.y = HIWORD(lParam);
|
clickLocation.y = HIWORD(lParam);
|
||||||
|
@ -1712,6 +1713,8 @@ LRESULT CInternetToolbar::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||||
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_LINKSBAR, FALSE);
|
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_LINKSBAR, FALSE);
|
||||||
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_CUSTOMIZE, FALSE);
|
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_CUSTOMIZE, FALSE);
|
||||||
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_LOCKTOOLBARS, fLocked);
|
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_LOCKTOOLBARS, fLocked);
|
||||||
|
goButtonChecked = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
|
||||||
|
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_GOBUTTON, goButtonChecked);
|
||||||
|
|
||||||
// TODO: use GetSystemMetrics(SM_MENUDROPALIGNMENT) to determine menu alignment
|
// TODO: use GetSystemMetrics(SM_MENUDROPALIGNMENT) to determine menu alignment
|
||||||
command = TrackPopupMenu(contextMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
|
command = TrackPopupMenu(contextMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
|
||||||
|
@ -1730,6 +1733,9 @@ LRESULT CInternetToolbar::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||||
case IDM_TOOLBARS_CUSTOMIZE: // customize
|
case IDM_TOOLBARS_CUSTOMIZE: // customize
|
||||||
SendMessage(fToolbarWindow, TB_CUSTOMIZE, 0, 0);
|
SendMessage(fToolbarWindow, TB_CUSTOMIZE, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
case IDM_TOOLBARS_GOBUTTON:
|
||||||
|
SendMessage(fNavigationWindow, WM_COMMAND, IDM_TOOLBARS_GOBUTTON, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DestroyMenu(contextMenuBar);
|
DestroyMenu(contextMenuBar);
|
||||||
|
|
Loading…
Reference in a new issue