OLIT Reference Manual
  Искать только в названиях книг
Загрузить это руководство в формате PDF

Activation Types

3

This chapter explains what Activation Types are, explains how they are used in the toolkit, and describes those Activation Types that are common to several OLIT widgets.

Activation Type Description

What is an Activation Type?

OPEN LOOK defines a set of semantics that a user can invoke to control the user interface. Some examples of these semantics are:
MENUPopup a menu
SCROLLDOWNScroll the view down one screen
NEXTFIELDMove focus to the next object
See the OPEN LOOK GUI Functional Specification and the OPEN LOOK Mouseless Specification for more information on GUI semantics.
Currently, OLIT maps these semantics to virtual events inside the toolkit (termed "virtual" because they do not necessarily correspond to a particular X11 input event). OLIT's convention is to add a prefix of "OL_" to the semantic name to name the type of virtual event, which is called the Activation Type.

Activation Type Description

For example, for the semantics listed previously, the corresponding OLIT Activation Types are:
OL_MENU and OL_MENUKEY (for Mouseless mode) OL_SCROLLDOWN
OL_NEXTFIELD
Each OLIT widget supports a set of Activation Types for which it knows how to respond. Some Activation Types are supported by all widgets, such as OL_HELP, and those used for Mouseless operation (described later in this chapter), and some are specific to a certain widget.
So, when a user performs an input action, OLIT translates the generated XEvent (or combination of XEvents) into an Activation Type defined by a set of configurable toolkit bindings (described later) and then delivers the corresponding "virtual event" to the widget. If the widget supports that Activation Type, it performs the corresponding action. For example, if the user presses the MENU mouse button on a MenuButton widget, OLIT translates this to the OL_MENU Activation Type, delivers an OL_MENU activation to the MenuButton widget, and the MenuButton responds by popping up its menu.

Interposing on Activation Types

If an application wishes to monitor or interpose on the virtual events delivered to a particular widget, it can register an XtNconsumeEvent callback on the widget. (For detailed information on this callback, see "XtNconsumeEvent" on page 26 for the Primitive or Manager classes.) This callback will get called just before the Activation Type is delivered to the widget. If the application wishes to prevent this Activation from being delivered to the widget, it can change the consumed Boolean field in the call_data to TRUE inside the callback. This callback allows the application to perform some custom action in replacement of, or in addition to, the standard widget behavior.

Programmatically Activating Widgets

Since the widgets respond to Activation Types (not just X11 events), the application can easily simulate these user semantics by calling OlActivateWidget() with the desired Activation Type. For example, if an application wants text to scroll down in response to an OblongButton being pressed, it simply needs to put the following statement in the XtNselect callback for the button:
Activation Type Description
OlActivateWidget(scrolledwindow, OL_SCROLLDOWN, NULL);

OLIT also supports "associating" widgets with each other such that if a widget is activated with an Activation Type that it does not support, the Activation will be automatically passed on to an associated widget, called a "follower." Applications can associate widgets using the OlAssociateWidget() routine. For example, if an application wants any scrolling Activation Types to be passed from an OblongButton widget to a Scrollbar, the application simply needs to make the Scrollbar a "follower" of the OblongButton:
OlAssociateWidget(button, scrollbar, FALSE);

See "Initialization and Activation Functions" on page 92 for more information on programmatically activating widgets.

Mapping X11 Events to Activation Types

By making the widget respond to high-level Activation Types, as opposed to having it respond to particular X11 input events, this model allows more flexibility for both the user and the programmer. The Activation Types are mapped to actual X11 input events through a set of toolkit resources. These toolkit resources have a set of default bindings that the user can easily change using the standard resource mechanism. For example, the resources and default bindings for the Activation Types mentioned previously are the following:
Activation TypeResourceDefault BindingDescription
OL_MENUXtNmenuBtn<Button3>(MENU mouse button)
OL_MENUKEYXtNmenuKeya<Space>(Alt+Space key)
OL_SCROLLDOWNXtNscrollDownKeya<Down>(Alt+R14 key)
OL_NEXTFIELDXtNnextFieldKey<Tab>,c<Tab>(Tab or Control+Tab)
The syntax of the "Default Bindings" column is explained below. The OL_MENU Activation Type could be mapped instead to the MENU mouse button by putting the following line in a Resource file:
*menuBtn:    <Button2>

