ComboBox.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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: ComboBox.h /main/4 1995/10/26 09:29:51 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_ComboBox_h
  44. #define _Dt_ComboBox_h
  45. /*
  46. * This widget is deprecated in favor of XmComboBox. The two are very
  47. * similar, but do have minor differences. Applications doing new
  48. * development are encouraged to use XmComboBox directly. Existing
  49. * applications may wish to recompile with DT_USE_XM_COMBOBOX.
  50. */
  51. #include <Xm/Xm.h>
  52. #ifdef DT_USE_XM_COMBOBOX
  53. #include <Xm/ComboBox.h>
  54. #endif
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58. /*
  59. * Constants
  60. */
  61. /* Resources */
  62. #ifndef DT_USE_XM_COMBOBOX
  63. /***********************************************************************
  64. *
  65. * NOTE:
  66. * Because of future development of the ComboBox, not all of the
  67. * following resources should be used. The only ones which are
  68. * supported are the ones found in the Common Desktop Environment:
  69. * Programmer's Guide. The supported resources include:
  70. * DtNmarginHeight, DtNmarginWidth, DtNselectedItem,
  71. * DtNselectedPosition, DtNselectionCallback, and DtNcomboBoxType.
  72. *
  73. * The use of the unsupported resources found in this header
  74. * file may cause dangerous and unexpected behavior.
  75. *
  76. **********************************************************************/
  77. /* WARNING: DtNactivateCallback is an unsupported resource in CDE 1.0 */
  78. #ifndef DtNactivateCallback
  79. #define DtNactivateCallback XmNactivateCallback
  80. #endif
  81. /* WARNING: DtNalignment is an unsupported resource in CDE 1.0 */
  82. #ifndef DtNalignment
  83. #define DtNalignment XmNalignment
  84. #endif
  85. /* WARNING: DtNarrowSize is an unsupported resource in CDE 1.0 */
  86. #ifndef DtNarrowSize
  87. #define DtNarrowSize "arrowSize"
  88. #endif
  89. /* WARNING: DtNarrowSpacing is an unsupported resource in CDE 1.0 */
  90. #ifndef DtNarrowSpacing
  91. #define DtNarrowSpacing "arrowSpacing"
  92. #endif
  93. /* WARNING: DtNarrowType is an unsupported resource in CDE 1.0 */
  94. #ifndef DtNarrowType
  95. #define DtNarrowType "arrowType"
  96. #endif
  97. /* WARNING: DtNcolumns is an unsupported resource in CDE 1.0 */
  98. #ifndef DtNcolumns
  99. #define DtNcolumns XmNcolumns
  100. #endif
  101. #ifndef DtNcomboBoxType
  102. #define DtNcomboBoxType "comboBoxType"
  103. #endif
  104. /* WARNING: DtNfocusCallback is an unsupported resource in CDE 1.0 */
  105. #ifndef DtNfocusCallback
  106. #define DtNfocusCallback XmNfocusCallback
  107. #endif
  108. /* WARNING: DtNhorizontalSpacing is an unsupported resource in CDE 1.0 */
  109. #ifndef DtNhorizontalSpacing
  110. #define DtNhorizontalSpacing XmNhorizontalSpacing
  111. #endif
  112. /* WARNING: DtNitemCount is an unsupported resource in CDE 1.0 */
  113. #ifndef DtNitemCount
  114. #define DtNitemCount XmNitemCount
  115. #endif
  116. /* WARNING: DtNitems is an unsupported resource in CDE 1.0 */
  117. #ifndef DtNitems
  118. #define DtNitems XmNitems
  119. #endif
  120. /* WARNING: DtNlabelString is an unsupported resource in CDE 1.0 */
  121. #ifndef DtNlabelString
  122. #define DtNlabelString XmNlabelString
  123. #endif
  124. /* WARNING: DtNlist is an unsupported resource in CDE 1.0 */
  125. #ifndef DtNlist
  126. #define DtNlist "list"
  127. #endif
  128. /* WARNING: DtNlistFontList is an unsupported resource in CDE 1.0 */
  129. #ifndef DtNlistFontList
  130. #define DtNlistFontList "listFontList"
  131. #endif
  132. /* WARNING: DtNlistMarginHeight is an unsupported resource in CDE 1.0 */
  133. #ifndef DtNlistMarginHeight
  134. #define DtNlistMarginHeight XmNlistMarginHeight
  135. #endif
  136. /* WARNING: DtNlistMarginWidth is an unsupported resource in CDE 1.0 */
  137. #ifndef DtNlistMarginWidth
  138. #define DtNlistMarginWidth XmNlistMarginWidth
  139. #endif
  140. /* WARNING: DtNlistSpacing is an unsupported resource in CDE 1.0 */
  141. #ifndef DtNlistSpacing
  142. #define DtNlistSpacing XmNlistSpacing
  143. #endif
  144. /* WARNING: DtNlosingFocusCallback is an unsupported resource in CDE 1.0 */
  145. #ifndef DtNlosingFocusCallback
  146. #define DtNlosingFocusCallback XmNlosingFocusCallback
  147. #endif
  148. #ifndef DtNmarginHeight
  149. #define DtNmarginHeight XmNmarginHeight
  150. #endif
  151. #ifndef DtNmarginWidth
  152. #define DtNmarginWidth XmNmarginWidth
  153. #endif
  154. /* WARNING: DtNmaxLength is an unsupported resource in CDE 1.0 */
  155. #ifndef DtNmaxLength
  156. #define DtNmaxLength XmNmaxLength
  157. #endif
  158. /* WARNING: DtNmenuPostCallback is an unsupported resource in CDE 1.0 */
  159. #ifndef DtNmenuPostCallback
  160. #define DtNmenuPostCallback "menuPostCallback"
  161. #endif
  162. /* WARNING: DtNorientation is an unsupported resource in CDE 1.0 */
  163. #ifndef DtNorientation
  164. #define DtNorientation XmNorientation
  165. #endif
  166. /* WARNING: DtNpoppedUp is an unsupported resource in CDE 1.0 */
  167. #ifndef DtNpoppedUp
  168. #define DtNpoppedUp "poppedUp"
  169. #endif
  170. /* WARNING: DtNrecomputeSize is an unsupported resource in CDE 1.0 */
  171. #ifndef DtNrecomputeSize
  172. #define DtNrecomputeSize XmNrecomputeSize
  173. #endif
  174. #ifndef DtNselectedItem
  175. #define DtNselectedItem "selectedItem"
  176. #endif
  177. #ifndef DtNselectedPosition
  178. #define DtNselectedPosition "selectedPosition"
  179. #endif
  180. #ifndef DtNselectionCallback
  181. #define DtNselectionCallback "selectionCallback"
  182. #endif
  183. /* WARNING: DtNtextField is an unsupported resource in CDE 1.0 */
  184. #ifndef DtNtextField
  185. #define DtNtextField "textField"
  186. #endif
  187. /* WARNING: DtNtopItemPosition is an unsupported resource in CDE 1.0 */
  188. #ifndef DtNtopItemPosition
  189. #define DtNtopItemPosition XmNtopItemPosition
  190. #endif
  191. /* WARNING: DtNupdateLabel is an unsupported resource in CDE 1.0 */
  192. #ifndef DtNupdateLabel
  193. #define DtNupdateLabel "updateLabel"
  194. #endif
  195. /* WARNING: DtNverticalSpacing is an unsupported resource in CDE 1.0 */
  196. #ifndef DtNverticalSpacing
  197. #define DtNverticalSpacing XmNverticalSpacing
  198. #endif
  199. /* WARNING: DtNvisibleItemCount is an unsupported resource in CDE 1.0 */
  200. #ifndef DtNvisibleItemCount
  201. #define DtNvisibleItemCount XmNvisibleItemCount
  202. #endif
  203. #ifndef DtCAlignment
  204. #define DtCAlignment XmCAlignment
  205. #endif
  206. #ifndef DtCArrowSize
  207. #define DtCArrowSize "ArrowSize"
  208. #endif
  209. #ifndef DtCArrowSpacing
  210. #define DtCArrowSpacing "ArrowSpacing"
  211. #endif
  212. #ifndef DtCArrowType
  213. #define DtCArrowType "ArrowType"
  214. #endif
  215. #ifndef DtCCallback
  216. #define DtCCallback XmCCallback
  217. #endif
  218. #ifndef DtCColumns
  219. #define DtCColumns XmCColumns
  220. #endif
  221. #ifndef DtCComboBoxType
  222. #define DtCComboBoxType "ComboBoxType"
  223. #endif
  224. #ifndef DtCHorizontalSpacing
  225. #define DtCHorizontalSpacing "HorizontalSpacing"
  226. #endif
  227. #ifndef DtCItemCount
  228. #define DtCItemCount XmCItemCount
  229. #endif
  230. #ifndef DtCItems
  231. #define DtCItems XmCItems
  232. #endif
  233. #ifndef DtCList
  234. #define DtCList "List"
  235. #endif
  236. #ifndef DtCListFontList
  237. #define DtCListFontList "ListFontList"
  238. #endif
  239. #ifndef DtCListMarginHeight
  240. #define DtCListMarginHeight XmCListMarginHeight
  241. #endif
  242. #ifndef DtCListMarginWidth
  243. #define DtCListMarginWidth XmCListMarginWidth
  244. #endif
  245. #ifndef DtCListSpacing
  246. #define DtCListSpacing XmCListSpacing
  247. #endif
  248. #ifndef DtCMarginHeight
  249. #define DtCMarginHeight XmCMarginHeight
  250. #endif
  251. #ifndef DtCMarginWidth
  252. #define DtCMarginWidth XmCMarginWidth
  253. #endif
  254. #ifndef DtCMaxLength
  255. #define DtCMaxLength XmCMaxLength
  256. #endif
  257. #ifndef DtCOrientation
  258. #define DtCOrientation XmCOrientation
  259. #endif
  260. #ifndef DtCPoppedUp
  261. #define DtCPoppedUp "PoppedUp"
  262. #endif
  263. #ifndef DtCRecomputeSize
  264. #define DtCRecomputeSize XmCRecomputeSize
  265. #endif
  266. #ifndef DtCSelectedItem
  267. #define DtCSelectedItem "SelectedItem"
  268. #endif
  269. #ifndef DtCSelectedPosition
  270. #define DtCSelectedPosition "SelectedPosition"
  271. #endif
  272. #ifndef DtCTextField
  273. #define DtCTextField "TextField"
  274. #endif
  275. #ifndef DtCTopItemPosition
  276. #define DtCTopItemPosition XmCTopItemPosition
  277. #endif
  278. #ifndef DtCUpdateLabel
  279. #define DtCUpdateLabel "UpdateLabel"
  280. #endif
  281. #ifndef DtCVerticalSpacing
  282. #define DtCVerticalSpacing "VerticalSpacing"
  283. #endif
  284. #ifndef DtCVisibleItemCount
  285. #define DtCVisibleItemCount XmCVisibleItemCount
  286. #endif
  287. #ifndef DtCXmString
  288. #define DtCXmString XmCXmString
  289. #endif
  290. #else /* DT_USE_XM_COMBOBOX */
  291. #ifndef DtNarrowSize
  292. #define DtNarrowSize XmNarrowSize
  293. #endif
  294. #ifndef DtNarrowSpacing
  295. #define DtNarrowSpacing XmNarrowSpacing
  296. #endif
  297. #ifndef DtNcolumns
  298. #define DtNcolumns XmNcolumns
  299. #endif
  300. #ifndef DtNcomboBoxType
  301. #define DtNcomboBoxType XmNcomboBoxType
  302. #endif
  303. #ifndef DtNitemCount
  304. #define DtNitemCount XmNitemCount
  305. #endif
  306. #ifndef DtNitems
  307. #define DtNitems XmNitems
  308. #endif
  309. #ifndef DtNlabelString
  310. #define DtNlabelString XmNlabelString
  311. #endif
  312. #ifndef DtNlist
  313. #define DtNlist XmNlist
  314. #endif
  315. #ifndef DtNmarginHeight
  316. #define DtNmarginHeight XmNmarginHeight
  317. #endif
  318. #ifndef DtNmarginWidth
  319. #define DtNmarginWidth XmNmarginWidth
  320. #endif
  321. #ifndef DtNselectedItem
  322. #define DtNselectedItem XmNselectedItem
  323. #endif
  324. #ifndef DtNselectedPosition
  325. #define DtNselectedPosition XmNselectedPosition
  326. #endif
  327. #ifndef DtNselectionCallback
  328. #define DtNselectionCallback XmNselectionCallback
  329. #endif
  330. #ifndef DtNtextField
  331. #define DtNtextField XmNtextField
  332. #endif
  333. #ifndef DtNvisibleItemCount
  334. #define DtNvisibleItemCount XmNvisibleItemCount
  335. #endif
  336. #ifndef DtCArrowSize
  337. #define DtCArrowSize XmCArrowSize
  338. #endif
  339. #ifndef DtCArrowSpacing
  340. #define DtCArrowSpacing XmCArrowSpacing
  341. #endif
  342. #ifndef DtCCallback
  343. #define DtCCallback XmCCallback
  344. #endif
  345. #ifndef DtCColumns
  346. #define DtCColumns XmCColumns
  347. #endif
  348. #ifndef DtCComboBoxType
  349. #define DtCComboBoxType XmCComboBoxType
  350. #endif
  351. #ifndef DtCItemCount
  352. #define DtCItemCount XmCItemCount
  353. #endif
  354. #ifndef DtCItems
  355. #define DtCItems XmCItems
  356. #endif
  357. #ifndef DtCList
  358. #define DtCList XmCList
  359. #endif
  360. #ifndef DtCMarginHeight
  361. #define DtCMarginHeight XmCMarginHeight
  362. #endif
  363. #ifndef DtCMarginWidth
  364. #define DtCMarginWidth XmCMarginWidth
  365. #endif
  366. #ifndef DtCSelectedItem
  367. #define DtCSelectedItem XmCSelectedItem
  368. #endif
  369. #ifndef DtCSelectedPosition
  370. #define DtCSelectedPosition XmCSelectedPosition
  371. #endif
  372. #ifndef DtCTextField
  373. #define DtCTextField XmCTextField
  374. #endif
  375. #ifndef DtCVisibleItemCount
  376. #define DtCVisibleItemCount XmCVisibleItemCount
  377. #endif
  378. #ifndef DtCXmString
  379. #define DtCXmString XmCXmString
  380. #endif
  381. #endif /* DT_USE_XM_COMBOBOX */
  382. /* Representation types */
  383. #ifndef DT_USE_XM_COMBOBOX
  384. #ifndef DtRArrowType
  385. #define DtRArrowType "ArrowType"
  386. #endif
  387. #ifndef DtRComboBoxType
  388. #define DtRComboBoxType "ComboBoxType"
  389. #endif
  390. #else /* DT_USE_XM_COMBOBOX */
  391. #ifndef DtRComboBoxType
  392. #define DtRComboBoxType XmRComboBoxType
  393. #endif
  394. #endif /* DT_USE_XM_COMBOBOX */
  395. /* DtNorientation values */
  396. #ifndef DT_USE_XM_COMBOBOX
  397. #ifndef DtLEFT
  398. #define DtLEFT 1
  399. #endif
  400. #ifndef DtRIGHT
  401. #define DtRIGHT 2
  402. #endif
  403. #endif /* not DT_USE_XM_COMBOBOX */
  404. /* DtNarrowType values */
  405. #ifndef DT_USE_XM_COMBOBOX
  406. #ifndef DtMOTIF
  407. #define DtMOTIF 0
  408. #endif
  409. #ifndef DtWINDOWS
  410. #define DtWINDOWS 1
  411. #endif
  412. #endif /* not DT_USE_XM_COMBOBOX */
  413. /* DtNcomboBoxType values */
  414. #ifndef DT_USE_XM_COMBOBOX
  415. #ifndef DtDROP_DOWN_LIST
  416. #define DtDROP_DOWN_LIST 2
  417. #endif
  418. #ifndef DtDROP_DOWN_COMBO_BOX
  419. #define DtDROP_DOWN_COMBO_BOX 1
  420. #endif
  421. #else /* DT_USE_XM_COMBOBOX */
  422. #ifndef DtDROP_DOWN_LIST
  423. #define DtDROP_DOWN_LIST XmDROP_DOWN_LIST
  424. #endif
  425. #ifndef DtDROP_DOWN_COMBO_BOX
  426. #define DtDROP_DOWN_COMBO_BOX XmDROP_DOWN_COMBO_BOX
  427. #endif
  428. #endif /* DT_USE_XM_COMBOBOX */
  429. /* DtNalignment values */
  430. #ifndef DT_USE_XM_COMBOBOX
  431. #ifndef DtALIGNMENT_BEGINNING
  432. #define DtALIGNMENT_BEGINNING XmALIGNMENT_BEGINNING
  433. #endif
  434. #ifndef DtALIGNMENT_CENTER
  435. #define DtALIGNMENT_CENTER XmALIGNMENT_CENTER
  436. #endif
  437. #ifndef DtALIGNMENT_END
  438. #define DtALIGNMENT_END XmALIGNMENT_END
  439. #endif
  440. #endif /* not DT_USE_XM_COMBOBOX */
  441. /* Callback reasons */
  442. #ifndef DT_USE_XM_COMBOBOX
  443. #ifndef DtCR_SELECT
  444. #define DtCR_SELECT 57 /* Large #, so no collisions with XM */
  445. #endif
  446. #ifndef DtCR_MENU_POST
  447. #define DtCR_MENU_POST 129 /* Large #, so no collisions with XM */
  448. #endif
  449. #endif /* not DT_USE_XM_COMBOBOX */
  450. /*
  451. * Types
  452. */
  453. #ifndef DT_USE_XM_COMBOBOX
  454. typedef struct {
  455. int reason;
  456. XEvent *event;
  457. XmString item_or_text;
  458. int item_position;
  459. } DtComboBoxCallbackStruct;
  460. /* Widget class and instance */
  461. typedef struct _DtComboBoxClassRec *DtComboBoxWidgetClass;
  462. typedef struct _DtComboBoxRec *DtComboBoxWidget;
  463. #else /* DT_USE_XM_COMBOBOX */
  464. #define DtComboBoxCallbackStruct XmComboBoxCallbackStruct
  465. #define DtComboBoxWidgetClass XmComboBoxWidgetClass
  466. #define DtComboBoxWidget XmComboBoxWidget
  467. #endif /* DT_USE_XM_COMBOBOX */
  468. /*
  469. * Data
  470. */
  471. #ifndef DT_USE_XM_COMBOBOX
  472. /* Widget class record */
  473. externalref WidgetClass dtComboBoxWidgetClass;
  474. #else /* DT_USE_XM_COMBOBOX */
  475. #define dtComboBoxWidgetClass xmComboBoxWidgetClass;
  476. #endif /* DT_USE_XM_COMBOBOX */
  477. /*
  478. * Functions
  479. */
  480. #ifndef DT_USE_XM_COMBOBOX
  481. extern Widget DtCreateComboBox(
  482. Widget parent,
  483. char *name,
  484. ArgList arglist,
  485. Cardinal argcount);
  486. extern void DtComboBoxAddItem(
  487. Widget combo,
  488. XmString item,
  489. int pos,
  490. Boolean unique);
  491. extern void DtComboBoxDeletePos(
  492. Widget combo,
  493. int pos);
  494. extern void DtComboBoxSetItem(
  495. Widget combo,
  496. XmString item);
  497. extern void DtComboBoxSelectItem(
  498. Widget combo,
  499. XmString item);
  500. #else /* DT_USE_XM_COMBOBOX */
  501. #define DtCreateComboBox XmCreateComboBox
  502. #define DtComboBoxAddItem XmComboBoxAddItem
  503. #define DtComboBoxDeletePos XmComboBoxDeletePos
  504. #define DtComboBoxSetItem XmComboBoxSetItem
  505. #define DtComboBoxSelectItem XmComboBoxSelectItem
  506. #endif /* DT_USE_XM_COMBOBOX */
  507. #ifdef __cplusplus
  508. }
  509. #endif
  510. #endif /* _Dt_ComboBox_h */