|
Photon provides a library of components known as
widgets - objects that can manage much of their on-screen behavior automatically, without
explicit programming effort. As a result, a complete application can be quickly assembled by
combining widgets in various ways and then attaching C code to the appropriate callbacks the widgets
provide. The Photon Application Builder (PhAB), which is included as part of the Photon development
system, provides an extensive widget palette in its visual development environment.
Photon provides a wide range of widgets:
- basic widgets (e.g. a button)
- container widgets (e.g. a window widget)
- advanced widgets (e.g. an HTML display widget).
Basic widgets
Label widget
(PtLabel)
The label widget is mainly used to display textual information. The
PtLabel widget is the superclass for all text-based widgets,
providing many customizable attributes (e.g. font typeface, pop-up balloons, colors, borders,
alignment, margins, etc.), all of which are inherited by all its subclasses.
Push button widget
(PtButton)
Push buttons are a necessary component in
every windowing system. They have a raised look that changes to depressed when pushed, giving a
visual cue to let the user know the button has been selected. In addition to this visual
behavior, push buttons automatically invoke an application-defined callback when they're
selected.
Text input widgets
(PtText,
PtMultiText)
 |
Photon provides two
text-input widgets: |
- a simple single-line input widget (PtText) commonly used in
forms
- a powerful wordprocessor-like multi-line widget
(PtMultiText) providing full editing capabilities, word wrapping,
automatic scrolling, and multi-font line segments.
Toggle button widgets
(PtToggleButton,
PtOnOffButton)
Toggle buttons are objects that display two
states - either on or off. Photon provides two different types of toggle buttons, each with a
different visual appearance. Toggle buttons are used to display or request state information
related to a command or action about to be performed.
Graphical widgets (PtArc,
PtPixel, PtRectangle,
PtLine, PtPolygon,
PtEllipse, PtBezier,
PtGrid)
 |
Photon has no shortage of graphical widgets.
There's a widget to accomplish everything from simple lines and rectangles to complex
multi-segmented bézier curves. Graphical widgets provide attributes for color, fills,
patterns, line thickness, joins, and much more. |
Scrollbar widget
(PtScrollbar)
A scrollbar widget is used to scroll the display of a viewable area. The scrollbar is combined
with other widgets (e.g. PtList,
PtScrollArea) to allow scrolling.
Separator widget
(PtSeparator)
The separator widget is used to separate two or more different areas, giving a better visual
appearance. The separator can be customized for many different styles and looks.
Slider widget
(PtSlider)
 |
Sliders are different from
scrollbars. A scrollbar defines a range, whereas a slider defines a single value. The slider
widget provides a rich list of customizable attributes. |
Timer widget
(PtTimer)
The timer widget makes using timers a snap. This
widget has no visual appearance - it simply defines a callback whenever a timer event is triggered.
The application sets the timer value and optional repeat value. When the timer goes off, the
application is notified.
Graphic image widgets (PtBitmap,
PtLabel, PtButton)
Photon supports every major graphic file standard, so you can import graphics and display them
inside widgets. Many Photon widgets directly support displaying graphics - the most common are
PtButton for making push-button toolbars and
PtLabel for displaying images.
Progress bar widget
(RtProgress)
If an application needs to do something that takes a fair amount of time (e.g. loading a
file), it can use the progress bar widget to let the user know what's happening and, more
importantly, how much longer the process is going to take. The progress bar can be horizontal or
vertical and has many attributes for customization.
Message widget
(PtMessage)

Pop-up messages and notifications are quite common
in a windowing environment. Photon provides a very handy message dialog widget that displays a
message and up to 3 user-response buttons. There's also a very useful modal dialog function call
(PtAskQuestion()) based on the message widget.
Numeric widgets
(PtNumericInteger,
PtNumericFloat)
The PtNumericInteger class lets the user specify integer
values between given minimum and maximum values. The PtNumericFloat
class lets the user enter floating-point values.
A PtUpDown widget is
also shown to allow the user to increase or decrease the value by a set amount.
Container widgets
Window and icon widgets
(PtWindow, PtIcon)
Windows are the main application containers. The main UI components (menu bars, toolbars, etc.) appear with the window widget. The widget automatically handles all the necessary interactions with the Photon Window Manager (PWM) - all you need to specify is what should and shouldn't be rendered or managed.
Icon widgets are closely associated with windows and are displayed in the Photon Desktop Manager launch folders and PWM taskbar.
Bulletin board widgets
(PtPane)