Activation Type Description

A complete table of the OLIT Activation Types and their default bindings is in Table 3-1 on page 65. The following abbreviations for modifier keys are used to shorten the "Default Bindings" column of the table, and can also be used in resource specifications:
No Modifiers     n           Meta key      m           Mod2 key      2
Alt key         a           Hyper key     h           Mod3 key      3
Ctrl key        c           Super key     su          Mod4 key      4
Shift key       s           Mod1 key      1           Mod5 key      5

There are three different ways to specify key bindings (and keyboard accelerators) in a resource file:
  1. A key event specified using a subset of the Xt translation manager syntax. The syntax is specified in EBNF notation, following the same conventions used in the Xt Intrinsics Reference Manual, Appendix B.

         keyseq           = [modifier_list] "<Key>" <keysym_name>
         modifier_list    = {modifier_name} | "None" | "n"
         modifier_name    = <see modifier names table above>

  1. The existing OLIT syntax, which is similar to the Xt translation manager syntax and maintained for backward compatibility.

         keyseq           = [modifier_list] "<" <keysym_name> ">"

  1. A general OpenWindows syntax that is understood by OLIT, xview(1), and olwm(1).

keyseq           = {[modifier_name] "+"} <keysym_name>

For example, to bind the SELECTKEY command to be activated when the space bar is pressed and the Meta modifier key ( . ) is held down, any of the following may be used:
    *selectKey: Meta<Key>space         ; Xt translation syntax
    *selectKey: Meta<space>            ; OLIT syntax
    *selectKey: Meta+space             ; generic syntax


Note - On keyboards that don't have an actual meta key, the meta-key event is generated by pressing the Control and Alt keys at the same time.

Up to two bindings may be specified for a virtual event as a comma-separated list; for example:
*selectKey: Meta<Key>space, Ctrl<Key>space

Activation Type Description
Keyboard accelerators may also be specified using any of the three methods, but only one binding can be associated with an accelerator.
Table 3-1
Activation TypeSemanticResource NameDefault Binding
OL_ADJUSTADJUSTXtNadjustBtn<Button2>
OL_ADJUSTKEYADJUSTKEYXtNadjustKeya<Insert>
OL_CANCELCANCELXtNcancelKey<Escape>
OL_CHARBAKCHARBAKXtNcharBakKey<Left>
OL_CHARFWDCHARFWDXtNcharFwdKey<Right>
OL_CONSTRAINCONSTRAINXtNconstrainBtns<Button1>
OL_COPYCOPYXtNcopyKey<F16>
OL_CUTCUTXtNcutKey<F20>
OL_DEFAULTACTIONDEFAULTACTIONXtNdefaultActionKey<Return>, c<Return>
OL_DELCHARBAKDELCHARBAKXtNdelCharBakKey<BackSpace>, <Delete>
OL_DELCHARFWDDELCHARFWDXtNdelCharFwdKeys<BackSpace>, c<d>
OL_DELLINEDELLINEXtNdelLineKeym<BackSpace>, m<Delete>
OL_DELLINEBAKDELLINEBAKXtNdelLineBakKeyc<BackSpace>, c<v>
OL_DELLINEFWDDELLINEFWDXtNdelLineFwdKeyc<Delete>, c<k>
OL_DELWORDBAKDELWORDBAKXtNdelWordBakKeys<BackSpace>, c<w>
OL_DELWORDFWDDELWORDFWDXtNdelWordFwdKeyc s<Delete>
OL_DOCENDDOCENDXtNdocEndKeyc<R13>
OL_DOCSTARTDOCSTARTXtNdocStartKeyc<R7>
OL_DRAGDRAGXtNdragKey<F5>
OL_DROPDROPXtNdropKey<F2>
OL_DUPLICATEDUPLICATEXtNduplicateBtnc<Button1>
OL_DUPLICATEKEYDUPLICATEKEYXtNduplicateKeys<space>
OL_HELPHELPXtNhelpKey<Help>
OL_HSBMENUHSBMENUXtNhorizSBMenuKeya<h>
OL_LINEENDLINEENDXtNlineEndKey<R13>, c<e>

