Rapid Application Development with Mozilla: Navigation. Pt. 1 | 6
Rapid Application Development with Mozilla: Navigation. Pt. 1
8.2.1.4 <nativescrollbar> XUL divides a scrollbar widget up into a number of parts, but that is only one way to implement such a widget. Many GUI toolkits can supply a scrollbar widget as a single whole object, rather than supply pieces that the application must put together. The <nativescrollbar> tag is intended to display a whole native scrollbar as a single widget. Its use is restricted to the Macintosh at the moment, and applies only when native themes are at work.Ignore the <nativescrollbar> tag unless you are doing extensive work with native themes or embedding Mozilla in some other GUI application.
8.2.2 Toolbars
A bar is a rectangular section of a window covered in user controls. Toolbars and menu bars typically appear along the edges of an application window, primarily along the top edge. They provide a convenient place from which users can launch commands. To see toolbars in Mozilla, just open a Classic Browser window and look at the top part. The Classic Browser has extra functionality that collapses and redisplays toolbars. Try playing with the options on the View | Show/Hide submenu.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.
Listing 8.4 Breakdown of the <toolbox> tag.
<toolbox>
<vbox>
<toolbar or menubar> <toolbar>
... more toolbars ...
<hbox>
<hbox>
<spacer>
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.
Created: March 27, 2003
Revised: December 19, 2003
URL: http://webreference.com/programming/mozilla/1

Find a programming school near you