| home / programming / mozilla / 1 | [previous] [next] |
|
|
Ignore the <nativescrollbar> tag unless you are doing extensive work with native themes or embedding Mozilla in some other GUI application.
Mozilla’s XUL toolbar system, which includes menu bars, is simple but can be made complex when used expertly. This complexity is the result of how overlays and templates are used to build up a single toolbar from several different documents. This chapter considers only the basic toolbar tags; overlays and templates are treated in later chapters.
Mozilla’s toolbars are not sophisticated. By default, they are not draggable or dockable as Netscape 4.x’s toolbars were, or as toolbars in Microsoft applications are. They cannot be pinned or torn off either. In fact, Mozilla toolbars cannot be layed out vertically. Mozilla’s toolbars do not provide the “more items” icon that appears on Internet Explorer toolbars. Nearly all these features can be added to the basic toolbars provided, if you have the will and the time.
Mozilla’s toolbars have a few advantages. The collapsible toolbar grippys
of Netscape 4.x are available, but not in version 1.2. When they are present,
the toolbars can be locked in place by hiding the grippys using style information.
When toolbar grippys aren’t supported, the toolbars are always locked
in place. Locked toolbars are a concept from Internet Explorer 6. Mozilla’s
toolbars can also appear anywhere in the content of an application window,
and being XUL they are very simple to create.
Figure 8.3 is a screenshot of the Mozilla Composer, with the Modern theme
applied. Note the horizontal line that separates text from icons in the main
toolbar. This line appears throughout the Modern theme, but it has nothing
to do with toolbar functionality. It is merely a background image. Don’t
be confused by it.
In addition to toolbars and menu bars, Mozilla also supports status bars.
Fig. 8.3 Toolbar tricks applied by the Modern theme.
8.2.2.1 <toolbox> The <toolbox> tag is a container
for a set of toolbars. Its XBL binding is in toolbar.xml in the chrome. When
there are no toolbar grippys (Mozilla 1.21), it acts like a <vbox>. In
both earlier and newer versions, where grippys are supported, the tag’s
internal content is as shown in Listing 8.4.
Although more than one <menubar> can appear in a given <toolbox>, that is not a recommended practice because of the confusion it creates when key-navigation is attempted.
The application programmer specifies only the <toolbox> tag and its
<toolbar> and <menubar> contents; all the rest is automatically
generated.
The <vbox> contains the toolbars; the <hbox> contains an empty
<hbox> and a <spacer> that provides flex. This empty <hbox>
holds images that represent grippy-collapsed toolbars. The image tags are
not precreated and hidden with CSS2 styles because there might be any number
of toolbars present. They are instead created dynamically by the JavaScript
onclick handlers in the XBL definition.
Where there are no grippys, <toolbox> is little more than a target for
style information. Any tag can be contained inside a <toolbox>, but
<toolbar> and <menubar> tags should be its immediate children.
| home / programming / mozilla / 1 | [previous] [next] |
Created: March 27, 2003
Revised: December 19, 2003
URL: http://webreference.com/programming/mozilla/1