Activation Type Description

Table 3-1
Activation TypeSemanticResource NameDefault Binding
OL_LINESTARTLINESTARTXtNlineStartKey<R7>, c<a>
OL_MENUMENUXtNmenuBtn<Button3>
OL_MENUDEFAULTMENUDEFAULTXtNmenuDefaultBtnc<Button3>
OL_MENUDEFAULTKEYMENUDEFAULTKEYXtNmenuDefaultKeyc<space>
OL_MENUKEYMENUKEYXtNmenuKeya<space>
OL_MOVEDOWNMOVEDOWNXtNdownKey<Down>
OL_MOVELEFTMOVELEFTXtNleftKey<Left>
OL_MOVERIGHTMOVERIGHTXtNrightKey<Right>
OL_MOVEUPMOVEUPXtNupKey<Up>
OL_MULTIDOWNMULTIDOWNXtNmultiDownKeyc<Down>
OL_MULTILEFTMULTILEFTXtNmultiLeftKeyc<Left>
OL_MULTIRIGHTMULTIRIGHTXtNmultiRightKeyc<Right>
OL_MULTIUPMULTIUPXtNmultiUpKeyc<Up>
OL_NEXT_FIELDNEXT_FIELDXtNnextFieldKey<Tab>, c<Tab>
OL_PAGEDOWNPAGEDOWNXtNpageDownKeya<R15>
OL_PAGELEFTPAGELEFTXtNpageLeftKeya c<R9>
OL_PAGERIGHTPAGERIGHTXtNpageRightKeya c<R15>
OL_PAGEUPPAGEUPXtNpageUpKeya<R9>
OL_PANPANXtNpanBtnc s <Button1>
OL_PANEENDPANEENDXtNpaneEndKeyc s<R13>
OL_PANESTARTPANESTARTXtNpaneStartKeyc s<R7>
OL_PASTEPASTEXtNpasteKey<F18>, c<y>
OL_PREV_FIELDPREV_FIELDXtNprevFieldKeys<Tab>, c s<Tab>
OL_PROPERTYPROPERTYXtNpropertiesKey<F13>
OL_RETURNRETURNXtNreturnKey<Return>
OL_ROWDOWNROWDOWNXtNrowDownKey<Down>
OL_ROWUPROWUPXtNrowUpKey<Up>
Activation Type Description
Table 3-1
Activation TypeSemanticResource NameDefault Binding
OL_SCROLLBOTTOMSCROLLBOTTOMXtNscrollBottomKeya c<R13>
OL_SCROLLDOWNSCROLLDOWNXtNscrollDownKeya<Down>
OL_SCROLLLEFTSCROLLLEFTXtNscrollLeftKeya<Left>
OL_SCROLLLEFTEDGESCROLLLEFTEDGEXtNscrollLeftEdgeKeya <R7>
OL_SCROLLRIGHTSCROLLRIGHTXtNscrollRightKeya<Right>
OL_SCROLLRIGHTEDGESCROLLRIGHTEDGEXtNscrollRightEdgeKeya <R13>
OL_SCROLLTOPSCROLLTOPXtNscrollTopKeya c<R7>
OL_SCROLLUPSCROLLUPXtNscrollUpKeya<up>
OL_SELCHARBAKSELCHARBAKXtNselCharBakKeys<Left>, s c<b>
OL_SELCHARFWDSELCHARFWDXtNselCharFwdKeys<Right>, s c<f>
OL_SELECTSELECTXtNselectBtn<Button1>
OL_SELECTKEYSELECTKEYXtNselectKey<space>
OL_SELFLIPENDSSELFLIPENDSXtNselFlipEndsKeya<Insert>
OL_SELLINESELLINEXtNselLineKeyc a<Left>
OL_SELLINEBAKSELLINEBAKXtNselLineBakKeys<R7>, s c<p>
OL_SELLINEFWDSELLINEFWDXtNselLineFwdKeys<R13>, s c<n>
OL_SELWORDBAKSELWORDBAKXtNselWordBakKeyc s<Left>
OL_SELWORDFWDSELWORDFWDXtNselWordFwdKeyc s<Right>
OL_STOPSTOPXtNstopKey<F11>
OL_TOGGLEPUSHPINTOGGLEPUSHPINXtNtogglePushpinKeyc<t>
OL_UNDOUNDOXtNundoKey<F14>
OL_VSBMENUVSBMENUXtNvertSBMenuKeya<v>
OL_WORDBAKWORDBAKXtNwordBakKeyc<Left>
OL_WORDFWDWORDFWDXtNwordFwdKeyc<Right>

