SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

/*********************************************************** Copyright 1993 Interleaf, Inc.

Permission to use, copy, modify, and distribute this software and its documentation for any purpose without fee is granted, provided that the above copyright notice appear in all copies and that both copyright notice and this permission notice appear in supporting documentation, and that the name of Interleaf not be used in advertising or publicly pertaining to distribution of the software without specific written prior permission.

Interleaf makes no representation about the suitability of this software for any purpose. It is provided "AS IS" without any express or implied warranty.
******************************************************************/

Issues

TextField only uses 1st segment of items XmString.

11/99: JRA - Removed all tabs from the source code. Developers who use

tabs should be shot at dawn.
11/99: JRA - Added XmNspinButtonTextFontList and XmNspinButtonLabelFontList. 11/99: JRA - Added XmNhorizontalSpacing and XmNverticalSpacing to the

spin button widget. I pulled this code over from the combo box widget. 11/99: JRA - Added XmNspinButtonTextFontList and XmNspinButtonLabelFontList. 11/99: JRA - Added XmIsSpinButton

  1. SpinButton Widget

1.1 Widget Class Name

SpinButton

1.2 Synopsis

#include "SpinButton.h"

widget = XmCreateSpinButton(parent, name, arglist, num_args); XtManageChild(widget);

1.3 Description

1.4 Resources

    Property                Type                Init                  Access
    --------                ----                ----                  ------
    XmNactivateCallback     CallbackList        NULL                  CSG
    XmNalignment            unsigned char       XmALIGNMENT_BEGINNING CSG
    XmNarrowLayout          unsigned char       XmARROWS_BEGINNING    CSG
    XmNarrowSensitivity     unsigned char       XmARROWS_SENSITIVE    CSG
    XmNarrowSize            Dimension           dynamic                 G
    XmNchildType            unsigned char       XmSTRING              CSG
    XmNcolumns              Short               20                    CSG
    XmNdecimalPoints        Short               0                     CSG
    XmNeditable             Boolean             TRUE                  CSG
    XmNfocusCallback        CallbackList        NULL                  CSG
    XmNhorizontalSpacing    Dimension           INVALID_DIMENSION     CSG
    XmNinitialDelay         Unsigned Integer    250                   CSG
    XmNincrement            Integer             1                     CSG
    XmNitemCount            Unsigned Integer    0                     CSG
    XmNitems                XmStringTable       NULL                  CSG
    XmNspinButtonLabelFontList XmFontList       NULL                  CSG
    XmNlosingFocusCallback  CallbackList        NULL                  CSG
    XmNmarginHeight         Dimension           2                     CSG
    XmNmarginWidth          Dimension           2                     CSG
    XmNmaximum              Integer             1                     CSG
    XmNmaxLength            Integer             MAXINT                CSG
    XmNminimum              Integer             0                     CSG
    XmNmodifyVerifyCallback CallbackList        NULL                  CSG
    XmNposition             Unsigned Integer    0                     CSG
    XmNrecomputeSize        Boolean             TRUE                  CSG
    XmNrepeatDelay          Unsigned Integer    200                   CSG
    XmNtextField            Widget              NULL                    G
    XmNspinButtonTextFontList XmFontList        NULL                  CSG
    XmNvalueChangedCallback CallbackList        NULL                  CSG
    XmNverticalSpacing      Dimension           INVALID_DIMENSION     CSG
    XmNwrap                 Boolean             TRUE                  CSG
XmNactivateCallback

List of callbacks called when the user does KActivate in the text-field widget (when SpinButton is editable). See also XmTextFieldWidget.

XmNalignment

Alignment of the text within the non-editable label. This only gets used if XmNeditable is FALSE. Values are:

XmALIGNMENT_CENTER, XmALIGNMENT_BEGINNING, XmALIGNMENT_END See also XmLabelWidget

XmNarrowLayout

Specifies location of arrows. Legal values are: XmARROWS_FLAT_BEGINNING, XmARROWS_FLAT_END, XmARROWS_SPLIT, XmARROWS_BEGINNING, XmARROWS_END

XmNarrowSensitivity

Specifies the sensitivity of the up and down arrows in the widget. The legal values are:

XmARROWS_SENSITIVE - both sensitive XmARROWS_LEFT_SENSITIVE - Up arrow sensitive,

Down arrow insensitive XmARROWS_RIGHT_SENSITIVE - Down arrow sensitive,

Up arrow insensitive XmARROWS_INSENSITIVE - both insensitive

XmNarrowSize

The SpinButton widget calculates the arrow_size dynamically based on the size of the text-field or label (which is determined by font-size). This resource is gettable only and is here for semi-compatability with the Motif API.

XmNcolumns

This resource is passed on to the text-field widget. See also XmTextFieldWidget.

XmNdecimalPoints

This resource is used to position the decimal point within the integer value (only used when childType is XmNUMERIC). All numeric resources use integer values; use this resource to get floats.

