Author: gadamopoulos
Date: Fri Oct 9 13:20:45 2015
New Revision: 69473
URL:
http://svn.reactos.org/svn/reactos?rev=69473&view=rev
Log:
[BROWSEUI]
- Implement showing and hiding the Go button. Patch by Barrett Karish.
CORE-10154
Modified:
trunk/reactos/base/applications/iexplore/iexplore.inf
trunk/reactos/dll/win32/browseui/addressband.cpp
trunk/reactos/dll/win32/browseui/addressband.h
trunk/reactos/dll/win32/browseui/internettoolbar.cpp
Modified: trunk/reactos/base/applications/iexplore/iexplore.inf
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/iexplore…
==============================================================================
--- trunk/reactos/base/applications/iexplore/iexplore.inf [iso-8859-1] (original)
+++ trunk/reactos/base/applications/iexplore/iexplore.inf [iso-8859-1] Fri Oct 9 13:20:45
2015
@@ -23,6 +23,7 @@
HKCR,"CLSID\%CLSID_Internet%\ShellFolder",,2,"0x24"
[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.reactos.org"
HKCU,"Software\Microsoft\Internet Explorer\Main","Search
Page",2,"http://www.google.com"
Modified: trunk/reactos/dll/win32/browseui/addressband.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/address…
==============================================================================
--- trunk/reactos/dll/win32/browseui/addressband.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/addressband.cpp [iso-8859-1] Fri Oct 9 13:20:45
2015
@@ -34,8 +34,6 @@
****Add command handler for show/hide Go button to OnWinEvent
****Add tooltip notify handler
**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
**Implement TranslateAcceleratorIO
Implement Exec
@@ -112,6 +110,7 @@
HWND parentWindow;
HWND combobox;
HRESULT hResult;
+ IImageList *piml;
if (pUnkSite == NULL)
{
@@ -136,10 +135,20 @@
// create combo box ex
combobox = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD |
WS_VISIBLE |
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)
return E_FAIL;
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,
CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE |
CBES_EX_NOSIZELIMIT);
@@ -170,47 +179,9 @@
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
- // TODO: properly initialize this from registry
- fGoButtonShown = true;
-
+ fGoButtonShown = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet
Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
if (fGoButtonShown)
- {
- 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));
- }
- }
+ CreateGoButton();
// take advice to watch events
hResult = IUnknown_QueryService(pUnkSite, SID_SShellBrowser,
IID_PPV_ARG(IBrowserService, &browserService));
@@ -333,6 +304,7 @@
{
CComPtr<IWinEventHandler> winEventHandler;
HRESULT hResult;
+ RECT rect;
*theResult = 0;
@@ -343,8 +315,13 @@
case WM_COMMAND:
if (wParam == IDM_TOOLBARS_GOBUTTON)
{
- // toggle whether the Go button is displayed
- // setting is Yes or No, stored in key "Software\Microsoft\Internet
Explorer\Main" in value ShowGoButton
+ fGoButtonShown =
!SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main",
L"ShowGoButton", FALSE, TRUE);
+ 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
}
break;
@@ -600,6 +577,9 @@
newHeight = HIWORD(lParam);
newWidth = LOWORD(lParam);
+ if (!fGoButton)
+ CreateGoButton();
+
SendMessage(fGoButton, TB_GETITEMRECT, 0,
reinterpret_cast<LPARAM>(&buttonBounds));
buttonWidth = buttonBounds.right - buttonBounds.left;
buttonHeight = buttonBounds.bottom - buttonBounds.top;
@@ -636,6 +616,9 @@
return 0;
}
+ if (!fGoButton)
+ CreateGoButton();
+
positionInfoCopy = *reinterpret_cast<WINDOWPOS *>(lParam);
newHeight = positionInfoCopy.cy;
newWidth = positionInfoCopy.cx;
@@ -663,3 +646,32 @@
{
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);
+}
Modified: trunk/reactos/dll/win32/browseui/addressband.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/address…
==============================================================================
--- trunk/reactos/dll/win32/browseui/addressband.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/addressband.h [iso-8859-1] Fri Oct 9 13:20:45 2015
@@ -48,6 +48,7 @@
virtual ~CAddressBand();
private:
void FocusChange(BOOL bFocus);
+ void CreateGoButton();
public:
// *** IDeskBand methods ***
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode,
DESKBANDINFO *pdbi);
Modified: trunk/reactos/dll/win32/browseui/internettoolbar.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/interne…
==============================================================================
--- trunk/reactos/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Fri Oct 9 13:20:45
2015
@@ -1663,6 +1663,7 @@
RBHITTESTINFO hitTestInfo;
REBARBANDINFOW rebarBandInfo;
int bandID;
+ BOOL goButtonChecked;
clickLocation.x = LOWORD(lParam);
clickLocation.y = HIWORD(lParam);
@@ -1712,6 +1713,8 @@
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_LINKSBAR, FALSE);
SHCheckMenuItem(contextMenu, IDM_TOOLBARS_CUSTOMIZE, FALSE);
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
command = TrackPopupMenu(contextMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON
| TPM_RETURNCMD,
@@ -1729,6 +1732,9 @@
break;
case IDM_TOOLBARS_CUSTOMIZE: // customize
SendMessage(fToolbarWindow, TB_CUSTOMIZE, 0, 0);
+ break;
+ case IDM_TOOLBARS_GOBUTTON:
+ SendMessage(fNavigationWindow, WM_COMMAND, IDM_TOOLBARS_GOBUTTON, 0);
break;
}