Common Activation Types

Common Activation Types

All OLIT widget classes that accept input focus support the semantics described in section 2.3 of the OPEN LOOK Mouseless Specification and at least the Activation Types shown in Table 3-2.
Table 3-2
Activation TypeSemanticsResource Name
OL_CANCELCANCELXtNcancelKey
OL_DEFAULTACTIONDEFAULTACTIONXtNdefaultActionKey
OL_HELPHELPXtNhelpKey
OL_MOVEDOWNMOVEDOWNXtNdownKey
OL_MOVELEFTMOVELEFTXtNleftKey
OL_MOVERIGHTMOVERIGHTXtNrightKey
OL_MOVEUPMOVEUPXtNupKey
OL_NEXTFIELDNEXTFIELDXtNnextFieldKey
OL_PREVFIELDPREVFIELDXtNprevFieldKey
OL_TOGGLEPUSHPINTOGGLEPUSHPINXtNtogglePushpinKey
These activation types have the following meanings:
OL_CANCEL Redirect the OL_CANCEL activation type, delivering it to the first widget ancestor inclusive of the object receiving the activation that is an instance of vendorShellWidgetClass or a subclass thereof.
OL_DEFAULTACTION Redirect the OL_DEFAULTACTION activation type, delivering it to the first widget ancestor inclusive of the object receiving the activation that is an instance of vendorShellWidgetClass or a subclass thereof.
OL_HELP Invoke the system help facility. If the value of the toolkit resource XtNhelpModel is OL_POINTER, then help will be invoked for the object currently under the pointer at the time of activation; however, if the value of XtNhelpModel is OL_INPUTFOCUS, then help will be invoked for the object that currently holds input focus.
Common Activation Types
OL_MOVEDOWN Move the input focus from the current object to the object below the current holder of input focus in the traversal order. The definition of the object below the current holder of the input focus in the traversal order is context sensitive and system dependent.
OL_MOVELEFT/ OL_PREVFIELD
Move the input focus from the current object to the previous object in the traversal order. The definition of the previous object in the traversal order is context sensitive and system dependent.
OL_MOVERIGHT/ OL_NEXTFIELD
Move the input focus from the current object to the next object in the traversal order. The definition of the next object in the traversal order is context sensitive and system dependent.
OL_MOVEUP Move the input focus from the current object to the object above the current holder of input focus in the traversal order. The definition of the object above the current holder of the input focus in the traversal order is context sensitive and system dependent.
OL_TOGGLEPUSHPIN Redirect the OL_TOGGLEPUSHPIN activation type, delivering it to the first widget ancestor inclusive of the object receiving the activation that is an instance of vendorShellWidgetClass or a subclass thereof.

Common Activation Types