SpinBoxP.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: SpinBoxP.h /main/4 1996/03/26 19:54:14 drk $ */
  24. /*
  25. * SpinBoxP.h, Interleaf, 16aug93 2:37pm Version 1.1.
  26. */
  27. /***********************************************************
  28. Copyright 1993 Interleaf, Inc.
  29. Permission to use, copy, modify, and distribute this software
  30. and its documentation for any purpose without fee is granted,
  31. provided that the above copyright notice appear in all copies
  32. and that both copyright notice and this permission notice appear
  33. in supporting documentation, and that the name of Interleaf not
  34. be used in advertising or publicly pertaining to distribution of
  35. the software without specific written prior permission.
  36. Interleaf makes no representation about the suitability of this
  37. software for any purpose. It is provided "AS IS" without any
  38. express or implied warranty.
  39. ******************************************************************/
  40. /*
  41. * (C) Copyright 1991,1992, 1993
  42. * Interleaf, Inc.
  43. * 9 Hillside Avenue, Waltham, MA 02154
  44. *
  45. * SpinBoxP.h:
  46. *
  47. * Private header file for DtSpinBoxWidget.
  48. */
  49. #ifndef _SpinBoxP_h
  50. #define _SpinBoxP_h
  51. #include <Xm/Label.h>
  52. #undef USE_XFT
  53. #include <Xm/TextFP.h>
  54. #include <Xm/ArrowB.h>
  55. #include <Xm/ManagerP.h>
  56. #include "SpinBox.h"
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60. /*
  61. * External definitions of syn_resources for our list widget.
  62. */
  63. #define SYN_RESOURCE_AA (Widget w, int resource_offset, XtArgVal *value)
  64. extern void _DtSpinBoxGetArrowSize SYN_RESOURCE_AA;
  65. #define ARROW_MULT .45
  66. #define ARROW_MIN 13
  67. #define MAX_FLOAT_DECIMALS 6
  68. #define NUMERIC_LENGTH 128
  69. #define MARGIN 2
  70. #define LABEL_PADDING 2
  71. #define LABEL_SHADOW 2
  72. #define TEXT_FIELD_SHADOW 1
  73. #define TEXT_CONTEXT_MARGIN 4
  74. /****************************************************************
  75. *
  76. * Message Defines
  77. *
  78. ****************************************************************/
  79. #define SB_ARROW_SENSITIVE DTWIDGET_GETMESSAGE( \
  80. MS_SpinBox, SPIN_ARROW_SENSITIVE, _DtMsgSpinBox_0000)
  81. #define SB_ALIGNMENT DTWIDGET_GETMESSAGE( \
  82. MS_SpinBox, SPIN_ALIGNMENT, _DtMsgSpinBox_0001)
  83. #define SB_INIT_DELAY DTWIDGET_GETMESSAGE( \
  84. MS_SpinBox, SPIN_INIT_DELAY, _DtMsgSpinBox_0002)
  85. #define SB_MARGIN_HEIGHT DTWIDGET_GETMESSAGE( \
  86. MS_SpinBox, SPIN_MARGIN_HEIGHT, _DtMsgSpinBox_0003)
  87. #define SB_MARGIN_WIDTH DTWIDGET_GETMESSAGE( \
  88. MS_SpinBox, SPIN_MARGIN_WIDTH, _DtMsgSpinBox_0004)
  89. #define SB_ARROW_LAYOUT DTWIDGET_GETMESSAGE( \
  90. MS_SpinBox, SPIN_ARROW_LAYOUT, _DtMsgSpinBox_0005)
  91. #define SB_REPEAT_DELAY DTWIDGET_GETMESSAGE( \
  92. MS_SpinBox, SPIN_REPEAT_DELAY, _DtMsgSpinBox_0006)
  93. #define SB_ITEM_COUNT DTWIDGET_GETMESSAGE( \
  94. MS_SpinBox, SPIN_ITEM_COUNT, _DtMsgSpinBox_0007)
  95. #define SB_POSITION_STRING DTWIDGET_GETMESSAGE( \
  96. MS_SpinBox, SPIN_POSITION_STRING, _DtMsgSpinBox_0008)
  97. #define SB_POSITION_NUMERIC DTWIDGET_GETMESSAGE( \
  98. MS_SpinBox, SPIN_POSITION_NUMERIC, _DtMsgSpinBox_0009)
  99. #define SB_DECIMAL_POINTS DTWIDGET_GETMESSAGE( \
  100. MS_SpinBox, SPIN_DECIMAL_POINTS, _DtMsgSpinBox_0010)
  101. #define SB_MIN_MAX DTWIDGET_GETMESSAGE( \
  102. MS_SpinBox, SPIN_MIN_MAX, _DtMsgSpinBox_0011)
  103. #define SB_TEXT DTWIDGET_GETMESSAGE( \
  104. MS_SpinBox, SPIN_TEXT, _DtMsgSpinBox_0012)
  105. #define SB_SET_ITEM DTWIDGET_GETMESSAGE( \
  106. MS_SpinBox, SPIN_SET_ITEM, _DtMsgSpinBox_0013)
  107. #define SB_LABEL DTWIDGET_GETMESSAGE( \
  108. MS_SpinBox, SPIN_LABEL, _DtMsgSpinBox_0014)
  109. /*
  110. * Class Records
  111. */
  112. typedef struct {
  113. Boolean junk;
  114. } DtSpinBoxClassPart;
  115. typedef struct _DtSpinBoxClassRec {
  116. CoreClassPart core_class;
  117. CompositeClassPart composite_class;
  118. ConstraintClassPart constraint_class;
  119. XmManagerClassPart manager_class;
  120. DtSpinBoxClassPart spin_box_class;
  121. } DtSpinBoxClassRec;
  122. extern DtSpinBoxClassRec dtSpinBoxClassRec;
  123. /*
  124. * Instance Record.
  125. */
  126. typedef struct _DtSpinBoxPart {
  127. /* Private data */
  128. Widget label;
  129. Widget up_arrow;
  130. Widget down_arrow;
  131. unsigned char which_arrow;
  132. Boolean init_cb;
  133. Boolean grabbed;
  134. int base;
  135. float min, max;
  136. float increment, current;
  137. char float_format[10];
  138. Dimension old_width;
  139. Dimension old_height;
  140. Dimension label_max_length;
  141. Dimension label_max_height;
  142. /* Resource-related data */
  143. unsigned char arrow_sensitivity;
  144. short decimal_points;
  145. int numeric_increment;
  146. int maximum;
  147. int minimum;
  148. int item_count;
  149. int position;
  150. unsigned char child_type;
  151. XmStringTable items;
  152. XtCallbackList activate_callback;
  153. unsigned char alignment;
  154. unsigned char arrow_layout;
  155. Dimension arrow_size;
  156. short text_columns;
  157. Boolean editable;
  158. XtCallbackList focus_callback;
  159. unsigned int initial_delay;
  160. XtCallbackList losing_focus_callback;
  161. Dimension margin_height;
  162. Dimension margin_width;
  163. int text_max_length;
  164. XtCallbackList modify_verify_callback;
  165. Boolean recompute_size;
  166. unsigned int repeat_delay;
  167. Widget text;
  168. XtCallbackList value_changed_callback;
  169. Boolean wrap;
  170. /* Spin timer. */
  171. XtIntervalId timer;
  172. /* String list related resources */
  173. /* Numeric related resources */
  174. /* TextField resources */
  175. } DtSpinBoxPart;
  176. /* Full instance record declaration */
  177. typedef struct _DtSpinBoxRec {
  178. CorePart core;
  179. CompositePart composite;
  180. ConstraintPart constraint;
  181. XmManagerPart manager;
  182. DtSpinBoxPart spin_box;
  183. } DtSpinBoxRec;
  184. #ifdef __cplusplus
  185. } /* Close scope of 'extern "C"' declaration which encloses file. */
  186. #endif
  187. #endif /* _SpinBoxP_h */