Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XmToggleBuB(Xm) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought


     XmToggleButtonGadget(Xm)                       UNIX System V



     NAME
          XmToggleButtonGadget - the ToggleButtonGadget widget class.



     SYNOPSIS
          #include <Xm/ToggleBG.h>



     DESCRIPTION
          ToggleButtonGadget sets nontransitory state data  within  an
          application.   Usually  this gadget consists of an indicator
          (square or diamond) with either text  or  a  pixmap  to  its
          right.   However,  it  can  also  consist  of just text or a
          pixmap without the indicator.

          The  toggle  graphics  display  a  1-of-many  or   N-of-many
          selection  state.   When  a toggle indicator is displayed, a
          square indicator shows a N-of-many  selection  state  and  a
          diamond indicator shows a 1-of-many selection state.

          ToggleButtonGadget implies a selected or  unselected  state.
          In  the case of a label and an indicator, an empty indicator
          (square or diamond shaped) indicates that ToggleButtonGadget
          is  unselected,  and  a  filled  indicator  shows that it is
          selected.  In the case of a pixmap toggle, different pixmaps
          are used to display the selected/unselected states.

          Normally, mouse button 1 is used to  arm  and  activate  the
          button.  However, if the ToggleButtonGadget resides within a
          menu, then the  mouse  button  used  is  determined  by  the
          RowColumn resources XmNrowColumnType and XmNwhichButton.

          To accommodate the toggle indicator  when  created,  Label's
          resource XmNmarginLeft may be increased.


        Classes
          ToggleButtonGadget  inherits  behavior  and  resources  from
          Object, RectObj, XmGadget and XmLabelGadget classes.

          The class pointer is xmToggleButtonGadgetClass.

          The class name is XmToggleButtonGadget.


        New Resources
          The following table defines a set of widget  resources  used
          by  the programmer to specify data.  The programmer can also
          set the resource values for the  inherited  classes  to  set
          attributes for this widget.  To reference a resource by name
          or by class in a .Xdefaults file,  remove  the  XmN  or  XmC
          prefix and use the remaining letters.  To specify one of the
          defined values for a resource in a .Xdefaults  file,  remove
          the Xm prefix and use the remaining letters (in either lower
          case or upper case,  but  include  any  underscores  between
          words).   The  codes  in  the  access column indicate if the
          given resource can be set at creation time (C), set by using
          XtSetValues  (S),  retrieved by using XtGetValues (G), or is
          not applicable (N/A).

                                    XmToggleButtonGadget Resource Set
     Name                       Class                      Type           Default              Access
     ________________________________________________________________________________________________
     XmNarmCallback             XmCArmCallback             XtCallbackList NULL                 C
     XmNdisarmCallback          XmCDisarmCallback          XtCallbackList NULL                 C
     XmNfillOnSelect            XmCFillOnSelect            Boolean        True                 CSG
     XmNindicatorOn             XmCIndicatorOn             Boolean        True                 CSG
     XmNindicatorType           XmCIndicatorType           unsigned char  XmN_OF_MANY          CSG
     XmNselectColor             XmCSelectColor             Pixel          dynamic              CSG
     XmNselectInsensitivePixmap XmCSelectInsensitivePixmap Pixmap         XmUNSPECIFIED_PIXMAP CSG
     XmNselectPixmap            XmCSelectPixmap            Pixmap         XmUNSPECIFIED_PIXMAP CSG
     XmNset                     XmCSet                     Boolean        False                CSG
     XmNspacing                 XmCSpacing                 short          4                    CSG
     XmNvalueChangedCallback    XmCValueChangedCallback    XtCallbackList NULL                 C
     XmNvisibleWhenOff          XmCVisibleWhenOff          Boolean        True                 CSG


          XmNarmCallback
               Specifies a list of callbacks that is called  when  the
               ToggleButtonGadget  is armed. To arm this gadget, press
               the active mouse button while the pointer is inside the
               ToggleButtonGadget.  For  this  callback, the reason is
               XmCRARM.

          XmNdisarmCallback
               Specifies a list  of  callbacks  that  is  called  when
               ToggleButtonGadget  is disarmed. To disarm this gadget,
               press and release the active  mouse  button  while  the
               pointer  is  inside the ToggleButtonGadget.  The gadget
               is also disarmed when the user moves out of the  gadget
               and  releases  the  mouse  button  when  the pointer is
               outside the gadget. For this callback,  the  reason  is
               XmCRDISARM.

          XmNfillOnSelect
               Fills  the  indicator  with  the  color  specified   in
               XmNselectColor  and  switches the top and bottom shadow
               colors when set to True. Otherwise,  it  switches  only
               the top and bottom shadow colors.

          XmNindicatorOn
               Specifies that a toggle indicator is drawn to the  left
               of  the  toggle  text or pixmap when set to True.  When
               set to False, no space is allocated for the  indicator,
               and  it  is  not displayed.  If XmNindicatorOn is True,
               the indicator shadows are switched when the  button  is
               selected  or  unselected,  but  any  shadows around the
               entire  gadget   are   not   switched.    However,   if
               XmNindicatorOn  is False, any shadows around the entire
               gadget are switched when  the  toggle  is  selected  or
               unselected.

          XmNindicatorType
               Specifies if the indicator is a 1-of or N-of indicator.
               For  the  1-of  indicator,  the value is XmONEOFMANY.
               For the N-of indicator, the value is XmNOFMANY.   The
               N-of-many  is a square-shaped indicator.  The 1-of-many
               is a  diamond-shaped  indicator.   This  resource  only
               specifies   the   visuals  and  does  not  enforce  the
               behavior.   When  the  ToggleButtonGadget   is   in   a
               RadioBox,   the   parent   forces   this   resource  to
               XmONEOFMANY.

          XmNselectColor
               Allows the application to specify what color fills  the
               center  of  the  square or diamond indicator when it is
               set.  If this color is the same as either  the  top  or
               bottom  shadow color of the indicator, a one-pixel-wide
               margin is  left  between  the  shadows  and  the  fill;
               otherwise,  it  is  filled completely.  This resource's
               default for a color display  is  a  color  between  the
               background  and  bottom shadow color.  For a monochrome
               display, the default is set to the foreground color.

          XmNselectInsensitivePixmap
               Specifies a pixmap used as the  button  face  when  the
               ToggleButtonGadget   is  selected  and  the  button  is
               insensitive if the LabelGadget resource XmNlabelType is
               XmPIXMAP.   If the ToggleButtonGadget is unselected and
               the   button   is   insensitive,    the    pixmap    in
               XmNlabelInsensitivePixmap is used as the button face.

          XmNselectPixmap
               Specifies the pixmap to be used as the button  face  if
               XmNlabelType  is XmPIXMAP and the ToggleButtonGadget is
               selected. When the  ToggleButtonGadget  is  unselected,
               the pixmap specified in Label's XmNlabelPixmap is used.

          XmNset
               Displays the button in its selected  state  if  set  to
               True.  This  shows some conditions as active when a set
               of buttons first appear.

          XmNspacing
               Specifies the amount  of  spacing  between  the  toggle
               indicator and the toggle label (text or pixmap).

          XmNvalueChangedCallback
               Specifies a list of callbacks that is called  when  the
               ToggleButtonGadget  value  is  changed.   To change the
               value, press and release the active mouse button  while
               the  pointer  is  inside  the ToggleButtonGadget.  This
               action also causes the gadget to be disarmed. For  this
               callback, the reason is XmCRVALUECHANGED.

          XmNvisibleWhenOff
               Indicates that the toggle indicator is visible  in  the
               unselected  state when the Boolean value is True.  When
               the ToggleButtonGadget is  in  a  menu,  the  RowColumn
               parent   forces  this  resource  to  False.   When  the
               ToggleButtonGadget is in a RadioBox, the parent  forces
               this resource to True.


        Inherited Resources
          ToggleButtonGadget inherits behavior and resources from  the
          following superclasses.  For a complete description of these
          resources, refer to the man page for that superclass.

                                          XmLabelGadget Resource Set
     Name                      Class                     Type              Default                   Access
     ______________________________________________________________________________________________________
     XmNaccelerator            XmCAccelerator            String            NULL                      CSG
     XmNacceleratorText        XmCAcceleratorText        XmString          NULL                      CSG
     XmNalignment              XmCAlignment              unsigned char     XmALIGNMENT_CENTER        CSG
     XmNfontList               XmCFontList               XmFontList        "Fixed"                   CSG
     XmNlabelInsensitivePixmap XmCLabelInsensitivePixmap Pixmap            XmUNSPECIFIED_PIXMAP      CSG
     XmNlabelPixmap            XmCPixmap                 Pixmap            XmUNSPECIFIED_PIXMAP      CSG
     XmNlabelString            XmCXmString               XmString          NULL                      CSG
     XmNlabelType              XmCLabelType              unsigned char     XmSTRING                  CSG
     XmNmarginBottom           XmCMarginBottom           short             0                         CSG
     XmNmarginHeight           XmCMarginHeight           short             2                         CSG
     XmNmarginLeft             XmCMarginLeft             short             dynamic                   CSG
     XmNmarginRight            XmCMarginRight            short             0                         CSG
     XmNmarginTop              XmCMarginTop              short             0                         CSG
     XmNmarginWidth            XmCMarginWidth            short             2                         CSG
     XmNmnemonic               XmCMnemonic               char              `\0'                      CSG
     XmNrecomputeSize          XmCRecomputeSize          Boolean           True                      CSG
     XmNstringDirection        XmCStringDirection        XmStringDirection XmSTRING_DIRECTION_L_TO_R CSG

                                   XmGadget Resource Set
     Name                    Class                   Type             Default    Access
     __________________________________________________________________________________
     XmNhelpCallback         XmCCallback             XtCallbackList   NULL       C
     XmNhighlightOnEnter     XmCHighlightOnEnter     Boolean          False      CSG
     XmNhighlightThickness   XmCHighlightThickness   short            0          CSG
     XmNshadowThickness      XmCShadowThickness      short            0          CSG
     XmNtraversalOn          XmCTraversalOn          Boolean          False      CSG
     XmNunitType             XmCUnitType             unsigned char    XmPIXELS   CSG
     XmNuserData             XmCUserData             caddr_t          NULL       CSG

                                 RectObj Resource Set
     Name                   Class            Type        Default            Access
     _____________________________________________________________________________
     XmNancestorSensitive   XmCSensitive     Boolean     XtCopyFromParent   CSG
     XmNborderWidth         XmCBorderWidth   Dimension   0                  CSG
     XmNheight              XmCHeight        Dimension   0                  CSG
     XmNsensitive           XmCSensitive     Boolean     True               CSG
     XmNwidth               XmCWidth         Dimension   0                  CSG
     XmNx                   XmCPosition      Position    0                  CSG
     XmNy                   XmCPosition      Position    0                  CSG


        Callback Information
          The following structure is returned with each callback:

          typedef struct
          {
            int          reason;
            XEvent       * event;
            Boolean      set;
          } XmToggleButtonCallbackStruct;


          reason Indicates why the callback was invoked.

          event  Points to the XEvent that triggered the callback.

          set    Reflects the ToggleButtonGadget's current state  when
                 the  callback  occurred,  either  True  (selected) or
                 False (unselected).


        Behavior
          ToggleButtonGadget is associated with the  default  behavior
          unless  it  is part of a menu system.  In a menu system, the
          RowColumn parent determines which mouse button is used.


          Default Behavior

          <Btn1Down>:
               (if unset): This action  arms  the  ToggleButtonGadget.
               The  indicator shadow is drawn so that the button looks
               depressed, and  the  indicator  fills  with  the  color
               specified   in   XmNselectColor.    The  callbacks  for
               XmNarmCallback are also called.

               (if set):  This  action  arms  the  ToggleButtonGadget.
               The  indicator shadow is drawn so that the button looks
               raised, and the indicator  fills  with  the  background
               color.   The  callbacks  for  XmNarmCallback  are  also
               called.

          <Btn1Up>:

               (In Button):

               (if    unset):      This     action     selects     the
               ToggleButtonGadget.   Visually,  it appears the same as
               when    it    is    armed.     The    callbacks     for
               XmvalueChangedCallback    are   called,   followed   by
               callbacks for XmdisarmCallback.

               (if    set):      This     action     unselects     the
               ToggleButtonGadget.   Visually,  it appears the same as
               when    it    is    armed.     The    callbacks     for
               XmvalueChangedCallback    are   called,   followed   by
               callbacks for XmdisarmCallback.

               (Outside Of Button):

               If  the  button   release   occurs   outside   of   the
               ToggleButtonGadget, the callbacks for XmNdisarmCallback
               are called.

          <Leave Window>:
               If the button is pressed  and  the  cursor  leaves  the
               gadget,  it  visually reverts to its previous unpressed
               state.

          <Enter Window>:
               If the button is pressed  and  the  cursor  leaves  and
               reenters  the  gadget,  it visually appears the same as
               when the button was first armed.

          Default PopupMenu System

          <Btn3Down>:
               This action disables keyboard traversal  for  the  menu
               and returns the user to drag mode, which is the mode in
               which the menu is manipulated by using the mouse.  This
               action  also causes the ToggleButtonGadget to be armed.
               A shadow is drawn around the  ToggleButtonGadget.   The
               callbacks for XmNarmCallback are also called.

          <Btn3Up>:
               (if    unset):      This     action     selects     the
               ToggleButtonGadget.   The  indicator shadow is drawn so
               that it looks depressed, and the indicator  fills  with
               the color specified in XmNselectColor. The menu is then
               unposted and the callbacks  for  XmvalueChangedCallback
               are called, followed by callbacks for XmdisarmCallback.

               (if    set):      This     action     unselects     the
               ToggleButtonGadget.   The  indicator shadow is drawn so
               that it looks raised, and the indicator fills with  the
               background  color.   The  menu is then unposted and the
               callbacks  for   XmvalueChangedCallback   are   called,
               followed by callbacks for XmdisarmCallback.

          <Leave Window>:
               Pressing button two and moving the cursor  out  of  the
               widget's   window   erases   the   shadow   around  the
               ToggleButtonGadget.  This event is ignored if  keyboard
               traversal is enabled in the menu.

          <Enter Window>:
               Pressing button two and  moving  the  cursor  into  the
               widget's    window    draws   a   shadow   around   the
               ToggleButtonGadget.  This event is ignored if  keyboard
               traversal is enabled in the menu.

          <Key>Return:
               If keyboard traversal is  enabled  in  the  menu,  this
               event sets or unsets the ToggleButtonGadget.

               (if unset):   The  ToggleButtonGadget  gets  set.   The
               indicator  shadow is drawn so that looks depressed, and
               the  indicator  fills  with  the  color  specified   in
               XmNselectColor.

               (if set):   The  ToggleButtonGadget  gets  unset.   The
               indicator  shadow is drawn so that it looks raised, and
               the indicator fills with the background color.

               For both set and unset cases, the menu is then unposted
               and   the   callbacks  for  XmvalueChangedCallback  are
               called, followed by callbacks for XmdisarmCallback.


          Default PulldownMenu System and OptionMenu System

          <Btn1Down>:
               This action disables keyboard traversal  for  the  menu
               and  returns  the  user to drag mode (the mode in which
               the menu is manipulated using the mouse).  This  action
               also  arms  the  ToggleButtonGadget.  A shadow is drawn
               around  the  ToggleButtonGadget.   The  callbacks   for
               XmNarmCallback are also called.

          <Btn1Up>:
               (if    unset):      This     action     selects     the
               ToggleButtonGadget.   The  indicator shadow is drawn so
               that it looks depressed, and the indicator  fills  with
               the  color  specified in XmNselectColor.  The menu then
               unposts, and the callbacks  for  XmvalueChangedCallback
               are called, followed by callbacks for XmdisarmCallback.

               (if    set):      This     action     unselects     the
               ToggleButtonGadget.   The  indicator shadow is drawn so
               that it looks raised, and the indicator fills with  the
               background  color.   The  menu  then  unposts,  and the
               callbacks  for   XmvalueChangedCallback   are   called,
               followed by callbacks for XmdisarmCallback.

          <Leave Window>:
               Pressing button one and moving the cursor  out  of  the
               widget's   window   erases   the   shadow   around  the
               ToggleButtonGadget.  This event is ignored if  keyboard
               traversal is enabled in the menu.

          <Enter Window>:
               Pressing button one and  moving  the  cursor  into  the
               widget's    window    draws   a   shadow   around   the
               ToggleButtonGadget.  This event is ignored if  keyboard
               traversal is enabled in the menu.

          <Key>Return:
               This event sets or  unsets  the  ToggleButtonGadget  if
               keyboard traversal is enabled in the menu.

               (if  unset):  The  ToggleButtonGadget  gets  set.   The
               indicator  shadow  is drawn so that it looks depressed,
               and the indicator fills with  the  color  specified  in
               XmNselectColor.

               (if set):   The  ToggleButtonGadget  gets  unset.   The
               indicator  shadow is drawn so that it looks raised, and
               the indicator fills with the background color.

               For both set and unset cases, the  menu  then  unposts,
               and   the   callbacks  for  XmvalueChangedCallback  are
               called, followed by callbacks for XmdisarmCallback.
        Keyboard Traversal
          For information on keyboard traversal when  not  in  a  menu
          system,  see  the man page for XmGadget(Xm) and its sections
          on   behavior   and   default   translations.    When    the
          ToggleButtonGadget   is  in  a  menu  system,  the  keyboard
          traversal translations are defined by the RowColumn parent.


     RELATED INFORMATION
          Object(Xm), RectObj(Xm), XmCreateToggleButtonGadget(Xm),
          XmGadget(Xm), XmLabelGadget(Xm), XmRowColumn(Xm),
          XmToggleButtonGadgetGetState(Xm), and
          XmToggleButtonGadgetSetState(Xm).



     (printed 2/14/90)                   XmToggleButtonGadget(Xm)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026