spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / mozilla / 1 To page 1To page 2To page 3To page 4To page 5To page 6current page
[previous]

Sr. Web Developer
Professional Technical Resources
US-OR-Portland

Justtechjobs.com Post A Job | Post A Resume
Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

Rapid Application Development with Mozilla: Navigation. Pt. 1

8.2.2.2 <toolbar> The <toolbar> tag is the first of two options for <toolbox> content. It provides a single horizontal toolbar that acts like a <hbox> and is unremarkable. It can contain any type of content. The only XML attributes of particular interest are

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 Menu Bars

Mozilla’s XUL supports menu bars, which are a specialized form of toolbar. By common convention, a menu bar should be the first toolbar in a <toolbox> so that it appears at the top of the toolbar area.

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 To page 1To page 2To page 3To page 4To page 5To page 6current page
[previous]

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Working with the DOM Stylesheets Collection · Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Combine BottomCount() with Other MDX Functions to Add Sophistication · Creating a Daemon with Python · The Coming Voice-over-WiMAX Revolution

Created: March 11, 2003
Revised: December 19, 2003

URL: http://webreference.com/programming/mozilla/1