Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:28

0001 /* $TOG: SpinBP.h /main/7 1999/09/01 17:14:17 mgreess $ */
0002 /*
0003  * Motif
0004  *
0005  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
0006  *
0007  * These libraries and programs are free software; you can
0008  * redistribute them and/or modify them under the terms of the GNU
0009  * Lesser General Public License as published by the Free Software
0010  * Foundation; either version 2 of the License, or (at your option)
0011  * any later version.
0012  *
0013  * These libraries and programs are distributed in the hope that
0014  * they will be useful, but WITHOUT ANY WARRANTY; without even the
0015  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
0016  * PURPOSE. See the GNU Lesser General Public License for more
0017  * details.
0018  *
0019  * You should have received a copy of the GNU Lesser General Public
0020  * License along with these librararies and programs; if not, write
0021  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
0022  * Floor, Boston, MA 02110-1301 USA
0023  */
0024 /*
0025  * HISTORY
0026  */
0027 
0028 #ifndef _XmSpinBP_h
0029 #define _XmSpinBP_h
0030 
0031 #include <Xm/LabelP.h>
0032 #include <Xm/ManagerP.h>
0033 #include <Xm/SpinB.h>
0034 
0035 #ifdef __cplusplus
0036 extern "C" {
0037 #endif
0038 
0039 /*  Spin constraints */
0040 
0041 typedef struct _XmSpinBoxConstraint
0042 {
0043   XmStringTable  values;        /* array of XmString */
0044   int            position;      /* position of current selection */
0045   int            num_values;    /* number of XmString in the array */
0046 
0047   int            minimum_value; /* parameters for autonumeric mode */
0048   int            maximum_value;
0049   int            increment_value;
0050   short          decimal_points;
0051 
0052   unsigned char  sb_child_type;
0053   unsigned char  arrow_sensitivity;
0054   Boolean    wrap;
0055   unsigned char  position_type; /* governs interpretation of .position:
0056                     XmPOSITION_{ARRAY,VALUE} */
0057 } XmSpinBoxConstraintPart, *XmSpinBoxConstraint;
0058 
0059 typedef struct _XmSpinBoxConstraintRec
0060 {
0061   XmManagerConstraintPart manager;
0062   XmSpinBoxConstraintPart spinBox;
0063 } XmSpinBoxConstraintRec, *XmSpinBoxConstraintPtr;
0064 
0065 typedef Widget  (*XmGetCallbackWidgetProc)(Widget);
0066 
0067 /*  Spin class structure  */
0068 typedef struct _XmSpinBoxClassPart
0069 {
0070   XmGetCallbackWidgetProc    get_callback_widget;
0071   XtPointer                  extension;         /* not used */
0072 } XmSpinBoxClassPart;
0073 
0074 
0075 /*  Full class record declaration for Spin class  */
0076 
0077 typedef struct _XmSpinBoxClassRec
0078 {
0079   CoreClassPart              core_class;
0080   CompositeClassPart         composite_class;
0081   ConstraintClassPart        constraint_class;
0082   XmManagerClassPart         manager_class;
0083   XmSpinBoxClassPart         spinBox_class;
0084 } XmSpinBoxClassRec;
0085 
0086 externalref XmSpinBoxClassRec xmSpinBoxClassRec;
0087 
0088 /*  The Spin instance record  */
0089 
0090 typedef struct _XmSpinBoxPart
0091 {
0092       Dimension      arrow_size;
0093       Dimension      margin_width;
0094       Dimension      margin_height;
0095       Dimension      spacing;
0096       unsigned int   initial_delay;
0097       unsigned int   repeat_delay;
0098       XtCallbackList modify_verify_cb; /* CB list for new selection */
0099       XtCallbackList value_changed_cb; /* CB list for new selection */
0100       XRectangle     up_arrow_rect;
0101       XRectangle     down_arrow_rect;
0102       Widget         textw;         /* text widget */
0103       int        boundary;
0104       int        last_hit;
0105       int        make_change;
0106       Dimension      ideal_height;
0107       Dimension      ideal_width;
0108       GC         arrow_gc;
0109       GC         insensitive_gc;
0110       Mask       dim_mask;      /* for the navigator trait */
0111       XtIntervalId   spin_timer;
0112       Boolean        up_arrow_pressed;
0113       Boolean        down_arrow_pressed;
0114       unsigned char  arrow_layout;
0115       unsigned char  default_arrow_sensitivity;
0116       Dimension      detail_shadow_thickness;
0117       unsigned char  arrow_orientation; /* Xm_ARROWS_{VERTICAL,HORIZONTAL} */
0118 } XmSpinBoxPart;
0119 
0120 
0121 /*  Full instance record declaration  */
0122 
0123 typedef struct _XmSpinBoxRec
0124 {
0125   CorePart              core;
0126   CompositePart         composite;
0127   ConstraintPart        constraint;
0128   XmManagerPart         manager;
0129   XmSpinBoxPart         spinBox;
0130 } XmSpinBoxRec;
0131 
0132 /*  Macros */
0133 #define XmRPositionValue    "PositionValue"
0134 
0135 #define SB_GetConstraintRec(w) \
0136   ((XmSpinBoxConstraint)(&((XmSpinBoxConstraintPtr) (w)->core.constraints)->spinBox))
0137 
0138 #define SB_WithChild(w) \
0139   (((XmSpinBoxRec *) (w))->spinBox.textw != NULL)
0140 
0141 #define SB_ChildCount(w) \
0142   (((XmSpinBoxRec *) (w))->composite.num_children)
0143 
0144 #define SB_GetArrowOrientation(w) \
0145   (((XmSpinBoxRec *) (w))->spinBox.arrow_orientation)
0146 
0147 #define SB_ChildIsNumeric(wc) \
0148   (((XmSpinBoxConstraint) (wc))->sb_child_type == (unsigned char) XmNUMERIC)
0149 
0150 #define SB_ChildPositionTypeIsValue(wc) \
0151   (((XmSpinBoxConstraint) (wc))->position_type == \
0152    (unsigned char) XmPOSITION_VALUE)
0153 
0154 #define SB_ChildMaximumPositionValue(wc) \
0155   ( ( ((wc) == (XmSpinBoxConstraint) NULL) ?  \
0156         0 : \
0157         ( (SB_ChildIsNumeric(wc)) ? \
0158         (wc)->maximum_value : \
0159             ( ((wc)->num_values  > 0) ? \
0160         ((wc)->num_values - 1) : \
0161         0 \
0162         ) \
0163     ) \
0164     ) \
0165   )
0166 
0167 #define SB_ChildMinimumPositionValue(wc) \
0168   ( ( ((wc) == (XmSpinBoxConstraint) NULL) ?  \
0169         0 : \
0170         ( (SB_ChildIsNumeric(wc)) ? \
0171           (wc)->minimum_value : \
0172           0 \
0173         ) \
0174     ) \
0175   )
0176 
0177 #ifdef __cplusplus
0178 }  /* Close scope of 'extern "C"' declaration which encloses file. */
0179 #endif
0180 
0181 #endif  /* _SpinBP_h */
0182 /* DON'T ADD ANYTHING AFTER THIS #endif */
0183 
0184 
0185