Bug 570795 - Create basic "Firefox button" widget. r=gavin

This commit is contained in:
Dão Gottwald 2010-06-13 10:20:58 +02:00
parent 9e37f96049
commit e1d82feb48
9 changed files with 194 additions and 8 deletions

View File

@ -78,3 +78,7 @@ ifneq ($(OS_ARCH),WINCE)
DEFINES += -DCONTEXT_COPY_IMAGE_CONTENTS=1
endif
endif
ifneq (,$(filter windows, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DMENUBAR_CAN_AUTOHIDE=1
endif

View File

@ -210,9 +210,8 @@
<menupopup id="menu_viewPopup">
<menu id="viewToolbarsMenu"
label="&viewToolbarsMenu.label;"
accesskey="&viewToolbarsMenu.accesskey;"
onpopupshowing="onViewToolbarsPopupShowing(event);">
<menupopup>
accesskey="&viewToolbarsMenu.accesskey;">
<menupopup onpopupshowing="onViewToolbarsPopupShowing(event);">
<menuseparator/>
<menuitem command="cmd_ToggleTabsOnTop"
type="checkbox"

View File

@ -73,6 +73,11 @@ toolbar[mode="icons"] > #reload-button[displaystop] {
background-position: bottom left;
}
.split-menuitem-menu > .menu-text,
.split-menuitem-menu > .menu-accel-container {
display: none;
}
/* ::::: location bar ::::: */
#urlbar {
-moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar);

View File

