2
0

IconP.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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: IconP.h /main/7 1996/03/29 11:33:23 drk $ */
  24. /**---------------------------------------------------------------------
  25. ***
  26. *** file: IconP.h
  27. ***
  28. *** project: MotifPlus Widgets
  29. ***
  30. *** description: Private include file for DtIcon gadget class.
  31. ***
  32. ***
  33. *** (c) Copyright 1990 by Hewlett-Packard Company.
  34. ***
  35. ***
  36. ***-------------------------------------------------------------------*/
  37. #ifndef _DtIconP_h
  38. #define _DtIconP_h
  39. #include <Xm/ExtObjectP.h>
  40. #include <Xm/XmP.h>
  41. #include <Xm/GadgetP.h>
  42. #include <Dt/Icon.h>
  43. /*-------------------------------------------------------------
  44. ** Cache Class Structure
  45. */
  46. /* Cache Class Part
  47. */
  48. typedef struct _DtIconCacheObjClassPart
  49. {
  50. int foo;
  51. } DtIconCacheObjClassPart;
  52. /* Cache Full Class Record
  53. */
  54. typedef struct _DtIconCacheObjClassRec /* label cache class record */
  55. {
  56. ObjectClassPart object_class;
  57. XmExtClassPart ext_class;
  58. DtIconCacheObjClassPart icon_class_cache;
  59. } DtIconCacheObjClassRec;
  60. /* Cache Actual Class
  61. */
  62. externalref DtIconCacheObjClassRec dtIconCacheObjClassRec;
  63. /*-------------------------------------------------------------
  64. ** Cache Instance Structure
  65. */
  66. /* Cache Instance Part
  67. */
  68. typedef struct _DtIconCacheObjPart
  69. {
  70. Dimension margin_width;
  71. Dimension margin_height;
  72. Dimension string_height;
  73. Dimension spacing;
  74. Pixel foreground;
  75. Pixel background;
  76. Pixel arm_color;
  77. Boolean fill_on_arm;
  78. Boolean recompute_size;
  79. Boolean draw_shadow;
  80. unsigned char pixmap_position;
  81. unsigned char string_position;
  82. unsigned char alignment;
  83. unsigned char behavior;
  84. unsigned char fill_mode;
  85. } DtIconCacheObjPart;
  86. typedef struct _DtIconCacheObjRec
  87. {
  88. ObjectPart object;
  89. XmExtPart ext;
  90. DtIconCacheObjPart icon_cache;
  91. } DtIconCacheObjRec;
  92. typedef void (*GetPositionProc)(
  93. DtIconGadget,
  94. Position,
  95. Position,
  96. Dimension,
  97. Dimension,
  98. Position *,
  99. Position *,
  100. Position *,
  101. Position *
  102. );
  103. typedef void (*GetSizeProc)(
  104. DtIconGadget,
  105. Dimension *,
  106. Dimension *
  107. );
  108. typedef void (*DrawProc)(
  109. DtIconGadget,
  110. Drawable,
  111. Position,
  112. Position,
  113. Dimension,
  114. Dimension,
  115. Dimension,
  116. Dimension,
  117. unsigned char,
  118. unsigned char
  119. );
  120. typedef void (*CallCallbackProc)(
  121. DtIconGadget,
  122. XtCallbackList,
  123. int,
  124. XEvent *
  125. );
  126. typedef void (*UpdateGCsProc)(
  127. DtIconGadget
  128. );
  129. /*-------------------------------------------------------------
  130. ** Class Structure
  131. */
  132. /* Class Part
  133. */
  134. typedef struct _DtIconClassPart
  135. {
  136. GetSizeProc get_size;
  137. GetPositionProc get_positions;
  138. DrawProc draw;
  139. CallCallbackProc call_callback;
  140. UpdateGCsProc update_gcs;
  141. Boolean optimize_redraw;
  142. XmCacheClassPartPtr cache_part;
  143. caddr_t extension;
  144. } DtIconClassPart;
  145. /* Full Class Record
  146. */
  147. typedef struct _DtIconClassRec
  148. {
  149. RectObjClassPart rect_class;
  150. XmGadgetClassPart gadget_class;
  151. DtIconClassPart icon_class;
  152. } DtIconClassRec;
  153. /* Actual Class
  154. */
  155. externalref DtIconClassRec dtIconClassRec;
  156. /*-------------------------------------------------------------
  157. ** Instance Structure
  158. */
  159. /* Instance Part
  160. */
  161. typedef struct _DtIconPart
  162. {
  163. Boolean set;
  164. Boolean armed;
  165. Boolean sync;
  166. Boolean underline;
  167. unsigned char shadow_type;
  168. unsigned char border_type;
  169. XtCallbackList callback;
  170. XtIntervalId click_timer_id;
  171. XButtonEvent * click_event;
  172. String image_name;
  173. Pixmap pixmap;
  174. Pixmap mask;
  175. Pixel pixmap_foreground;
  176. Pixel pixmap_background;
  177. Dimension max_pixmap_width;
  178. Dimension max_pixmap_height;
  179. XmFontList font_list;
  180. XmString string;
  181. Dimension string_width;
  182. Dimension pixmap_width;
  183. Dimension pixmap_height;
  184. GC clip_gc;
  185. GC normal_gc;
  186. GC background_gc;
  187. GC armed_gc;
  188. GC armed_background_gc;
  189. GC parent_background_gc;
  190. Pixel saved_parent_background;
  191. DtIconCacheObjPart *cache;
  192. unsigned char operations;
  193. XtCallbackList drop_callback;
  194. } DtIconPart;
  195. /* Full Instance Record
  196. */
  197. typedef struct _DtIconRec
  198. {
  199. ObjectPart object;
  200. RectObjPart rectangle;
  201. XmGadgetPart gadget;
  202. DtIconPart icon;
  203. } DtIconRec;
  204. /*-------------------------------------------------------------
  205. ** Class and Instance Macros
  206. */
  207. /* DtIcon Class Macros
  208. */
  209. #define DtInheritGetSize ((GetSizeProc) _XtInherit)
  210. #define DtInheritGetPositions ((GetPositionProc) _XtInherit)
  211. #define DtInheritDraw ((DrawProc) _XtInherit)
  212. #define DtInheritCallCallback ((CallCallbackProc) _XtInherit)
  213. #define DtInheritUpdateGCs ((UpdateGCsProc) _XtInherit)
  214. /*** WARNING: These macros are not thread-safe! ***/
  215. #define C_GetSize(wc) \
  216. (((DtIconGadgetClass)(wc)) -> icon_class.get_size)
  217. #define C_GetPositions(wc) \
  218. (((DtIconGadgetClass)(wc)) -> icon_class.get_positions)
  219. #define C_Draw(wc) \
  220. (((DtIconGadgetClass)(wc)) -> icon_class.draw)
  221. #define C_CallCallback(wc) \
  222. (((DtIconGadgetClass)(wc)) -> icon_class.call_callback)
  223. #define C_OptimizeRedraw(wc) \
  224. (((DtIconGadgetClass)(wc)) -> icon_class.optimize_redraw)
  225. #define C_UpdateGCs(wc) \
  226. (((DtIconGadgetClass)(wc)) -> icon_class.update_gcs)
  227. /* DtIcon Macros
  228. */
  229. /*** WARNING: These macros are not thread-safe! ***/
  230. #define G_GetSize(g,w,h) \
  231. (((DtIconClassRec *)g -> object.widget_class) -> icon_class.get_size) \
  232. (g,w,h)
  233. #define G_GetPositions(g,w,h,h_t,s_t,p_x,p_y,s_x,s_y) \
  234. (((DtIconClassRec *)g -> object.widget_class) -> icon_class.get_positions) \
  235. (g,w,h,h_t,s_t,p_x,p_y,s_x,s_y)
  236. #define G_Draw(g,d,x,y,w,h,h_t,s_t,s_type,fill) \
  237. (((DtIconClassRec *)g -> object.widget_class) -> icon_class.draw) \
  238. (g,d,x,y,w,h,h_t,s_t,s_type,fill)
  239. #define G_CallCallback(g,cb,r,e) \
  240. (((DtIconClassRec *)g -> object.widget_class) -> icon_class.call_callback) \
  241. (g,cb,r,e)
  242. #define G_UpdateGCs(g) \
  243. (((DtIconClassRec *)g -> object.widget_class) -> icon_class.update_gcs) \
  244. (g)
  245. /* Cached Instance Field Macros
  246. */
  247. #define G_CachePixmapPosition(co) (((DtIconCacheObject)(co)) -> \
  248. icon_cache.pixmap_position)
  249. #define G_FillOnArm(g) (((DtIconGadget)(g)) -> \
  250. icon.cache -> fill_on_arm)
  251. #define G_RecomputeSize(g) (((DtIconGadget)(g)) -> \
  252. icon.cache -> recompute_size)
  253. #define G_DrawShadow(g) (((DtIconGadget)(g)) -> \
  254. icon.cache -> draw_shadow)
  255. #define G_PixmapPosition(g) (((DtIconGadget)(g)) -> \
  256. icon.cache -> pixmap_position)
  257. #define G_StringPosition(g) (((DtIconGadget)(g)) -> \
  258. icon.cache -> string_position)
  259. #define G_Alignment(g) (((DtIconGadget)(g)) -> \
  260. icon.cache -> alignment)
  261. #define G_Behavior(g) (((DtIconGadget)(g)) -> \
  262. icon.cache -> behavior)
  263. #define G_FillMode(g) (((DtIconGadget)(g)) -> \
  264. icon.cache -> fill_mode)
  265. #define G_MarginWidth(g) (((DtIconGadget)(g)) -> \
  266. icon.cache -> margin_width)
  267. #define G_MarginHeight(g) (((DtIconGadget)(g)) -> \
  268. icon.cache -> margin_height)
  269. #define G_StringHeight(g) (((DtIconGadget)(g)) -> \
  270. icon.cache -> string_height)
  271. #define G_Spacing(g) (((DtIconGadget)(g)) -> \
  272. icon.cache -> spacing)
  273. #define G_Foreground(g) (((DtIconGadget)(g)) -> \
  274. icon.cache -> foreground)
  275. #define G_Background(g) (((DtIconGadget)(g)) -> \
  276. icon.cache -> background)
  277. #define G_ArmColor(g) (((DtIconGadget)(g)) -> \
  278. icon.cache -> arm_color)
  279. /* Non-Cached Instance Field Macros
  280. */
  281. #define G_Armed(g) (g -> icon.armed)
  282. #define G_Set(g) (g -> icon.set)
  283. #define G_Sync(g) (g -> icon.sync)
  284. #define G_Callback(g) (g -> icon.callback)
  285. #define G_ClickTimerID(g) (g -> icon.click_timer_id)
  286. #define G_ClickInterval(g) (g -> icon.click_interval)
  287. #define G_ClickEvent(g) (g -> icon.click_event)
  288. #define G_ShadowType(g) (g -> icon.shadow_type)
  289. #define G_BorderType(g) (g -> icon.border_type)
  290. #define G_Pixmap(g) (g -> icon.pixmap)
  291. #define G_Mask(g) (g -> icon.mask)
  292. #define G_PixmapForeground(g) (g -> icon.pixmap_foreground)
  293. #define G_PixmapBackground(g) (g -> icon.pixmap_background)
  294. #define G_MaxPixmapWidth(g) (g -> icon.max_pixmap_width)
  295. #define G_MaxPixmapHeight(g) (g -> icon.max_pixmap_height)
  296. #define G_String(g) (g -> icon.string)
  297. #define G_FontList(g) (g -> icon.font_list)
  298. #define G_ImageName(g) (g -> icon.image_name)
  299. #define G_StringWidth(g) (g -> icon.string_width)
  300. #define G_PixmapWidth(g) (g -> icon.pixmap_width)
  301. #define G_PixmapHeight(g) (g -> icon.pixmap_height)
  302. #define G_BackgroundGC(g) (g -> icon.background_gc)
  303. #define G_ArmedGC(g) (g -> icon.armed_gc)
  304. #define G_ArmedBackgroundGC(g) (g -> icon.armed_background_gc)
  305. #define G_NormalGC(g) (g -> icon.normal_gc)
  306. #define G_ClipGC(g) (g -> icon.clip_gc)
  307. #define G_Underline(g) (g -> icon.underline)
  308. #define G_ParentBackgroundGC(g) (g -> icon.parent_background_gc)
  309. #define G_SavedParentBG(g) (g -> icon.saved_parent_background)
  310. #define G_Operations(g) (g -> icon.operations)
  311. #define G_DropCallback(g) (g -> icon.drop_callback)
  312. #define Icon_Cache(w) (((DtIconGadget)(w))-> \
  313. icon.cache)
  314. #define Icon_ClassCachePart(w) \
  315. (((DtIconGadgetClass)dtIconGadgetClass)->gadget_class.cache_part)
  316. #endif /* _DtIconP_h */
  317. /* DON'T ADD ANYTHING AFTER THIS #endif */