The Photon Programmer's Guide is intended for developers of
Photon applications. It includes the following:
If you'd like to see some sample Photon applications, look in the
/usr/free/qnx4/photon/examples directory in QUICS.
- The definition of a widget's canvas has been corrected in
"Widget geometry."
- You can choose to have the application notified when the
widget is actually destroyed by registering a function with
the destroy callback (Pt_CB_DESTROYED) for the
widget. See
"Widget life
cycle" in the Introduction chapter.
- You should develop a naming convention for all the widgets in your
application - it will make large applications more manageable.
- As described in
"Attaching
callbacks,"
a Done callback in the base window exits the application.
A Cancel callback in the base window closes the application's windows but
doesn't exit the application.
- A section on
hotkeys - the basics
has been added.
- As described in
"Processing
hotkeys,"
setting the Pt_HOTKEYS_FIRST flag for container-class
widgets makes them process key events that reach the container as
hotkeys before passing them to their children. If the event is a hotkey,
it's consumed, so it isn't passed to the children.
When adding
raw-event callbacks,
note that the
Pt_CB_RAW
callbacks defined for
PtWidget
are invoked after the widget has processed the event, and
then only for events that the widget doesn't consume.
In contrast, the
Pt_CB_FILTER
callbacks defined for
PtContainer
are invoked before the event is passed to the child widget.
- The value of a widget's ABN_... variable is unique only
in the module that contains the widget.
The variables for widgets in other modules might have the same value.
See "Variables and
manifests."
- PhAB doesn't create ABW_... manifests for menu modules
or menu items.
Menus typically don't exist for very long, so manifests for them aren't
very useful. If you need to change the resources of the
PtMenu, create a setup function for the menu module
and do the work there. See
"Module setup functions."
- A section on
handling multiple instances of a window
has been added.
- For an internal link, the widget pointer in the module setup
function's apinfo is a copy of the widget pointer passed
to ApCreateModule(). It's useful for positioning the
module.
- When setting link resources,
the widget copies the data into its internal memory.
- The pointer method of
getting a Boolean resource
has been simplified; the type is always an int.
- Changes to the widget's state may invalidate the pointers returned
by PtGetResources(); use them promptly.
- An example of using
an internal link to display a popup menu has been added.
- If the key used in a hotkey isn't a function key (i.e. the key code is
less than 0xF000), PhAB
automatically changes the hotkey to match the accelerator key.
See "Hotkeys."
- When running, the application looks for the best match to the
language extension. See
"Running
your application."
- The section on receiving QNX messages now discusses the
message-buffer size.
- There's now an example
of an input handler that replies to messages sent by the
sin ver command.
- PtAppRemoveSignalProc() will remove any handlers for the
given signals used internally by the libraries. You should use
PtAppRemoveSignal() instead to remove
signal handlers.
- It's safe to call PtBkgdHandlerProcess() in callbacks, work
procedures, and input procedures, but
not in a widget's Draw method or a PtRaw widget's
drawing function.
- If your fd handler changes the display, it should call
PtFlush() to
make sure the display is updated.
- PtTimer is easy to use, but doesn't give accurate
timer events. In particular, it doesn't guarantee a constant repeat rate;
since the repetition is handled by rearming the timer for each event,
any delays in handling the events accumulate. Kernel timers guarantee
an accurate repeat rate even if your application can't keep up with them.
- The example in
"Modal dialogs"
has been replaced.
- Don't change any other widget in any way (creating, destroying, setting
resources, and so on) in a raw widget's drawing function. It's safe to
get resources from other widgets.
- Don't call the drawing function for a
PtRaw
directly from your program.
Instead, damage the widget by calling
PtDamageWidget(),
and let the library call the drawing function.
- To close a polygon,
use Pg_CLOSED as part of the flags.
See "Polygons."
- The mask_bpl member of a PhImage_t
structure doesn't need to be a multiple of 4.
The leftmost pixel of the image corresponds to the top bit of the
first byte in the transparency mask.
- Use the Ph_FORCE_FRONT flag to keep a region
in front of its brothers. See
"Ph_FORCE_FRONT
flag."
- To see if shared memory can be used for drawing, check the
system information.
The Ph_GCAP_SHMEM flag is set in
gfx.capabilities if all the graphics drivers support
the ...mx() functions and they're all running on
your node.
- The timestamp member of the PhEvent_t
is in milliseconds, not seconds.
- The section
"Emitting events"
has been corrected.
- The following sections have been added: