Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ SgColorChooser(3X) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



     NAME
          SgColorChooser - The ColorChooser widget class

     SYNOPSIS
          #include <Sgm/ColorC.h>


     VERSION
          This page documents the version of Sgm that accompanies
          Motif 1.2.

     DESCRIPTION
          ColorChooser is a dialog widget that provides a friendly and
          powerful user interface for selecting colors. The
          ColorChooser provides a color hexagon and color sliders that
          presents the color range in Hue, Saturation, Value, (HSV)
          and Red, Green, Blue, (RGB) color spaces.  Because of
          drawing speed considiration, the color hexagon and color
          sliders are available only if running under GL. For X only
          configuration there are Scale widget to replace the color
          sliders and there is no color hexagon.  The ColorChooser
          includes the following:


            ⊕  A menu for setting options for the color chooser.

            ⊕  A color hexagon that provides visual selection of the
               Hue and Saturation components of a color in an Hue,
               Saturation, Value, (HSV) color space.

            ⊕  Color slider for each of Hue, Saturation, Value, Red,
               Green, Blue color components. The color sliders are
               visible depening on the user color chooser menu
               selection.  Each of the color sliders and the color
               hexagon is accompanied with a text edit widget to view
               the exact value of the current color component and to
               set it's numerical value.

            ⊕  Two color swatches: one for showing the current
               selected color and one for enabling the user to atore a
               second color for reference.

            ⊕  Three or four buttons


          The default button labels are OK, Cancel, and Help.  By
          default an Apply button is also created; if the parent of
          the ColorChooser is a DialogShell it is managed, and
          otherwise it is unmanaged.  Additional children may be added
          to the ColorChooser after creation.  The first child is used
          as a work area. The work area is placed just below the menu
          bar.  Additional children are laid out in the following



     Page 1                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



          manner:


            ⊕  Buttons-All XmPushButton widgets or gadgets, and their
               subclasses are placed after the OK button in the order
               of their creation.

            ⊕  The layout of additional children that are not in the
               above categories is undefined.


          The user can select a color by manipulating the color
          hexagon and any of the six sliders or changing the value of
          a color components text widgets.

          The default configuration provides control for an HSV color
          space. The Hue and Saturation are controlled by the color
          hexagon and the Value is controlled by the value slider.

          Selecting to view the RGB sliders provides controls over RGB
          color space.  Selecting both RGB and HSV slider provide Hue
          and Saturation slider to manipulate the Hue and Saturation
          in addition the the color hexagon.

          The default value for the XmBulletinBoard resource
          XmNcancelButton is the Cancel button.  The default value for
          the XmBulletinBoard resource XmNdefaultButton is the OK
          button unless.

          For ColorChooser and its subclasses, the default value for
          XmNinitialFocus is the Hue text edit area.

        Classes
          ColorChooser inherits behavior and resources from Core,
          Composite, Constraint, XmManager, and XmBulletinBoard
          Classes.

          The class pointer is sgColorChooserWidgetClass.

          The class name is SgColorChooser.

        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 SgN or SgC
          prefix and use the remaining letters.  To specify one of the
          defined values for a resource in a .Xdefaults file, remove
          the Sg prefix and use the remaining letters (in either
          lowercase or uppercase, but include any underscores between
          words).  The codes in the access column indicate if the



     Page 2                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



          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).

                                      SgColorChooser Resource Set
     Name                         Class                  Type              Default           Access
     ______________________________________________________________________________________________
     XmNapplyCallback             XmCCallback            XtCallbackList    NULL              C
     XmNapplyLabelString          XmCApplyLabelString    XmString          dynamic           CSG
     XmNcancelCallback            XmCCallback            XtCallbackList    NULL              C
     XmNcancelLabelString         XmCCancelLabelString   XmString          dynamic C
     XmNokCallback                XmCCallback            XtCallbackList    NULL              C
     XmNokLabelString             XmCOkLabelString       XmString          dynamic           CSG
     XmNvalueChangedCallback      XmCCallback            XtCallbackList    NULL              C
     XmNdragCallback              XmCCallback            XtCallbackList    NULL              C
     SgNshowSliders               SgCShowSliders         SgRShowSliders    SgRGB_and_HSV     CSG
     SgNwysiwyg                   SgCWysiwyg              XmRBoolean       True              CSG
     SgNuseGl                     SgCUseGl                XmRBoolean       True              CSG
     SgNstoredColorLabelString    XmCXmString            XmString          "Stored Color"    CSG
     SgNcurrentColorLabelString   XmCXmString            XmString          "Current Color"   CSG
     SgNhueLabelString            XmCXmString            XmString          "Hue"             CSG
     SgNsaturationLabelString     XmCXmString            XmString          "Saturation"      CSG
     SgNvalueLabelString          XmCXmString            XmString          "Value"           CSG
     SgNredLabelString            XmCXmString            XmString          "Red"             CSG
     SgNgreenLabelString          XmCXmString            XmString          "Green"           CSG
     SgNblueLabelString           XmCXmString            XmString          "Blue"            CSG



          SgNapplyCallback
                    Specifies the list of callbacks called when the
                    user activates the Apply button.  The callback
                    reason is SgCRAPPLY.

          SgNapplyLabelString
                    Specifies the string label for the Apply button.
                    The default for this resource depends on the
                    locale.  In the C locale the default is "Apply".

          SgNcancelCallback
                    Specifies the list of callbacks called when the
                    user activates the Cancel button.  The callback
                    reason is SgCRCANCEL.

          SgNcancelLabelString
                    Specifies the string label for the Cancel button.
                    The default for this resource depends on the
                    locale.  In the C locale the default is "Cancel".

          SgNhelpLabelString
                    Specifies the string label for the Help button.
                    The default for this resource depends on the



     Page 3                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



                    locale.  In the C locale the default is "Help".

          SgNokCallback
                    Specifies the list of callbacks called when the
                    user activates the OK button.  The callback reason
                    is SgCROK.  If the selection text does not match
                    a list item, and SgNmustMatch is True, the
                    SgNnoMatchCallback callbacks are called instead.

          SgNokLabelString
                    Specifies the string label for the OK button.  The
                    default for this resource depends on the locale.
                    In the C locale the default is "OK".

          SgNvalueChangedCallback
                    Specifies the list of callbacks called when the
                    user selects a color.  The callback reason is
                    XmCRVALUECHANGED.  A color is selected when the
                    user changes the value of a color component via
                    the color hexagon, one of the color sliders, or
                    one of the color components text widgets.

          SgNdragCallback
                    Specifies the list of callbacks called when the
                    user drags the mouse over the color hexagon or one
                    of the color sliders to select a color.  The
                    callback reason is XmCRDRAG.

          SgNshowSliders
                    Specifies which color slider is visible. If the
                    useGl resource is False, then SgNshowSliders
                    specifies which color scales are visible.
                    Possible values are:

          SgNstoredColorLabelString
                    Specifies the string label for the Stored Color
                    button.

          SgNcurrentColorLabelString
                    Specifies the string label for the Current Color
                    button.

          SgNhueLabelString
                    Specifies the string label for the Hue button.

          SgNsaturationLabelString
                    Specifies the string label for the Saturation
                    button.

          SgNvalueLabelString
                    Specifies the string label for the Value button.




     Page 4                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



          SgNredLabelString
                    Specifies the string label for the Red button.

          SgNgreenLabelString
                    Specifies the string label for the Green button.

          SgNblueLabelString
                    Specifies the string label for the Blue button.


                      ⊕  SgValue Show only the slider for the color
                         Value

                      ⊕  SgRGBandValue Show the Value and RGB
                         sliders

                      ⊕  SgRGBandHSV Show all six sliders, the HSV
                         and RGB sliders


          SgNwysiwyg
                    Specifies whether the wysiwyg mode is True or
                    False. If the wysiwyg mode is True, then the
                    sliders and hexagon change color to show the color
                    that will be selected in each point of the hexagon
                    or slider.  If the wysiwyg mode is False, then the
                    hexagon color always shows with Value (intensity)
                    equals 1 (maximum intensity) and the RGB sliders
                    shows color range of black to max RGB color
                    component value.  For example, if the current
                    selected color RGB value is (100, 200, 50), then
                    with wysiwyg mode True the Red color slider will
                    have the colors (0, 200, 50)-(255, 200, 50), and
                    with wysiwyg mode False the range
                     (0, 0, 0) - (233, 0, 0).  Note that this mode is
                    meaninful only if useGl resource is True.

          SgNuseGl  Specifies whether to set the useGl mode to True or
                    False. If the useGl mode is True then the color
                    hexagon and color sliders are visble.  The color
                    hexagon and color sliders use GL's Gouraud shading
                    to display the colors in the hexagon and sliders.
                    If useGl mode is False then the widget uses only X
                    calls. In this case there will be no color
                    hexagon, and the color sliders are replaced with
                    XmScale widgets.


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



     Page 5                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



                               SgBulletinBoard Resource Set
     Name                  Class                Type             Default        Access
     _________________________________________________________________________________
     XmNallowOverlap       XmCAllowOverlap      Boolean          True           CSG
     XmNautoUnmanage       XmCAutoUnmanage      Boolean          True           CG
     XmNbuttonFontList     XmCButtonFontList    XmFontList       dynamic        CSG
     XmNcancelButton       XmCWidget            Widget           dynamic        SG
     XmNdefaultButton      XmCWidget            Widget           dynamic        SG
     XmNdefaultPosition    XmCDefaultPosition   Boolean          True           CSG
     XmNdialogStyle        XmCDialogStyle       unsigned char    dynamic        CSG
     XmNdialogTitle        XmCDialogTitle       XmString         NULL           CSG
     XmNfocusCallback      XmCCallback          XtCallbackList   NULL           C
     XmNlabelFontList      XmCLabelFontList     XmFontList       dynamic        CSG
     XmNmapCallback        XmCCallback          XtCallbackList   NULL           C
     XmNmarginHeight       XmCMarginHeight      Dimension        10             CSG
     XmNmarginWidth        XmCMarginWidth       Dimension        10             CSG
     XmNnoResize           XmCNoResize          Boolean          False          CSG
     XmNresizePolicy       XmCResizePolicy      unsigned char    XmRESIZE_ANY   CSG
     XmNshadowType         XmCShadowType        unsigned char    XmSHADOW_OUT   CSG
     XmNtextFontList       XmCTextFontList      XmFontList       dynamic        CSG
     XmNtextTranslations   XmCTranslations      XtTranslations   NULL           C
     XmNunmapCallback      XmCCallback          XtCallbackList   NULL           C

                                          XmManager Resource Set
     Name                    Class                   Type                Default                Access
     _________________________________________________________________________________________________
     XmNbottomShadowColor    XmCBottomShadowColor    Pixel               dynamic                CSG
     XmNbottomShadowPixmap   XmCBottomShadowPixmap   Pixmap              XmUNSPECIFIED_PIXMAP   CSG
     XmNforeground           XmCForeground           Pixel               dynamic                CSG
     XmNhelpCallback         XmCCallback             XtCallbackList      NULL                   C
     XmNhighlightColor       XmCHighlightColor       Pixel               dynamic                CSG
     XmNhighlightPixmap      XmCHighlightPixmap      Pixmap              dynamic                CSG
     XmNinitialFocus         XmCInitialFocus         Widget              dynamic                CSG
     XmNnavigationType       XmCNavigationType       XmNavigationType    XmTAB_GROUP            CSG
     XmNshadowThickness      XmCShadowThickness      Dimension           dynamic                CSG
     XmNstringDirection      XmCStringDirection      XmStringDirection   dynamic                CG
     XmNtopShadowColor       XmCTopShadowColor       Pixel               dynamic                CSG
     XmNtopShadowPixmap      XmCTopShadowPixmap      Pixmap              dynamic                CSG
     XmNtraversalOn          XmCTraversalOn          Boolean             True                   CSG
     XmNunitType             XmCUnitType             unsigned char       dynamic                CSG
     XmNuserData             XmCUserData             XtPointer           NULL                   CSG

                             Composite Resource Set
     Name                Class               Type          Default   Access
     ______________________________________________________________________
     XmNchildren         XmCReadOnly         WidgetList    NULL      G
     XmNinsertPosition   XmCInsertPosition   XtOrderProc   NULL      CSG
     XmNnumChildren      XmCReadOnly         Cardinal      0         G

                                                   Core Resource Set





     Page 6                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



     Name                            Class                           Type             Default                Access
     ______________________________________________________________________________________________________________
     XmNaccelerators                 XmCAccelerators                 XtAccelerators   dynamic                N/A
     XmNancestorSensitive            XmCSensitive                    Boolean          dynamic                G
     XmNbackground                   XmCBackground                   Pixel            dynamic                CSG
     XmNbackgroundPixmap             XmCPixmap                       Pixmap           XmUNSPECIFIED_PIXMAP   CSG
     XmNborderColor                  XmCBorderColor                  Pixel            XtDefaultForeground    CSG
     XmNborderPixmap                 XmCPixmap                       Pixmap           XmUNSPECIFIED_PIXMAP   CSG
     XmNborderWidth                  XmCBorderWidth                  Dimension        0                      CSG
     XmNcolormap                     XmCColormap                     Colormap         dynamic                CG
     XmNdepth                        XmCDepth                        int              dynamic                CG
     XmNdestroyCallback              XmCCallback                     XtCallbackList   NULL                   C
     XmNheight                       XmCHeight                       Dimension        dynamic                CSG
     XmNinitialResourcesPersistent   XmCInitialResourcesPersistent   Boolean          True                   C
     XmNmappedWhenManaged            XmCMappedWhenManaged            Boolean          True                   CSG
     XmNscreen                       XmCScreen                       Screen *         dynamic                CG
     XmNsensitive                    XmCSensitive                    Boolean          True                   CSG
     XmNtranslations                 XmCTranslations                 XtTranslations   dynamic                CSG
     XmNwidth                        XmCWidth                        Dimension        dynamic                CSG
     XmNx                            XmCPosition                     Position         0                      CSG
     XmNy                            XmCPosition                     Position         0                      CSG

        Callback Information
          A pointer to the following structure is passed to each
          callback:

          typedef struct
          {
            int          reason;
            XEvent       * event;
            short        r, g, b;
          } XmColorChooserCallbackStruct;


          reason Indicates why the callback was invoked.

          event  Points to the XEvent that triggered the callback.

          r      Indicates the red color component of the currently
                 selected color.

          g      Indicates the green color component of the currently
                 selected color.

          b      Indicates the blue color component of the currently
                 selected color.


          The color components range from 0 (no intensity) to 255
          (maximum intensity).  This is the same range used by Iris GL
          (RGBColor(3G)).




     Page 7                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



        Translations
          XmColorChooser inherits translations from XmBulletinBoard.

        Additional Behavior
          The ColorChooser widget has the additional behavior
          described below:


          MAny KCancel:
                    Calls the activate callbacks for the cancel button
                    if it is sensitive.  If no cancel button exists
                    and the parent of the ColorChooser is a manager,
                    passes the event to the parent.

          KActivate:
                    Calls the activate callbacks for the button with
                    the keyboard focus.  If no button has the keyboard
                    focus, calls the activate callbacks for the
                    default button if it is sensitive.

          <OK Button Activated>:
                    Calls the XmNokCallback callbacks with reason
                    XmCROK.

          <Apply Button Activated>:
                    Calls the XmNapplyCallback callbacks with reason
                    XmCRAPPLY.

          <Cancel Button Activated>:
                    Calls the XmNcancelCallback callbacks with reason
                    XmCRCANCEL.

          <Help Button Activated>:
                    Calls the XmNhelpCallback callbacks with reason
                    XmCRHELP.

          <MapWindow>:
                    Calls the callbacks for XmNmapCallback if the
                    ColorChooser is a child of a Dialog shell.

          <UnmapWindow>:
                    Calls the callbacks for XmNunmapCallback if the
                    ColorChooser is the child of a DialogShell.


        Virtual Bindings
          The bindings for virtual keys are vendor specific.  For
          information about bindings for virtual buttons and keys, see
          VirtualBindings(3X).

     RELATED INFORMATION
          Composite(3X), Constraint(3X), Core(3X),



     Page 8                                          (printed 4/30/98)





     SgColorChooser(3X)        UNIX System V        SgColorChooser(3X)



          XmBulletinBoard(3X), SgCreateColorChooser(3X),
          SgCreateColorChooserDialog(3X), XmManager(3X),
          SgColorChooserSetColor(3X), SgColorChooserGetColor(3X),
          SgColorChooserSetCurrentColor(3X),
          SgColorChooserSetStoredColor(3X), and RGBColor(3G).


















































     Page 9                                          (printed 4/30/98)



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