XmNeditable

If FALSE, a label is put in the SpinButton; otherwise, an editable text-field is used.

XmNfocusCallback

List of callbacks called when the text-field widget accepts focus (when SpinButton is editable). See also XmTextFieldWidget.

XmNhorizontalSpacing

The horizontal distance surrounding the combo box and its contents (in pixels).

XmNincrement

If XmNchildType is XmNUMERIC, this is the amount that the number will increment/decrement by when the arrows are clicked.

XmNinitialDelay

Specifies the amount of time in milliseconds to wait before starting continuous scrolling while a button is pressed in an arrow. This value must be greater than 0.

XmNchildType

If XmSTRING, the items resource is used by the spin-button; otherwise, the numeric resources are used for displaying data in the label or text-field. Specifies the kind of Spin behavior this child exhibits. Values are XmNUMERIC which uses the numeric range of values, XmSTRING which uses a list of XmStrings.

XmNitemCount

Total numer of items. This value must be the number of items in XmNitems and must not be negative. It is automatically updated by the widget whenever an item is added or deleted.

XmNitems:

                A list of xm-strings which will be scrolled
                through when the user presses the up or down arrows.
XmNlosingFocusCallback

List of callbacks called when the text-field widget loses focus (when SpinButton is editable). See also XmTextFieldWidget.

XmNmarginHeight

Vertical distance from the beginning of the widget to the start of the shadow. Used for making this widget look like push-buttons, etc.

XmNmarginWidth

Horizontal distance from the beginning of the widget to the start of the shadow. Used for making this widget look like push-buttons, etc.

XmNmaximum

Upper limit for numeric SpinButton widgets.

XmNmaxLength

Maximum length of the text string that can be entered into a text-field widget. This resource is passed on to the text-field (when SpinButton is editable). See also XmTextFieldWidget.

XmNminimum

Lower limit for numeric SpinButton widgets.

XmNmodifyVerifyCallback

List of callbacks called when the text-field widget gets modified (when SpinButton is editable). See also XmTextFieldWidget.

XmNposition

This specifies the current item position when XmNchildType is XmSTRING (position of item within the list). When XmNchildType is XmNUMERIC this is the current value in the label or text-field.

XmNrecomputeSize

If FALSE, the widget will not try to recompute a new size if setting some other resource would cause it to grow or shrink.

XmNrepeatDelay

The amount of time in milliseconds to wait before changing to the next/prev item or number while a button is pressed in an arrow.

XmNtextField

text-field widget used within the SpinButton when XmNeditable is TRUE.

XmNvalueChangedCallback

List of callbacks called when the value changes in the SpinButtin, using the arrows.

XmNverticalSpacing

The vertical distance surrounding the combo box and its contents (in pixels).

XmNwrap:

If FALSE, don't do wrap around (it will beep).

Callback Information:

        typedef struct
        {
           int          reason;
           XEvent       *event;
           Widget       widget;
           Boolean      doit;
           int          position;
           XmString     value;
           Boolean      crossed_boundary;
        } XmSpinButtonCallbackStruct;

Event is null during continuous spin.
Value is given for both XmNUMERIC and XmSTRING.


Functions available in SpinButton for list manipulation:

        void
        XmSpinButtonAddItem(widget, item, position)
        XmSpinButtonWidget widget;
        XmString item;
        int position;

Adds the given item to the list at the given position. position is an integer specifying the position of the new item in the list. A value of 1 makes the new item the first item in the list; a value of 2 makes it the second item, and so on. A value of 0 (zero) makes the new item the last item in the list.

        void
        XmSpinButtonDeletePos(widget, position)
        XmSpinButtonWidget widget;
        int position;

Deletes the item at the given position from the list. position is an integer specifying the position of the item to delete in the list. A value of 1 indicates that the first item in the list is to be deleted. A value of 2 indicates the second item, etc. A value of 0 indicates that the last item is to be deleted.

        void
        XmSpinButtonSetItem(widget, item)
        XmSpinButtonWidget widget;
        XmString item;

Puts the given item into the spin-button label or text-field (this will be the new value shown).

/*

  • 11/99: JRA - XmSpinButtonGetTextString. */

    char *XmSpinButtonGetTextString( widget ) XmSpinButtonWidget widget;

If editable, gets the text string in the text field widget.

/*

  • 11/99: JRA - XmSpinButtonSetTextFieldBackground. */

    void XmSpinButtonSetTextFieldBackground( spin, bg ) XmSpinButtonWidget spin; Pixel bg;

Sets the current background color of the Text Field widget.

/*

  • 11/99: JRA - XmSpinButtonGetTextFieldBackground. */

    void XmSpinButtonGetTextFieldBackground( spin, bg ) XmSpinButtonWidget spin; Pixel bg;

Gets the current background color of the Text Field widget.


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.