SpinBox.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  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: SpinBox.h /main/4 1995/10/26 09:34:23 rswiston $ */
  24. /*
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company
  26. * (c) Copyright 1993, 1994 International Business Machines Corp.
  27. * (c) Copyright 1993, 1994 Novell, Inc.
  28. * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. */
  30. /***********************************************************
  31. Copyright 1993 Interleaf, Inc.
  32. Permission to use, copy, modify, and distribute this software
  33. and its documentation for any purpose without fee is granted,
  34. provided that the above copyright notice appear in all copies
  35. and that both copyright notice and this permission notice appear
  36. in supporting documentation, and that the name of Interleaf not
  37. be used in advertising or publicly pertaining to distribution of
  38. the software without specific written prior permission.
  39. Interleaf makes no representation about the suitability of this
  40. software for any purpose. It is provided "AS IS" without any
  41. express or implied warranty.
  42. ******************************************************************/
  43. #ifndef _Dt_SpinBox_h
  44. #define _Dt_SpinBox_h
  45. #include <Xm/Xm.h>
  46. #if defined(DT_USE_XM_SSPINBOX)
  47. #include <Xm/SSpinB.h>
  48. #endif
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52. /*
  53. * Constants
  54. */
  55. /* Resources */
  56. #ifndef DtNarrowLayout
  57. # if defined(DT_USE_XM_SSPINBOX)
  58. # define DtNarrowLayout XmNarrowLayout
  59. # else
  60. # define DtNarrowLayout "arrowLayout"
  61. # endif
  62. #endif
  63. #ifndef DtNarrowSensitivity
  64. # if defined(DT_USE_XM_SSPINBOX)
  65. # define DtNarrowSensitivity XmNarrowSensitivity
  66. # else
  67. # define DtNarrowSensitivity "arrowSensitivity"
  68. # endif
  69. #endif
  70. #ifndef DtNarrowSize
  71. # if defined(DT_USE_XM_SSPINBOX)
  72. # define DtNarrowSize XmNarrowSize
  73. # else
  74. # define DtNarrowSize "arrowSize"
  75. # endif
  76. #endif
  77. #ifndef DtNspinBoxChildType
  78. # if defined(DT_USE_XM_SSPINBOX)
  79. # define DtNspinBoxChildType XmNspinBoxChildType
  80. # else
  81. # define DtNspinBoxChildType "spinBoxChildType"
  82. # endif
  83. #endif
  84. #ifndef DtNposition
  85. # if defined(DT_USE_XM_SSPINBOX)
  86. # define DtNposition XmNposition
  87. # else
  88. # define DtNposition "position"
  89. # endif
  90. #endif
  91. #ifndef DtNtextField
  92. # if defined(DT_USE_XM_SSPINBOX)
  93. # define DtNtextField XmNtextField
  94. # else
  95. # define DtNtextField "textField"
  96. # endif
  97. #endif
  98. #ifndef DtNwrap
  99. # if defined(DT_USE_XM_SSPINBOX)
  100. # define DtNwrap "wrap"
  101. # else
  102. # define DtNwrap "wrap"
  103. # endif
  104. #endif
  105. #ifndef DtNincrementValue
  106. # if defined(DT_USE_XM_SSPINBOX)
  107. # define DtNincrementValue XmNincrementValue
  108. # else
  109. # define DtNincrementValue "incrementValue"
  110. # endif
  111. #endif
  112. #ifndef DtNmaximumValue
  113. # if defined(DT_USE_XM_SSPINBOX)
  114. # define DtNmaximumValue XmNmaximumValue
  115. # else
  116. # define DtNmaximumValue "maximumValue"
  117. # endif
  118. #endif
  119. #ifndef DtNminimumValue
  120. # if defined(DT_USE_XM_SSPINBOX)
  121. # define DtNminimumValue XmNminimumValue
  122. # else
  123. # define DtNminimumValue "minimumValue"
  124. # endif
  125. #endif
  126. #ifndef DtNnumValues
  127. # if defined(DT_USE_XM_SSPINBOX)
  128. # define DtNnumValues XmNnumValues
  129. # else
  130. # define DtNnumValues "numValues"
  131. # endif
  132. #endif
  133. #ifndef DtNvalues
  134. # if defined(DT_USE_XM_SSPINBOX)
  135. # define DtNvalues XmNvalues
  136. # else
  137. # define DtNvalues "values"
  138. # endif
  139. #endif
  140. #ifndef DtNactivateCallback
  141. #define DtNactivateCallback XmNactivateCallback
  142. #endif
  143. #ifndef DtNalignment
  144. #define DtNalignment XmNalignment
  145. #endif
  146. #ifndef DtNcolumns
  147. #define DtNcolumns XmNcolumns
  148. #endif
  149. #ifndef DtNdecimalPoints
  150. #define DtNdecimalPoints XmNdecimalPoints
  151. #endif
  152. #ifndef DtNeditable
  153. #define DtNeditable XmNeditable
  154. #endif
  155. #ifndef DtNfocusCallback
  156. #define DtNfocusCallback XmNfocusCallback
  157. #endif
  158. #ifndef DtNinitialDelay
  159. #define DtNinitialDelay XmNinitialDelay
  160. #endif
  161. #ifndef DtNlosingFocusCallback
  162. #define DtNlosingFocusCallback XmNlosingFocusCallback
  163. #endif
  164. #ifndef DtNmarginHeight
  165. #define DtNmarginHeight XmNmarginHeight
  166. #endif
  167. #ifndef DtNmarginWidth
  168. #define DtNmarginWidth XmNmarginWidth
  169. #endif
  170. #ifndef DtNmaxLength
  171. #define DtNmaxLength XmNmaxLength
  172. #endif
  173. #ifndef DtNmodifyVerifyCallback
  174. #define DtNmodifyVerifyCallback XmNmodifyVerifyCallback
  175. #endif
  176. #ifndef DtNrecomputeSize
  177. #define DtNrecomputeSize XmNrecomputeSize
  178. #endif
  179. #ifndef DtNrepeatDelay
  180. #define DtNrepeatDelay XmNrepeatDelay
  181. #endif
  182. #ifndef DtNvalueChangedCallback
  183. #define DtNvalueChangedCallback XmNvalueChangedCallback
  184. #endif
  185. #ifndef DtCArrowLayout
  186. # if defined(DT_USE_XM_SSPINBOX)
  187. # define DtCArrowLayout XmCArrowLayout
  188. # else
  189. # define DtCArrowLayout "ArrowLayout"
  190. # endif
  191. #endif
  192. #ifndef DtCArrowSensitivity
  193. # if defined(DT_USE_XM_SSPINBOX)
  194. # define DtCArrowSensitivity XmCArrowSensitivity
  195. # else
  196. # define DtCArrowSensitivity "ArrowSensitivity"
  197. # endif
  198. #endif
  199. #ifndef DtCArrowSize
  200. # if defined(DT_USE_XM_SSPINBOX)
  201. # define DtCArrowSize XmCArrowSize
  202. # else
  203. # define DtCArrowSize "ArrowSize"
  204. # endif
  205. #endif
  206. #ifndef DtCSpinBoxChildType
  207. # if defined(DT_USE_XM_SSPINBOX)
  208. # define DtCSpinBoxChildType XmCSpinBoxChildType
  209. # else
  210. # define DtCSpinBoxChildType "SpinBoxChildType"
  211. # endif
  212. #endif
  213. #ifndef DtCPosition
  214. # if defined(DT_USE_XM_SSPINBOX)
  215. # define DtCPosition XmCPosition
  216. # else
  217. # define DtCPosition "Position"
  218. # endif
  219. #endif
  220. #ifndef DtCTextField
  221. # if defined(DT_USE_XM_SSPINBOX)
  222. # define DtCTextField XmCTextField
  223. # else
  224. # define DtCTextField "TextField"
  225. # endif
  226. #endif
  227. #ifndef DtCWrap
  228. # define DtCWrap "Wrap"
  229. #endif
  230. #ifndef DtCIncrementValue
  231. # if defined(DT_USE_XM_SSPINBOX)
  232. # define DtCIncrementValue XmCIncrementValue
  233. # else
  234. # define DtCIncrementValue "incrementValue"
  235. # endif
  236. #endif
  237. #ifndef DtCMaximumValue
  238. # if defined(DT_USE_XM_SSPINBOX)
  239. # define DtCMaximumValue XmCMaximumValue
  240. # else
  241. # define DtCMaximumValue "maximumValue"
  242. # endif
  243. #endif
  244. #ifndef DtCMinimumValue
  245. # if defined(DT_USE_XM_SSPINBOX)
  246. # define DtCMinimumValue XmCMinimumValue
  247. # else
  248. # define DtCMinimumValue "minimumValue"
  249. # endif
  250. #endif
  251. #ifndef DtCNumValues
  252. # if defined(DT_USE_XM_SSPINBOX)
  253. # define DtCNumValues XmCNumValues
  254. # else
  255. # define DtCNumValues "numValues"
  256. # endif
  257. #endif
  258. #ifndef DtCValues
  259. # if defined(DT_USE_XM_SSPINBOX)
  260. # define DtCValues XmCValues
  261. # else
  262. # define DtCValues "values"
  263. # endif
  264. #endif
  265. #ifndef DtCAlignment
  266. #define DtCAlignment XmCAlignment
  267. #endif
  268. #ifndef DtCCallback
  269. #define DtCCallback XmCCallback
  270. #endif
  271. #ifndef DtCColumns
  272. #define DtCColumns XmCColumns
  273. #endif
  274. #ifndef DtCDecimalPoints
  275. #define DtCDecimalPoints XmCDecimalPoints
  276. #endif
  277. #ifndef DtCEditable
  278. #define DtCEditable XmCEditable
  279. #endif
  280. #ifndef DtCInitialDelay
  281. #define DtCInitialDelay XmCInitialDelay
  282. #endif
  283. #ifndef DtCItems
  284. #define DtCItems XmCItems
  285. #endif
  286. #ifndef DtCMarginHeight
  287. #define DtCMarginHeight XmCMarginHeight
  288. #endif
  289. #ifndef DtCMarginWidth
  290. #define DtCMarginWidth XmCMarginWidth
  291. #endif
  292. #ifndef DtCMaxLength
  293. #define DtCMaxLength XmCMaxLength
  294. #endif
  295. #ifndef DtCPosition
  296. #define DtCPosition XmCPosition
  297. #endif
  298. #ifndef DtCRecomputeSize
  299. #define DtCRecomputeSize XmCRecomputeSize
  300. #endif
  301. #ifndef DtCRepeatDelay
  302. #define DtCRepeatDelay XmCRepeatDelay
  303. #endif
  304. /* Representation types */
  305. #ifndef DtRIncrementValue
  306. # if defined(DT_USE_XM_SSPINBOX)
  307. # define DtRIncrementValue XmRint
  308. # else
  309. # define DtRIncrementValue "IncrementValue"
  310. # endif
  311. #endif
  312. #ifndef DtRMaximumValue
  313. # if defined(DT_USE_XM_SSPINBOX)
  314. # define DtRMaximumValue XmRint
  315. # else
  316. # define DtRMaximumValue "MaximumValue"
  317. # endif
  318. #endif
  319. #ifndef DtRMinimumValue
  320. # if defined(DT_USE_XM_SSPINBOX)
  321. # define DtRMinimumValue XmRint
  322. # else
  323. # define DtRMinimumValue "MinimumValue"
  324. # endif
  325. #endif
  326. #ifndef DtRNumValues
  327. # if defined(DT_USE_XM_SSPINBOX)
  328. # define DtRNumValues XmRint
  329. # else
  330. # define DtRNumValues "NumValues"
  331. # endif
  332. #endif
  333. #ifndef DtRValues
  334. # if defined(DT_USE_XM_SSPINBOX)
  335. # define DtRValues XmRXmStringTable
  336. # else
  337. # define DtRValues "Values"
  338. # endif
  339. #endif
  340. #ifndef DtRArrowSensitivity
  341. # if defined(DT_USE_XM_SSPINBOX)
  342. # define DtRArrowSensitivity XmRArrowSensitivity
  343. # else
  344. # define DtRArrowSensitivity "ArrowSensitivity"
  345. # endif
  346. #endif
  347. #ifndef DtRArrowLayout
  348. # if defined(DT_USE_XM_SSPINBOX)
  349. # define DtRArrowLayout XmRArrowLayout
  350. # else
  351. # define DtRArrowLayout "ArrowLayout"
  352. # endif
  353. #endif
  354. #ifndef DtRSpinBoxChildType
  355. # if defined(DT_USE_XM_SSPINBOX)
  356. # define DtRSpinBoxChildType XmRSpinBoxChildType
  357. # else
  358. # define DtRSpinBoxChildType "SpinBoxChildType"
  359. # endif
  360. #endif
  361. /* DtNarrowLayout values */
  362. #ifndef DtARROWS_FLAT_BEGINNING
  363. # if defined(DT_USE_XM_SSPINBOX)
  364. # define DtARROWS_FLAT_BEGINNING XmARROWS_FLAT_BEGINNING
  365. # else
  366. # define DtARROWS_FLAT_BEGINNING 4
  367. # endif
  368. #endif
  369. #ifndef DtARROWS_FLAT_END
  370. # if defined(DT_USE_XM_SSPINBOX)
  371. # define DtARROWS_FLAT_END XmARROWS_FLAT_END
  372. # else
  373. # define DtARROWS_FLAT_END 3
  374. # endif
  375. #endif
  376. #ifndef DtARROWS_SPLIT
  377. # if defined(DT_USE_XM_SSPINBOX)
  378. # define DtARROWS_SPLIT XmARROWS_SPLIT
  379. # else
  380. # define DtARROWS_SPLIT 2
  381. # endif
  382. #endif
  383. #ifndef DtARROWS_BEGINNING
  384. # if defined(DT_USE_XM_SSPINBOX)
  385. # define DtARROWS_BEGINNING XmARROWS_BEGINNING
  386. # else
  387. # define DtARROWS_BEGINNING 1
  388. # endif
  389. #endif
  390. #ifndef DtARROWS_END
  391. # if defined(DT_USE_XM_SSPINBOX)
  392. # define DtARROWS_END XmARROWS_END
  393. # else
  394. # define DtARROWS_END 0
  395. # endif
  396. #endif
  397. /* DtNarrowSensitivity values */
  398. #ifndef DtARROWS_SENSITIVE
  399. # if defined(DT_USE_XM_SSPINBOX)
  400. # define DtARROWS_SENSITIVE XmARROWS_SENSITIVE
  401. # else
  402. # define DtARROWS_SENSITIVE 3
  403. # endif
  404. #endif
  405. #ifndef DtARROWS_DECREMENT_SENSITIVE
  406. # if defined(DT_USE_XM_SSPINBOX)
  407. # define DtARROWS_DECREMENT_SENSITIVE XmARROWS_DECREMENT_SENSITIVE
  408. # else
  409. # define DtARROWS_DECREMENT_SENSITIVE 2
  410. # endif
  411. #endif
  412. #ifndef DtARROWS_INCREMENT_SENSITIVE
  413. # if defined(DT_USE_XM_SSPINBOX)
  414. # define DtARROWS_INCREMENT_SENSITIVE XmARROWS_INCREMENT_SENSITIVE
  415. # else
  416. # define DtARROWS_INCREMENT_SENSITIVE 1
  417. # endif
  418. #endif
  419. #ifndef DtARROWS_INSENSITIVE
  420. # if defined(DT_USE_XM_SSPINBOX)
  421. # define DtARROWS_INSENSITIVE XmARROWS_INSENSITIVE
  422. # else
  423. # define DtARROWS_INSENSITIVE 0
  424. # endif
  425. #endif
  426. /* DtNspinBoxChildType values */
  427. #ifndef DtNUMERIC
  428. # if defined(DT_USE_XM_SSPINBOX)
  429. # define DtNUMERIC XmNUMERIC
  430. # else
  431. # define DtNUMERIC 3
  432. # endif
  433. #endif
  434. #ifndef DtSTRING
  435. # define DtSTRING XmSTRING
  436. #endif
  437. /* DtNalignment values */
  438. #ifndef DtALIGNMENT_BEGINNING
  439. #define DtALIGNMENT_BEGINNING XmALIGNMENT_BEGINNING
  440. #endif
  441. #ifndef DtALIGNMENT_CENTER
  442. #define DtALIGNMENT_CENTER XmALIGNMENT_CENTER
  443. #endif
  444. #ifndef DtALIGNMENT_END
  445. #define DtALIGNMENT_END XmALIGNMENT_END
  446. #endif
  447. /* Callback reasons */
  448. #ifndef DtCR_OK
  449. # define DtCR_OK XmCR_OK
  450. #endif
  451. #ifndef DtCR_SPIN_NEXT
  452. # if defined(DT_USE_XM_SSPINBOX)
  453. # define DtCR_SPIN_NEXT XmCR_SPIN_NEXT
  454. # else
  455. # define DtCR_SPIN_NEXT 62
  456. # endif
  457. #endif
  458. #ifndef DtCR_SPIN_PRIOR
  459. # if defined(DT_USE_XM_SSPINBOX)
  460. # define DtCR_SPIN_PRIOR XmCR_SPIN_PRIOR
  461. # else
  462. # define DtCR_SPIN_PRIOR 63
  463. # endif
  464. #endif
  465. /*
  466. * Types
  467. */
  468. #if defined(DT_USE_XM_SSPINBOX)
  469. # define DtSpinBoxCallbackStruct XmSpinBoxCallbackStruct
  470. #else
  471. typedef struct {
  472. int reason;
  473. XEvent *event;
  474. Widget widget;
  475. Boolean doit;
  476. int position;
  477. XmString value;
  478. Boolean crossed_boundary;
  479. } DtSpinBoxCallbackStruct;
  480. #endif
  481. /* Widget class and instance */
  482. #if defined(DT_USE_XM_SSPINBOX)
  483. # define _DtSpinBoxClassRec _XmSimpleSpinBoxClassRec
  484. # define _DtSpinBoxRec _XmSimpleSpinBoxRec
  485. # define DtSpinBoxWidgetClass XmSimpleSpinBoxWidgetClass
  486. # define DtSpinBoxWidget XmSimpleSpinBoxWidget
  487. #else
  488. typedef struct _DtSpinBoxClassRec *DtSpinBoxWidgetClass;
  489. typedef struct _DtSpinBoxRec *DtSpinBoxWidget;
  490. #endif
  491. /*
  492. * Data
  493. */
  494. /* Widget class record */
  495. #if defined(DT_USE_XM_SSPINBOX)
  496. # define dtSpinBoxWidgetClass xmSimpleSpinBoxWidgetClass
  497. #else
  498. externalref WidgetClass dtSpinBoxWidgetClass;
  499. #endif
  500. /*
  501. * Functions
  502. */
  503. #if defined(DT_USE_XM_SSPINBOX)
  504. # define DtCreateSpinBox XmCreateSimpleSpinBox
  505. # define DtSpinBoxAddItem XmSimpleSpinBoxAddItem
  506. # define DtSpinBoxDeletePos XmSimpleSpinBoxDeletePos
  507. # define DtSpinBoxSetItem XmSimpleSpinBoxSetItem
  508. #else
  509. extern Widget DtCreateSpinBox(
  510. Widget parent,
  511. char *name,
  512. ArgList arglist,
  513. Cardinal argcount);
  514. extern void DtSpinBoxAddItem(
  515. Widget widget,
  516. XmString item,
  517. int pos);
  518. extern void DtSpinBoxDeletePos(
  519. Widget widget,
  520. int pos);
  521. extern void DtSpinBoxSetItem(
  522. Widget widget,
  523. XmString item);
  524. #endif
  525. #ifdef __cplusplus
  526. }
  527. #endif
  528. #endif /* _Dt_SpinBox_h */