The Mozilla
Organization
Our Mission
Who We Are
Getting Involved
Community
Editorials
What's New
Development
Module Owners
Blue Sky
Projects
Source Code
Getting It
Documentation
License Terms
Bugs
Search
Feedback



New Layout: Widget Library

Author: Kevin McCluskey
Updated: 6/19/98

Overview
The widget library provides a cross-platform abstraction for user interface widgets, windows and events.

Initially, the widget library will be used to implement HTML form elements, event handlers, the web-widget container window and the JavaScript interfaces to form elements. In the future it will be expanded to support other applications which require cross-platform widget support.

The HTML form elements place specific requirements on the widget library. The HTML form elements define input widgets such as textboxes, textareas, listboxes, radiobutton, checkboxes, comboboxes and file selectors. These input widgets take on the look and feel of the platform the application is running on. The web-widget container window has a scrollbar and receives mouse and keyboard notification messages. The JavaScript interface to form elements include additional attributes and widget behaviors which can be accessed only through JavaScript.

Major Components

The set of widgets includes the following:
Name Purpose Interface
window Rectangular window for rendering graphics (using the gfx library) and attaching widgets. nsIWidget
textbox Single line of text input. nsITextWidget
textarea Multiple lines of text input. nsITextArea
button Push button. nsIButton
listbox Presents multiple items with one or more items selected nsIListBox
combobox Combines a text box with a drop down list. The current selection from the drop down list is displayed in the text box. nsIComboBox
tab Presents multiple tabs. Tab selection events are generated when the user clicks on each tab. nsITabWidget
radiobutton Presents a button when can be shown in a checked or unchecked state. It's appearance indicates it is mutually exclusive among a group of radio button's. nsIRadioButton
checkbox Presents a button when can be shown in a checked or unchecked state nsICheckButton
scrollbar A horizontal or vertical scrollbar when sends events when the user moves the thumb of the scrollbar nsIScrollbar
fileselector A dialog box which allows the user to browse the file system and select a file or directory for saving or loading nsIFileWidget
Events Windows and other widgets generate events based on user-input or programmatic changes. nsGUIEvent
Implementation
  • The actual implementation for the widget library abstraction uses the native toolkit's capabilities as much as is feasible. The widget library will be implemented initially for Windows 95, Windows NT, MacOS, and variants of Unix running XLIB and MOTIF. In the future we envision many other platforms being supported.
  • HTML event handlers provide a unique challenge for the widget library. Since HTML event handlers can be used to capture low-level events such as mouse down and decide to discard the event, A widget can not assume that when the user click's on it it will receive focus or when the user presses a key in a text box that it will be entered. The widget must pass events to a registered event handler which decides whether the event is consumed or the widget should perform it's default behavior.
  • To display all of characters in many languages a two-byte unicode character must be used rather than a single byte ascii character. This presents challenges on platforms which don't normally support unicode throughout their native toolkit.

  • Printing requires widgets to render into a graphics context. Again, this can present difficulties if the native toolkit does not provide sufficient capability for the rendering of widgets.
Dependencies
  • gfx, NSPR
  • Windows95, NT - Win32 API (Note: it is not dependent on MFC)
  • Mac - MacOS
  • Unix or Linux - XLIB X11R5 and MOTIF 1.2.
  • Other OS's/windowing systems.
Roadmap

The current abstract set of widgets is sufficient to support cross-platform HTML forms and a viewer test app.
The widgets have been implented for WIN32. They are mostly complete for Linux and Irix running Motif 1.2 , X11R5.

Next steps:

Unix

  • Add support for tab and tooltip controls
MacOs
  • Support viewer port to MacOS by adding just enough widget library support to bring up the viewer app (nsIWidget, nsIScrollbar) under MacOS.
  • Add MacOS widgets to support HTML forms. (nsIRadio, nsITextWidget, nsITextAreaWidget,nsIFileWidget, nsICheckButton. etc)
All platforms
  • Add internationalization and printing support to all platforms Win32, Unix, and MacOS.
  • Additonal widget and events will be added as needed to support additional browser features such as toolbars and popup menus.
Known Bugs

Win32

  • Can not set the background and foreground color for each Widget
  • Can not set the caret within a text box
  • The rectangular widget background for checkbox's and radio buttons is not transparent. This causes a white box to always be drawn around these widgets.
Unix (Motif 1.2/ X11R6)
  • The following are not implemented, listbox, tooltips, tab controls, combobox.
MacOS
  • Un-implemented.
Looking for help with
Mac and Unix platform ports / Performance tuning.

Mac

  • window (nsIWidget)
  • scrollbar (nsIScrollbar)
  • window and scrollbar events (nsGUIEvent)
  • text widget (nsITextWidget)
  • textArea widget (nsITextAreaWidget)
  • button (nsIButton)
Unix (Motif 1.2/ X11R6)
  • Tooltips
  • Tab controls
  • Testing under Lesstif, SunOS (running Motif 1.x, 2.x)
  • Performance tuning

Widget Module Owner - Kevin McCluskey
The widget module owner is responsible for coordinating widget development and integrating source code from both Net and Netscape developers. Please send suggestions or offers to help to the widget owner



Copyright © 1998 Netscape Communications Corporation.