@ -1088,6 +1088,10 @@ function BrowserStartup() {
goSetCommandEnabled("cmd_newNavigatorTab", false);
}
#ifdef MENUBAR_CAN_AUTOHIDE
updateAppButtonDisplay();
#endif
CombinedStopReload.init();
allTabs.readPref();
@ -4545,9 +4549,11 @@ nsBrowserAccess.prototype = {
}
}
function onViewToolbarsPopupShowing(aEvent)
{
function onViewToolbarsPopupShowing(aEvent) {
var popup = aEvent.target;
if (popup != aEvent.currentTarget)
return;
var i;
// Empty the menu
@ -4569,8 +4575,9 @@ function onViewToolbarsPopupShowing(aEvent)
menuItem.setAttribute("toolbarindex", i);
menuItem.setAttribute("type", "checkbox");
menuItem.setAttribute("label", toolbarName);
menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey"));
menuItem.setAttribute("checked", toolbar.getAttribute(hidingAttribute) != "true");
if (popup.id != "appmenu_customizeMenu")
menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey"));
popup.insertBefore(menuItem, firstMenuItem);
menuItem.addEventListener("command", onViewToolbarCommand, false);
@ -4579,8 +4586,7 @@ function onViewToolbarsPopupShowing(aEvent)
}
}
function onViewToolbarCommand(aEvent)
{
function onViewToolbarCommand(aEvent) {
var index = aEvent.originalTarget.getAttribute("toolbarindex");
var toolbar = gNavToolbox.childNodes[index];
var hidingAttribute = toolbar.getAttribute("type") == "menubar" ?
@ -4589,6 +4595,10 @@ function onViewToolbarCommand(aEvent)
toolbar.setAttribute(hidingAttribute,
aEvent.originalTarget.getAttribute("checked") != "true");
document.persist(toolbar.id, hidingAttribute);
#ifdef MENUBAR_CAN_AUTOHIDE
updateAppButtonDisplay();
#endif
}
var TabsOnTop = {
@ -4614,6 +4624,13 @@ var TabsOnTop = {
}
}
#ifdef MENUBAR_CAN_AUTOHIDE
function updateAppButtonDisplay() {
document.getElementById("appmenu-button-container").hidden =
document.getElementById("toolbar-menubar").getAttribute("autohide") != "true";
}
#endif
function displaySecurityInfo()
{
BrowserPageInfo(null, "securityTab");

View File

@ -380,6 +380,103 @@
<tooltip id="tabbrowser-tab-tooltip" onpopupshowing="gBrowser.createTooltip(event);"/>
</popupset>
#ifdef MENUBAR_CAN_AUTOHIDE
<hbox id="appmenu-button-container">
<button id="appmenu-button"
type="menu"
label="&brandShortName;"
style="-moz-user-focus: ignore;">
<menupopup>
<menuitem id="appmenu_newNavigator"
label="&newNavigatorCmd.label;"
key="key_newNavigator"
command="cmd_newNavigator"/>
<menuseparator/>
<menuitem id="appmenu_savePage"
label="&savePageCmd.label;"
key="key_savePage"
command="Browser:SavePage"/>
<menuitem id="appmenu_sendLink"
label="&sendPageCmd.label;"
command="Browser:SendLink"/>
<hbox flex="1">
<menuitem id="appmenu_print"
flex="1"
label="&appMenuPrintCmd.label;"
key="printKb"
command="cmd_print"/>
<menu class="split-menuitem-menu">
<menupopup>
<menuitem id="menu_printSetup"
label="&printSetupCmd.label;"
command="cmd_pageSetup"/>
<menuitem id="menu_printPreview"
label="&printPreviewCmd.label;"
command="cmd_printPreview"/>
</menupopup>
</menu>
</hbox>
<menuitem id="appmenu_find"
label="&findOnCmd.label;"
key="key_find"
command="cmd_find"/>
<menuseparator/>
<menu id="appmenu_customize"
label="&appMenuCustomize.label;">
<menupopup id="appmenu_customizeMenu"
onpopupshowing="onViewToolbarsPopupShowing(event);">
<menuseparator/>
<menuitem command="cmd_ToggleTabsOnTop"
type="checkbox"
label="&viewTabsOnTop.label;"/>
<menuitem id="appmenu_toolbarLayout"
label="&appMenuToolbarLayout.label;"
command="cmd_CustomizeToolbars"/>
<menu id="appmenu_sidebars"
label="&appMenuSidebars.label;">
<menupopup id="appmenu_sidebarMenu">
<menuitem id="appmenu_bookmarksSidebar"
key="viewBookmarksSidebarKb"
observes="viewBookmarksSidebar"/>
<menuitem id="appmenu_historySidebar"
key="key_gotoHistory"
observes="viewHistorySidebar"
label="&historyButton.label;"/>
</menupopup>
</menu>
<menuseparator/>
<menuitem id="appmenu_openAddons"
label="&addons.label;"
command="Tools:Addons"/>
</menupopup>
</menu>
<menuitem id="appmenu_preferences"
#ifdef XP_UNIX
label="&preferencesCmdUnix.label;"
#else
label="&preferencesCmd.label;"
#endif
oncommand="openPreferences();"/>
<menuitem id="appmenu_openHelp"
label="&appMenuHelp.label;"
oncommand="openHelpLink('firefox-help')"
onclick="checkForMiddleClick(this, event);"/>
<menuseparator/>
<menuitem id="appmenu_quit"
#ifdef XP_WIN
label="&quitApplicationCmdWin.label;"
#else
label="&quitApplicationCmd.label;"
#ifdef XP_UNIX
key="key_quitApplication"
#endif
#endif
command="cmd_quitApplication"/>
</menupopup>
</button>
</hbox>
#endif
<toolbox id="navigator-toolbox"
defaultmode="icons" mode="icons"
#ifdef WINCE

View File

@ -228,6 +228,12 @@
<!ENTITY showAllHistoryCmd2.label "Show All History">
<!ENTITY showAllHistoryCmd.commandkey "H">
<!ENTITY appMenuPrintCmd.label "Print">
<!ENTITY appMenuCustomize.label "Customize">
<!ENTITY appMenuToolbarLayout.label "Toolbar Layout…">
<!ENTITY appMenuSidebars.label "Sidebars">
<!ENTITY appMenuHelp.label "Help">
<!ENTITY openCmd.commandkey "l">
<!ENTITY urlbar.placeholder "Go to a Web Site">
<!ENTITY urlbar.accesskey "d">

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

View File

@ -100,6 +100,62 @@ statusbarpanel#statusbar-display {
-moz-padding-start: 0;
}
/* App menu button */
%ifndef WINSTRIPE_AERO
#appmenu-button-container {
background: ActiveCaption;
}
#appmenu-button-container:-moz-window-inactive {
background: InactiveCaption;
}
%endif
#appmenu-button {
-moz-appearance: none;
background-color: rgb(228,120,14);
background-image: -moz-linear-gradient(rgba(255,255,255,.7),
rgba(255,255,255,.4) 10%,
rgba(255,255,255,0) 50%);
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.5);
-moz-border-radius: 4px;
-moz-box-shadow: 0 0 5px rgba(255,255,255,.5) inset;
color: white;
text-shadow: 0 0 2px #333;
font-weight: bold;
padding: .2em 2em;
}
#appmenu-button:hover:not(:active):not([open]) {
background-color: rgb(248,140,34);
}
#appmenu-button:hover:active,
#appmenu-button[open] {
background-image: -moz-linear-gradient(rgba(0,0,0,.3), rgba(0,0,0,.2) 10%, transparent 60%);
-moz-box-shadow: 0 0 4px rgba(0,0,0,.3) inset;
}
#appmenu-button > .button-box {
border-style: none;
padding: 0;
}
#appmenu-button > .button-box > .button-menu-dropmarker {
list-style-image: url(appmenu-dropmarker.png);
width: auto;
height: auto;
padding: 0;
margin: 0;
-moz-margin-start: .5em;
}
#appmenu-button > menupopup > menuitem {
-moz-padding-end: 16px;
}
/* ::::: bookmark buttons ::::: */
toolbarbutton.bookmark-item {

View File

@ -9,6 +9,7 @@ browser.jar:
skin/classic/browser/aboutSessionRestore-window-icon.png (aboutSessionRestore-window-icon.png)
skin/classic/browser/aboutCertError.css (aboutCertError.css)
skin/classic/browser/actionicon-tab.png
skin/classic/browser/appmenu-dropmarker.png
* skin/classic/browser/browser.css (browser.css)
* skin/classic/browser/engineManager.css (engineManager.css)
skin/classic/browser/fullscreen-video.css
@ -93,6 +94,7 @@ browser.jar:
skin/classic/aero/browser/aboutSessionRestore-window-icon.png (aboutSessionRestore-window-icon-aero.png)
skin/classic/aero/browser/aboutCertError.css (aboutCertError.css)
skin/classic/aero/browser/actionicon-tab.png (actionicon-tab.png)
skin/classic/aero/browser/appmenu-dropmarker.png
* skin/classic/aero/browser/browser.css (browser-aero.css)
* skin/classic/aero/browser/engineManager.css (engineManager.css)
skin/classic/aero/browser/fullscreen-video.css