View.c 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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. /* static char rcsid[] =
  24. "$XConsortium: View.c /main/6 1996/10/14 10:48:27 pascale $";
  25. */
  26. /**---------------------------------------------------------------------
  27. ***
  28. *** file: View.c
  29. ***
  30. *** project: MotifPlus Widgets
  31. ***
  32. *** description: Source code for DtView class.
  33. ***
  34. ***
  35. *** (c) Copyright 1990 by Hewlett-Packard Company.
  36. ***
  37. ***
  38. ***-------------------------------------------------------------------*/
  39. /*-------------------------------------------------------------
  40. ** Include Files
  41. */
  42. #include <stdio.h>
  43. #include <Xm/DialogS.h>
  44. #include <Xm/LabelG.h>
  45. #include <Xm/List.h>
  46. #include <Xm/SeparatoG.h>
  47. #include <Xm/TextF.h>
  48. #include <Dt/Control.h>
  49. #include <Dt/ViewP.h>
  50. /*-------------------------------------------------------------
  51. ** Public Interface
  52. **-------------------------------------------------------------
  53. */
  54. WidgetClass dtViewWidgetClass;
  55. Widget _DtCreateView ();
  56. /*-------------------------------------------------------------
  57. ** Forward Declarations
  58. */
  59. #define OFFSET 12
  60. #define XmCR_SELECT XmCR_SINGLE_SELECT
  61. /******** Public Function Declarations ********/
  62. extern Widget _DtCreateView(
  63. Widget parent,
  64. String name,
  65. ArgList arglist,
  66. Cardinal argcount) ;
  67. /******** End Public Function Declarations ********/
  68. /******** Static Function Declarations ********/
  69. /******** End Static Function Declarations ********/
  70. /*-------------------------------------------------------------
  71. ** Translations and Actions
  72. */
  73. /*-------------------------------------------------------------
  74. ** Resource List
  75. */
  76. /* Define offset macros.
  77. */
  78. #define R_Offset(field) \
  79. XtOffset (DtViewWidget, view.field)
  80. static XtResource resources[] =
  81. {
  82. {
  83. XmNleftInset,
  84. XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
  85. R_Offset (left_inset), XmRImmediate, (caddr_t) 3
  86. },
  87. {
  88. XmNrightInset,
  89. XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
  90. R_Offset (right_inset), XmRImmediate, (caddr_t) 3
  91. },
  92. {
  93. XmNtopInset,
  94. XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
  95. R_Offset (top_inset), XmRImmediate, (caddr_t) 3
  96. },
  97. {
  98. XmNbottomInset,
  99. XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
  100. R_Offset (bottom_inset), XmRImmediate, (caddr_t) 3
  101. },
  102. {
  103. XmNwidthIncrement,
  104. XmCSpacing, XmRHorizontalDimension, sizeof (Dimension),
  105. R_Offset (width_increment), XmRImmediate, (caddr_t) 2
  106. },
  107. {
  108. XmNheightIncrement,
  109. XmCSpacing, XmRVerticalDimension, sizeof (Dimension),
  110. R_Offset (height_increment), XmRImmediate, (caddr_t) 2
  111. },
  112. {
  113. XmNboxType,
  114. XmCBoxType, XmRBoxType, sizeof (unsigned char),
  115. R_Offset (box_type),
  116. XmRImmediate, (XtPointer) XmBOX_NONE
  117. },
  118. {
  119. XmNsubpanelUnpostOnSelect,
  120. XmCSubpanelUnpostOnSelect, XmRBoolean, sizeof (Boolean),
  121. R_Offset (subpanel_unpost_on_select),
  122. XmRImmediate, (XtPointer) TRUE
  123. },
  124. {
  125. XmNsubpanelTorn,
  126. XmCSubpanelTorn, XmRBoolean, sizeof (Boolean),
  127. R_Offset (subpanel_torn), XmRImmediate, (XtPointer) FALSE
  128. }
  129. };
  130. /*-------------------------------------------------------------
  131. ** Class Record
  132. */
  133. DtViewClassRec dtViewClassRec =
  134. {
  135. /* Core Part
  136. */
  137. {
  138. (WidgetClass) &xmFormClassRec, /* superclass */
  139. "Box", /* class_name */
  140. sizeof (DtViewRec), /* widget_size */
  141. NULL, /* class_initialize */
  142. NULL, /* class_part_initialize*/
  143. False, /* class_inited */
  144. (XtInitProc) NULL, /* initialize */
  145. NULL, /* initialize_hook */
  146. XtInheritRealize, /* realize */
  147. NULL, /* actions */
  148. 0, /* num_actions */
  149. resources, /* resources */
  150. XtNumber (resources), /* num_resources */
  151. NULLQUARK, /* xrm_class */
  152. True, /* compress_motion */
  153. XtExposeCompressMaximal, /* compress_exposure */
  154. True, /* compress_enterleave */
  155. False, /* visible_interest */
  156. NULL, /* destroy */
  157. XtInheritResize, /* resize */
  158. XtInheritExpose, /* expose */
  159. (XtSetValuesFunc) NULL, /* set_values */
  160. NULL, /* set_values_hook */
  161. XtInheritSetValuesAlmost, /* set_values_almost */
  162. NULL, /* get_values_hook */
  163. NULL, /* accept_focus */
  164. XtVersion, /* version */
  165. NULL, /* callback private */
  166. XtInheritTranslations, /* tm_table */
  167. XtInheritQueryGeometry, /* query_geometry */
  168. NULL, /* display_accelerator */
  169. NULL, /* extension */
  170. },
  171. /* Composite Part
  172. */
  173. {
  174. XtInheritGeometryManager, /* geometry_manager */
  175. XtInheritChangeManaged, /* change_managed */
  176. XtInheritInsertChild, /* insert_child */
  177. XtInheritDeleteChild, /* delete_child */
  178. NULL, /* extension */
  179. },
  180. /* Constraint Part
  181. */
  182. {
  183. NULL, /* constraint_resources */
  184. 0, /* num_constraint_resources */
  185. sizeof (DtViewConstraintRec),/* constraint_record */
  186. NULL, /* constraint_initialize */
  187. NULL, /* constraint_destroy */
  188. NULL, /* constraint_set_values */
  189. NULL, /* extension */
  190. },
  191. /* XmManager Part
  192. */
  193. {
  194. XtInheritTranslations, /* default_translations */
  195. NULL, /* syn_resources */
  196. 0, /* num_syn_resources */
  197. NULL, /* syn_cont_resources */
  198. 0, /* num_syn_cont_resources */
  199. XmInheritParentProcess, /* parent_process */
  200. NULL, /* extension */
  201. },
  202. /* XmBulletinBoard Part
  203. */
  204. {
  205. False, /* always_install_accelerators*/
  206. NULL, /* geo_matrix_create */
  207. XmInheritFocusMovedProc, /* focus_moved_proc */
  208. NULL, /* extension */
  209. },
  210. /* XmForm Part
  211. */
  212. {
  213. NULL, /* extension */
  214. },
  215. /* DtView Part
  216. */
  217. {
  218. NULL, /* extension */
  219. }
  220. };
  221. WidgetClass dtViewWidgetClass = (WidgetClass) &dtViewClassRec;
  222. /*-------------------------------------------------------------
  223. ** Private Procs
  224. **-------------------------------------------------------------
  225. */
  226. /*-------------------------------------------------------------
  227. ** Action Procs
  228. **-------------------------------------------------------------
  229. */
  230. /*-------------------------------------------------------------
  231. ** Core Procs
  232. **-------------------------------------------------------------
  233. */
  234. /*-------------------------------------------------------------
  235. ** Initialize
  236. ** Initialize a new widget instance.
  237. */
  238. #if 0
  239. /* ARGSUSED */
  240. static void
  241. Initialize(
  242. Widget request_w,
  243. Widget new_w )
  244. {
  245. DtViewWidget request = (DtViewWidget) request_w,
  246. new = (DtViewWidget) new_w;
  247. Pixmap pix;
  248. /* Validate box type.
  249. */
  250. if (M_BoxType (new) != XmBOX_NONE &&
  251. M_BoxType (new) != XmBOX_PRIMARY &&
  252. M_BoxType (new) != XmBOX_SECONDARY &&
  253. M_BoxType (new) != XmBOX_SUBPANEL)
  254. {
  255. M_BoxType (new) == XmBOX_NONE;
  256. }
  257. }
  258. #endif /* 0 */
  259. /*-------------------------------------------------------------
  260. ** SetValues
  261. ** Handle changes in resource data.
  262. */
  263. #if 0
  264. static Boolean
  265. SetValues(
  266. Widget current_w,
  267. Widget request_w,
  268. Widget new_w )
  269. {
  270. DtViewWidget current = (DtViewWidget) current_w,
  271. request = (DtViewWidget) request_w,
  272. new = (DtViewWidget) new_w;
  273. Boolean redraw_flag = False;
  274. /* Can't change box type.
  275. */
  276. if (M_BoxType (new) != M_BoxType (current))
  277. {
  278. M_BoxType (new) = M_BoxType (current);
  279. }
  280. return (redraw_flag);
  281. }
  282. #endif /* 0 */
  283. /*-------------------------------------------------------------
  284. ** Composite Procs
  285. **-------------------------------------------------------------
  286. */
  287. /*-------------------------------------------------------------
  288. ** Manager Procs
  289. **-------------------------------------------------------------
  290. */
  291. /* All inherited from superclass.
  292. */
  293. /*-------------------------------------------------------------
  294. ** View Procs
  295. **-------------------------------------------------------------
  296. */
  297. /*-------------------------------------------------------------
  298. ** Public Entry Points
  299. **-------------------------------------------------------------
  300. */
  301. /*-------------------------------------------------------------
  302. ** _DtCreateView
  303. ** Create a new DtView instance.
  304. **-------------------------------------------------------------
  305. */
  306. Widget
  307. _DtCreateView(
  308. Widget parent,
  309. String name,
  310. ArgList arglist,
  311. Cardinal argcount )
  312. {
  313. return (XtCreateWidget (name, dtViewWidgetClass,
  314. parent, arglist, argcount));
  315. }