зеркало из https://github.com/mozilla/gecko-dev.git
Make bookmarks in the menu bar show status text in the status bar on rollover. Add generic support for menuitems in the menu bar to show status text using statustext attributes for any XUL application.
This commit is contained in:
Родитель
f037cfe886
Коммит
b00b9fce9a
|
@ -1,4 +1,5 @@
|
|||
<menubar id="main-menubar" style="border:0px;padding:0px;margin:0px;-moz-appearance:none">
|
||||
<menubar id="main-menubar" statusbar="statusbar-display"
|
||||
style="border:0px;padding:0px;margin:0px;-moz-appearance:none">
|
||||
<menu label="&fileMenu.label;"
|
||||
accesskey="&fileMenu.accesskey;">
|
||||
<menupopup id="menu_FilePopup" onpopupshowing="getContentAreaFrameCount();">
|
||||
|
@ -297,3 +298,73 @@
|
|||
</menu>
|
||||
</menubar>
|
||||
|
||||
|
||||
<template id='bookmarks-template' xmlns:nc="http://home.netscape.com/NC-rdf#">
|
||||
<rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<toolbarseparator uri="rdf:*"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
|
||||
</rule>
|
||||
<!-- yes, the type attribute is necessary otherwise all leaves are
|
||||
treated as containers for some reason -->
|
||||
<rule parent="hbox" iscontainer="true" isempty="true"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
||||
<toolbarbutton type="menu" editable="true" class="bookmark-item"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
||||
uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup>
|
||||
<menuitem label="&emptyItem.label;" disabled="true"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
</rule>
|
||||
<rule parent="hbox" iscontainer="true">
|
||||
<toolbarbutton type="menu" class="bookmark-item" uri="rdf:*" editable="true"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup contextmenu="bookmarks-context-menu"/>
|
||||
</toolbarbutton>
|
||||
</rule>
|
||||
<rule parent="hbox">
|
||||
<toolbarbutton class="bookmark-item" uri="rdf:*" editable="true"
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
statustext="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
tooltip="btTooltip"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule iscontainer="true" isempty="true"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmark-item" uri="rdf:*"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup>
|
||||
<menuitem label="&emptyItem.label;" disabled="true"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmark-item" uri="rdf:*"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<menupopup contextmenu="bookmarks-context-menu"/>
|
||||
</menu>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<menupopup>
|
||||
<menuseparator uri="rdf:*" />
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
statustext="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
|
|
@ -297,75 +297,6 @@
|
|||
</vbox>
|
||||
</tooltip>
|
||||
|
||||
<template id='bookmarks-template' xmlns:nc="http://home.netscape.com/NC-rdf#">
|
||||
<rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<toolbarseparator uri="rdf:*"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
|
||||
</rule>
|
||||
<!-- yes, the type attribute is necessary otherwise all leaves are
|
||||
treated as containers for some reason -->
|
||||
<rule parent="hbox" iscontainer="true" isempty="true"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
||||
<toolbarbutton type="menu" editable="true" class="bookmark-item"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
||||
uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup>
|
||||
<menuitem label="&emptyItem.label;" disabled="true"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
</rule>
|
||||
<rule parent="hbox" iscontainer="true">
|
||||
<toolbarbutton type="menu" class="bookmark-item" uri="rdf:*" editable="true"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup contextmenu="bookmarks-context-menu"/>
|
||||
</toolbarbutton>
|
||||
</rule>
|
||||
<rule parent="hbox">
|
||||
<toolbarbutton class="bookmark-item" uri="rdf:*" editable="true"
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
statustext="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
tooltip="btTooltip"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</rule>
|
||||
<rule iscontainer="true" isempty="true"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmark-item" uri="rdf:*"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup>
|
||||
<menuitem label="&emptyItem.label;" disabled="true"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmark-item" uri="rdf:*"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<menupopup contextmenu="bookmarks-context-menu"/>
|
||||
</menu>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<menupopup>
|
||||
<menuseparator uri="rdf:*" />
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<toolbox id="navigator-toolbox" class="toolbox-top" mode="icons" iconsize="small">
|
||||
<!-- Menu -->
|
||||
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
|
||||
|
|
|
@ -277,8 +277,44 @@
|
|||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<field name="_active">false</field>
|
||||
<field name="_statusbar">null</field>
|
||||
<field name="_originalStatusText">null</field>
|
||||
<property name="statusbar" onget="return this.getAttribute('statusbar');"
|
||||
onset="return this.setAttribute('statusbar', val)"/>
|
||||
<method name="updateStatusText">
|
||||
<parameter name="itemText"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this._active)
|
||||
return;
|
||||
var newText = itemText ? itemText : this._originalStatusText;
|
||||
if (newText != this._statusbar.label)
|
||||
this._statusbar.label = newText;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="DOMMenuBarActive">
|
||||
if (!this._statusbar)
|
||||
this._statusbar = document.getElementById(this.statusbar);
|
||||
if (!this._statusbar)
|
||||
return;
|
||||
this._active = true;
|
||||
this._originalStatusText = this._statusbar.label;
|
||||
</handler>
|
||||
<handler event="DOMMenuBarInactive">
|
||||
<![CDATA[
|
||||
if (!this._active)
|
||||
return;
|
||||
this._active = false;
|
||||
this._statusbar.label = this._originalStatusText;
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="DOMMenuItemActive">this.updateStatusText(event.target.statusText);</handler>
|
||||
<handler event="DOMMenuItemInactive">this.updateStatusText("");</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="toolbardecoration" extends="chrome://global/content/widgets/toolbar.xml#toolbar-base"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче