[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Widget Writer's Guide



The Instance Data Members of XmPrimitive

The XmPrimitive widget maintains the values of its resources inside the fields of the primitive structure. For example, the value of the XmNhighlightThickness resource is stored in the primitive.highlight_thickness field. Your primitive widget can access any of these fields. For example, the following code accesses the primitive.highlight_thickness field:

total_width_of_highlight = primitive.highlight_thickness * 2;

In addition to all the resource values, the primitive structure also holds several fields that are not tied to resources. Widget writers should become familiar with the fields shown in the following subsections.

The primitive.have_traversal Field

The have_traversal field is declared as follows:

Boolean   have_traversal;

This is a flag whose initial value is False. This flag becomes True only when both of the following happen:

  1. The keyboard focus policy is XmEXPLICIT.

  2. The widget gets the keyboard focus.

    When the widget loses keyboard focus, this flag is reset to False. Similarly, if the keyboard focus policy becomes XmPOINTER, this flag is reset to False.

  3. The primitive.highlighted Field

    The highlighted field is declared as follows:

    Boolean   highlighted;

    This is a flag. Widgets must set this flag to True after drawing a highlight around the widget's border. Widgets must set this flag to False after removing the highlight. The flag's initial value is False.

    The primitive.highlight_GC Field

    The highlight_GC field is declared as follows:

    GC        highlight_GC;

    The border_highlight method of the XmPrimitive widget uses this GC when rendering the border highlight.

    The primitive.highlight_GC contains the default GC generated by XtGetGC, except for the following differences:

    1. XmPrimitive sets the foreground field of the GC to the value of the XmNhighlightColor resource of XmPrimitive.

    2. XmPrimitive sets the background field of the GC to the value of the XmNbackground resource of Core.

      If the XmNhighlightPixmap resource of XmPrimitive contains something other than XmUNSPECIFIED_PIXMAP or None, then the highlight_GC also contains the following:

      1. If the depth of the pixmap in XmNhighlightPixmap is 1, then the fill_style field of the GC is set to FillOpaqueStipple. Furthermore, the stipple field of the GC is set to the pixmap in XmNhighlightPixmap.

      2. If the depth of the pixmap in XmNhighlightPixmap is greater than 1, then the fill_style field of the GC is set to FillTiled. Furthermore, the tile field of the GC is set to the pixmap in XmNhighlightPixmap.

      3. The primitive.top_shadow_GC Field

        The top_shadow_GC field is declared as follows:

        GC        top_shadow_GC;

        XmPrimitive uses primitive.top_shadow_GC when rendering the top shadow. The primitive.top_shadow_GC field contains the default GC generated by XtGetGC, except for the following differences:

        1. XmPrimitive sets the foreground field of the GC to the value of the XmNtopShadowColor resource of XmPrimitive.

        2. XmPrimitive sets the background field of the GC to the value of the XmNbackground resource of Core.

          If the XmNtopShadowPixmap resource of XmPrimitive contains something other than XmUNSPECIFIED_PIXMAP or None, then the highlight_GC also contains the following:

          1. If the depth of the pixmap in XmNtopShadowPixmap is 1, then the fill_style field of the GC is set to FillOpaqueStipple. Furthermore, the stipple field of the GC is set to the pixmap in XmNtopShadowPixmap.

          2. If the depth of the pixmap in XmNtopShadowPixmap is greater than 1, then the fill_style field of the GC is set to FillTiled. Furthermore, the tile field of the GC is set to the pixmap in XmNtopShadowPixmap.

          3. The primitive.bottom_shadow_GC Field

            The bottom_shadow_GC field is declared as follows:

            GC        bottom_shadow_GC;

            XmPrimitive uses primitive.bottom_shadow_GC when rendering the bottom shadow. The primitive..bottom_shadow_GC field contains the default GC generated by XtGetGC, except for the following differences:

            1. XmPrimitive sets the foreground field of the GC to the value of the XmNbottomShadowColor resource of XmPrimitive.

            2. XmPrimitive sets the background field of the GC to the value of the XmNbackground resource of Core.

              If the XmNbottomShadowPixmap resource of XmPrimitive contains something other than XmUNSPECIFIED_PIXMAP or None, then the highlight_GC also contains the following:

              1. If the depth of the pixmap in XmNbottomShadowPixmap is 1, then the fill_style field of the GC is set to FillOpaqueStipple. Furthermore, the stipple field of the GC is set to the pixmap in XmNbottomShadowPixmap.

              2. If the depth of the pixmap in XmNbottomShadowPixmap is greater than 1, then the fill_style field of the GC is set to FillTiled. Furthermore, the tile field of the GC is set to the pixmap in XmNbottomShadowPixmap.

              3. [ Previous | Next | Contents | Glossary | Home | Search ]