1 /***********************************************************************/ 2 /* Open Visualization Data Explorer */ 3 /* (C) Copyright IBM Corp. 1989,1999 */ 4 /* ALL RIGHTS RESERVED */ 5 /* This code licensed under the */ 6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ 7 /***********************************************************************/ 8 9 #include <dxconfig.h> 10 11 12 13 #ifndef _NumberP_H 14 #define _NumberP_H 15 16 #include <Xm/Xm.h> 17 #if (XmVersion >= 1002) 18 #include <Xm/PrimitiveP.h> 19 #endif 20 #include <Xm/XmP.h> 21 22 #if defined(__cplusplus) || defined(c_plusplus) 23 extern "C" { 24 #endif 25 26 /* Number class structure */ 27 28 typedef struct _XmNumberWidgetClassPart 29 { 30 XtPointer extension; 31 } XmNumberWidgetClassPart; 32 33 34 /* Full class record declaration for Arrow class */ 35 36 typedef struct _XmNumberWidgetClassRec 37 { 38 CoreClassPart core_class; 39 XmPrimitiveClassPart primitive_class; 40 XmNumberWidgetClassPart number_class; 41 } XmNumberWidgetClassRec; 42 43 extern XmNumberWidgetClassRec xmNumberWidgetClassRec; 44 45 46 47 /* The Number instance record */ 48 49 /* Support multiple value types (non-doubles needed to recognize new input) */ 50 typedef struct 51 { 52 double d; 53 float f; 54 int i; 55 } MultitypeData; 56 57 typedef struct _XmNumberWidgetPart 58 { 59 MultitypeData value; 60 MultitypeData value_minimum; 61 MultitypeData value_maximum; 62 XmFontList font_list; 63 XtCallbackList overflow_callback; /* Call if text would overflow field */ 64 XtCallbackList arm_callback; /* Going into editor mode */ 65 XtCallbackList activate_callback; 66 XtCallbackList disarm_callback; /* No longer in editor mode */ 67 XtCallbackList warning_callback; /* No longer in editor mode */ 68 short char_places; /* Number of spaces (incl. decimal point) */ 69 short decimal_places; /* 0=integer, <0=%g, else fixed point */ 70 short h_margin; /* Pixels horizontal between shadow and text */ 71 short v_margin; /* Pixels between shadow and bottom of text */ 72 short repeat_rate; /* Milliseconds between auto-repeats */ 73 Boolean center; /* Center reduced length strings in field */ 74 Boolean raised; /* Draw raised border, else depressed border */ 75 Boolean visible; /* Text should be visible, else suppressed */ 76 Boolean allow_key_entry_mode; /* Keyboard entry of values allowed */ 77 Boolean propogate_events; /* Pass key and pointer events to parent */ 78 /* Private section */ 79 Boolean proportional; /* Font proportional ("." smaller than "5") */ 80 Boolean initialized; 81 Boolean call_only_if_change; 82 Boolean key_entry_mode; /* Currently in key entry mode */ 83 char format[12]; /* Print format for fixed point or integer */ 84 Position x, y; 85 Dimension width, height; /* Area occupied by char_places string */ 86 XFontStruct* font_struct; 87 GC gc; 88 GC inv_gc; 89 XtIntervalId timer; 90 short char_width; /* Pixel width of a number (e.g. "5") */ 91 short dot_width; /* Pixel width of a decimal point */ 92 short last_char_cnt; /* Number of characters most recently printed */ 93 short data_type; /* How the application feeds me data */ 94 Boolean recompute_size; /* Should the number widget resize to its min 95 and max value? */ 96 double cross_over; /* Value above which we should represent the 97 number in scientific notation */ 98 double cross_under; /* Value below which we should represent the 99 number in scientific notation */ 100 } XmNumberWidgetPart; 101 102 103 typedef struct _XmNumberEditorPart 104 { 105 double value; 106 double decimal_minimum; /* The smallest fraction allowed as input */ 107 short string_len; 108 short insert_position; 109 Boolean is_float; /* Fractional: allow use of decimal point */ 110 Boolean is_fixed; /* Fixed: don't allow scientific notation */ 111 Boolean is_signed; /* (min < 0.0): allow '-' sign */ 112 #define MAX_EDITOR_STRLEN 63 113 char string[MAX_EDITOR_STRLEN+1]; 114 } XmNumberEditorPart; 115 116 /* Full instance record declaration */ 117 118 typedef struct _XmNumberWidgetRec 119 { 120 CorePart core; 121 XmPrimitivePart primitive; 122 XmNumberWidgetPart number; 123 XmNumberEditorPart editor; 124 } XmNumberWidgetRec; 125 126 #if defined(__cplusplus) || defined(c_plusplus) 127 } 128 #endif 129 130 131 #endif 132 133 134