| home / programming / mozilla / 1 | [previous] |
|
|
collapsed grippyhidden grippytooltiptext
collapsed set to true will collapse the toolbar as for any tag, grippyhidden set to true will lock the toolbar in place by hiding any <toolbargrippy> that appears by default. grippytooltiptext sets the tooltip text for the grippy. This text appears when the toolbar is collapsed and the mouse hovers over the remaining grippy.
Setting the collapse attribute is not the same as clicking a grippy. To emulate that user action, call the collapseToolbar() method of the parent <toolbox> tag, with the <toolbar>’s DOM object as the sole argument.
Early versions of Mozilla included a lead-in image or icon for the whole toolbar, but that has been removed in more recent versions. A lead-in icon or image can still be added using the CSS2 list-style-image property.
A restriction on the <toolbar> tag is that it does not always lay out reliably. Problems can occur if it occupies less than the full width of a XUL window. If tags appear to the right of the enclosing <toolbox>, and the window is narrow, then <toolbar> contents can be incorrectly truncated. Sometimes this works; sometimes it doesn’t. For best results, just give <toolbar> the full width of the application window.
There is some discussion on the toolbar grippy, implemented with <toolbargrippy>, in Chapter 4, First Widgets and Themes. The grippy is based on a simple image, reminiscent of Sun Microsystem’s OpenLook desktop environment.
Because toolbars can be dynamically created, it is best to give their content a simple structure. Make all items on the toolbar immediate children of the <toolbar> tag.
8.2.2.3 <toolbaritem>, <toolbarbutton>, and <toolbarseparator> The <toolbaritem>, <toolbarbutton>, and <toolbarseparator> tags are used as <toolbar> content. <toolbaritem> is an anonymous tag. <toolbarseparator> is an anonymous tag styled to provide extra space and a further destination for style information. <toolbarbutton> is a button. The last two are described in Chapter 4, First Widgets and Themes.
Although two of these tags have no special capbilities, they do have a purpose. When templates are used to construct toolbars, the template system decides how to generate content based on tag names. Even though <toolbaritem> has no particular meaning of its own, a template system can recognize the name and ignore it. This allows the tag to be used as a container for generic content that shouldn’t be manipulated.
Tooltips for toolbuttons, and floating help in general, are described in Chapter 10, Windows and Panes.
8.2.3.1 <menubar> This tag acts like a plain <hbox> and can appear inside or outside a <toolbox> tag. More than one <menubar> can appear inside a <toolbox>. That is the general case.
The Macintosh Platform, both MacOS 9 and X, is a special case. That platform has a single menu bar that is dynamically shared between all running applications. That special menu bar exists outside the basic windowing system. A <menubar> tag has its contents applied to that Macintosh menu bar, and that content appears only on that special menu bar. Only one <menubar> tag is examined, and only the <menu> tags inside that <menubar> are applied to the special bar. The menu items appear on that bar when the Mozilla window gains focus. They do not appear inside the Mozilla window as well.
On other platforms, <menubar> can be filled with any content. <menubar> supports Mozilla’s accessibility features. <menubar>’s special attributes are the same as for <toolbar>:
collapsed grippyhidden grippytooltiptext
These attributes do nothing on the Macintosh. Mozilla’s XBL definition for <menubar> appears in toolbar.xml in the chrome.
8.2.3.2 <menu> The <menu> tag is the sole tag that should appear inside a <menubar>. It implements a button-like label that displays a dropdown menu when pressed. It is a wrapper for the <menupopup> tag, similar to the other menu wrapper tags described in Chapter 6, Events. The <menu> tag can also be used outside of <menubar> as a form element (although <menulist> is a better approach) or as a submenu inside another menu. If the <menu> tag inside a <menubar> has no content, it acts much like a <toolbarbutton>; use <toolbarbutton> instead.The <menu> tag supports Mozilla’s accessibility features and has the following special attributes:
disabled _moz-menuactive open label accesskey crop acceltext image
disabled set to true grays out the menu. _moz-menuactive set to true applies a style that highlights the menu title as though it were a button. open set to true might apply a further style to the menu title and also indicate that the drop-down menu is displayed. The other attributes apply to the <label> content tags that hold the menu title, except for image, which applies to an optional content icon that is sometimes available. Any automatically generated content tags are described in “Menu Variations.”
The _moz-menuactive attribute is passed through the <menu> tag from the
parent <menubar> tag all the way to the <menuitem> tags that are
the contents of the menu. Many styles are based on this attribute. These styles
provide visual feedback to the user when navigating through the menu structure.
_moz-menuactive would be called -moz-menuactive, except that XML attributes
may not start with a “-”. The name of this attribute is not yet
final, so check the XBL in your version to see if this name has changed.
<menupopup> and <template> are the only tags that can be put inside
the <menu> tag as content. With respect to toolbars, menu bars can have
the content generated by XUL’s template or overlay systems. Menu bars
can also have the content of individual menus generated in this way.
<menu> can also be used inside a <toolbar> tag, but this is not
particularly recommended.
| home / programming / mozilla / 1 | [previous] |
Created: March 11, 2003
Revised: December 19, 2003
URL: http://webreference.com/programming/mozilla/1