Bulletin board widgets are simple container widgets
that are used to hold other widgets. Although these are parent widgets, they don't manage their child
widgets in any way. They are quite useful for designing form layouts commonly found in dialog
windows.
Group widget
(PtGroup)
The
group widget is a very powerful widget that manages the geometry of all its child widgets. It can
align the widgets horizontally, vertically, or in a matrix. The group widget can be anchored to the
side of any other container (like a window) so that it automatically resizes when the window resizes.
The group widget also provides attributes that let you specify whether the children should be
stretched to fit the group if it's resized larger due to anchoring.
Scrolling area widget
(PtScrollArea)
The scrolling area widget is a
very powerful widget that provides a viewport into a potentially larger container. You can place
any number of widgets inside a scrolling area and it will automatically display a scrollbar if
the widgets are contained within the viewable area. Scroll area widgets could be used to
implement a text file viewer, wordprocessor, customized list display, and so on.
To scroll child widgets quickly, the scrolling
area widget uses a hardware blitter (provided the underlying graphics driver supports
it).
Background widget
(PtBkgd)
 |
The background widget provides a
way to create fancy background displays, from simple color gradations to tiled textures. Just
about any background requirement is handled by this widget. |
Advanced widgets
Menu related widgets
(PtMenu, PtMenuBar,
PtMenuButton)
 Photon provides for every menu
related requirement. There's a widget to simplify the creation of a standard menu bar. The menu
widget handles the pop-up display, press-drag-release, point and click, keyboard traversal, and
selection of menu items. The menu button widget is used for creating individual menu
items.
List widget
(PtList)
The list widget is a very powerful widget that manages a list of items. It provides many different selection modes, including single selection, multiple selection and range selection. The list widget also supports multi-columned lists through the use of a divider widget (PtDivider).
Pulldown list widget
(PtComboBox)
The pulldown list widget combines the PtText widget (for text input) with a pulldown button for displaying a list widget. When the user selects from the list, the text widget is automatically updated with the current selection. The pulldown list widget is very useful for displaying a list of items using a small space. Dialogs and containers use a lot less screen real-estate, which is important in embedded environments.
Tree widget
(PtTree)
 |
The tree widget is similar to the
list widget - in fact they both have the same ancestors. The main difference is that the tree
widget displays the items in a hierarchical manner. Items, called branches, can be expanded or
collapsed; any number of tree branches can be created. Each branch can define its own unique
image to display. Trees are useful because they display information in a very logical
manner.
Photon applications that use the tree widget
include: the File Manager (directory display), PhAB (widget layout),
vsin (process list), and many others. |
Terminal widgets (PtTty,
PtTerminal)
Imagine having a text console inside your application. That's exactly what this widget does.
It creates and manages an entire text-mode terminal inside a widget. Just drop it into your
application and you've created your very own pterm (our terminal
application).
The terminal widget doesn't stop there - it also
provides complete cut-and-paste functionality and quick-launch help by highlighting any text within
the widget.
Divider widget
(PtDivider)
This powerful widget manages its children in a unique and useful way. When you place two or
more widgets inside a divider widget, it automatically puts little separators in between the child
widgets. Using these separators, the user can drag back and forth, causing the child widgets on
either side of the separator to be resized. This is very useful for creating resizable column
headings for lists. In fact, if you drop a divider widget into a list widget, it will automatically
turn your simple list into a resizable multi-column list.
Dividers aren't limited to just labels or buttons.
Any widgets can be placed inside to create side-by-side resizable trees, scroll areas, and so
on.
Trend graph widget
(RtTrend)

Realtime systems often require trend graphs. Photon
comes with a trend bar widget that supports the display of multiple trend lines simultaneously. If
your graphics hardware supports masked blits, it can even smooth-scroll the trend across grid
lines.
Realtime meter widget
(RtMeter)
The
RtMeter widget is drawn as a half circle with divisional ticks at
1/3, 1/2, and 2/3 of the arc. The needle can be moved with the mouse, the keyboard, or
programmatically. A single mouse click moves the meter to the current mouse position; a mouse "drag"
causes the needle to follow the mouse through meter values.
Font selection dialog
(PtFontSel)
 |
To accommodate the wide selection
of fonts available for Photon, a Font Selection widget is provided. This widget can read the
standard font-mapping files and display a list of all available fonts. It allows you to choose
the typeface, style (bold, italic, etc.) and also indicate whether the font should be
anti-aliased. |
File selection widget
(PtFileSel)
 |
The
PtFileSel widget is a tree widget that displays files,
directories, links to files or directories, or custom entries. Besides selecting a particular
file in response to an application prompt, users can also use this widget to navigate an entire
filesystem and choose their own file and directory. |
Print selection dialog
(PtPrintSel)
 |
The
PtPrintSel widget lets a user select a printer or control its
properties. The user may also select a range of pages to print as well as the number of copies to
submit. |
HTML viewer widget
(PtHtml)

Using the HTML widget makes it easy to create a
customized help viewer. It will format a standard HTML file and even autoload all the images. It
handles resizing, scrolling, just about everything you would need to do. This widget is ideal for
creating helpviewers for touchscreen environments.
Widget building toolkit
If all the standard Photon widgets aren't enough,
you can easily build your own! The Photon Development System comes with complete documentation and
sample source code to create your own custom widgets. You can sub-class off of existing widgets to
inherit their functionality or create a complete new widget class tree. Your widget possibilities are
endless.
|