CanvasP.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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. /* $TOG: CanvasP.h /main/17 1999/10/14 13:19:41 mgreess $ */
  24. /*************************************<+>*************************************
  25. *****************************************************************************
  26. **
  27. ** File: CanvasP.h
  28. **
  29. ** Project: Cde Help System
  30. **
  31. ** Description: Private Header file for the UI independent core engine
  32. ** of the help system. It contains function prototypes,
  33. ** structure definitions, typedefs, etc.
  34. **
  35. ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
  36. **
  37. ** (c) Copyright 1993, 1994 Hewlett-Packard Company
  38. ** (c) Copyright 1993, 1994 International Business Machines Corp.
  39. ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  40. ** (c) Copyright 1993, 1994 Novell, Inc.
  41. *****************************************************************************
  42. *************************************<+>*************************************/
  43. #ifndef _DtCanvasP_h
  44. #define _DtCanvasP_h
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. /******** Public Re-defines ********/
  49. #if !defined(_AIX)
  50. #define _DtCvStrCaseCmp(s1,s2) strcasecmp(s1,s2)
  51. #define _DtCvStrNCaseCmp(s1,s2, n) strncasecmp(s1,s2,n)
  52. #else
  53. #define _DtCvStrCaseCmp(s1,s2) _DtHelpCeStrCaseCmp(s1,s2)
  54. #define _DtCvStrNCaseCmp(s1,s2,n) _DtHelpCeStrNCaseCmp(s1,s2, n)
  55. #endif /* _AIX */
  56. /******** Public Defines Declarations ********/
  57. /*
  58. * true, false and null
  59. */
  60. #ifndef Null
  61. #define Null 0
  62. #endif
  63. #ifndef NULL
  64. #define NULL 0
  65. #endif
  66. #ifndef False
  67. #define False 0
  68. #endif
  69. #ifndef True
  70. #define True 1
  71. #endif
  72. #ifndef FALSE
  73. #define FALSE 0
  74. #endif
  75. #ifndef TRUE
  76. #define TRUE 1
  77. #endif
  78. /*
  79. * Get Selection Type Declarations
  80. */
  81. #define _DtCvSELECTED_TEXT (1 << 0)
  82. #define _DtCvSELECTED_REGION (1 << 1)
  83. #define _DtCvSELECTED_ALL (~((unsigned int) 0))
  84. /*
  85. * hypertext link types
  86. */
  87. #define _DtCvLinkType_Execute 3
  88. #define _DtCvLinkType_ManPage 4
  89. #define _DtCvLinkType_AppDefine 5
  90. #define _DtCvLinkType_SameVolume 6
  91. #define _DtCvLinkType_CrossLink 7
  92. #define _DtCvLinkType_TextFile 8
  93. /*
  94. * hypertext window hints
  95. */
  96. #define _DtCvWindowHint_PopupWindow 1
  97. #define _DtCvWindowHint_CurrentWindow 2
  98. #define _DtCvWindowHint_NewWindow 3
  99. #define _DtCvWindowHint_Original 4
  100. /*********************
  101. * Rendering flags
  102. *********************/
  103. /*
  104. * Rendering flags - Link
  105. */
  106. #define _DtCvLINK_FLAG (0x01 << 0)
  107. #define _DtCvLINK_BEGIN (0x01 << 1)
  108. #define _DtCvLINK_END (0x01 << 2)
  109. #define _DtCvLINK_POP_UP (0x01 << 3)
  110. #define _DtCvLINK_NEW_WINDOW (0x01 << 4)
  111. /*
  112. * Rendering flags - Search
  113. *
  114. * a gap is left for the search flags on a segment in CanvasSegP.h. If these
  115. * change value, the other values must move to accommodate it. */
  116. #define _DtCvSEARCH_FLAG (0x01 << 5)
  117. #define _DtCvSEARCH_BEGIN (0x01 << 6)
  118. #define _DtCvSEARCH_END (0x01 << 7)
  119. #define _DtCvSEARCH_CURR (0x01 << 8)
  120. /*
  121. * Rendering flags - Mark
  122. */
  123. #define _DtCvMARK_FLAG (0x01 << 9)
  124. #define _DtCvMARK_BEGIN (0x01 << 10)
  125. #define _DtCvMARK_END (0x01 << 11)
  126. #define _DtCvMARK_ON (0x01 << 12)
  127. /*
  128. * Rendering flags - Traversal
  129. */
  130. #define _DtCvTRAVERSAL_FLAG (0x01 << 13)
  131. #define _DtCvTRAVERSAL_BEGIN (0x01 << 14)
  132. #define _DtCvTRAVERSAL_END (0x01 << 15)
  133. /*
  134. * Rendering flags - Application defined flags.
  135. */
  136. #define _DtCvAPP_FIELD_OFFSET (16)
  137. #define _DtCvAPP_FIELD_MASK (0x0f << _DtCvAPP_FIELD_OFFSET)
  138. #define _DtCvAPP_FIELD_S_MASK (0x03 << _DtCvAPP_FIELD_OFFSET)
  139. #define _DtCvAPP_FLAG1 (0x01 << (_DtCvAPP_FIELD_OFFSET + 0))
  140. #define _DtCvAPP_FLAG2 (0x01 << (_DtCvAPP_FIELD_OFFSET + 1))
  141. #define _DtCvAPP_FLAG3 (0x01 << (_DtCvAPP_FIELD_OFFSET + 2))
  142. #define _DtCvAPP_FLAG4 (0x01 << (_DtCvAPP_FIELD_OFFSET + 3))
  143. /*
  144. * Rendering flags - Selection
  145. */
  146. #define _DtCvSELECTED_FLAG (0x01 << 20)
  147. #define _DtCvEND_OF_LINE (0x01 << 21)
  148. /*
  149. * Activation masks
  150. */
  151. #define _DtCvACTIVATE_SELECTION (0x01 << 0)
  152. #define _DtCvACTIVATE_MARK (0x01 << 1)
  153. #define _DtCvDEACTIVATE (0x01 << 2)
  154. #define _DtCvACTIVATE_MARK_ON (0x01 << 3)
  155. #define _DtCvACTIVATE_MARK_OFF (0x01 << 4)
  156. /******** Public Enum Declarations ********/
  157. /*
  158. * Element types
  159. */
  160. enum _dtCvElemType
  161. {
  162. _DtCvBAD_TYPE,
  163. _DtCvCANVAS_TYPE,
  164. _DtCvLINE_TYPE,
  165. _DtCvLINK_TYPE,
  166. _DtCvLOCALE_TYPE,
  167. _DtCvMARK_TYPE,
  168. _DtCvREGION_TYPE,
  169. _DtCvSTRING_TYPE,
  170. _DtCvTRAVERSAL_TYPE
  171. };
  172. typedef enum _dtCvElemType _DtCvElemType;
  173. /*
  174. * Canvas Engine values. Either parameters or return values.
  175. */
  176. enum _dtCvValue
  177. {
  178. /*
  179. * status types. i.e. True/False, Ok/Bad, etc.
  180. */
  181. _DtCvFALSE = False,
  182. _DtCvSTATUS_OK = False,
  183. _DtCvTRUE = True,
  184. _DtCvSTATUS_BAD = True,
  185. _DtCvSTATUS_ID_BAD,
  186. _DtCvSTATUS_NONE,
  187. _DtCvSTATUS_LINK,
  188. _DtCvSTATUS_MARK,
  189. /*
  190. * Render types
  191. */
  192. _DtCvRENDER_PARTIAL,
  193. _DtCvRENDER_COMPLETE,
  194. /*
  195. * Traversal defines
  196. */
  197. _DtCvTRAVERSAL_OFF,
  198. _DtCvTRAVERSAL_ON,
  199. _DtCvTRAVERSAL_TOP,
  200. _DtCvTRAVERSAL_NEXT,
  201. _DtCvTRAVERSAL_PREV,
  202. _DtCvTRAVERSAL_BOTTOM,
  203. _DtCvTRAVERSAL_ID,
  204. _DtCvTRAVERSAL_MARK,
  205. /*
  206. * processing a selection types
  207. */
  208. _DtCvSELECTION_CLEAR,
  209. _DtCvSELECTION_START,
  210. _DtCvSELECTION_UPDATE,
  211. _DtCvSELECTION_END,
  212. /*
  213. * honor the right boundary when laying out information
  214. */
  215. _DtCvUSE_BOUNDARY,
  216. _DtCvUSE_BOUNDARY_MOVE,
  217. _DtCvIGNORE_BOUNDARY
  218. };
  219. typedef enum _dtCvValue _DtCvValue;
  220. typedef enum _dtCvValue _DtCvStatus;
  221. typedef enum _dtCvValue _DtCvRenderType;
  222. typedef enum _dtCvValue _DtCvTraversalCmd;
  223. typedef enum _dtCvValue _DtCvSelectMode;
  224. /*
  225. * line wrap mode types.
  226. */
  227. enum _dtCvModeType
  228. {
  229. _DtCvModeWrapNone,
  230. _DtCvModeWrapDown,
  231. _DtCvModeWrapUp
  232. };
  233. typedef enum _dtCvModeType _DtCvModeType;
  234. /******** Public Typedef Declarations ********/
  235. typedef void* _DtCvPointer;
  236. typedef void* _DtCvHandle;
  237. typedef int _DtCvUnit;
  238. typedef unsigned long _DtCvFlags;
  239. typedef struct _dtCvSegPts _DtCvSegPts;
  240. typedef struct _dtCvSegment _DtCvSegment;
  241. /******** Public Structures Declarations ********/
  242. typedef struct _dtCvMetrics {
  243. _DtCvUnit width; /* max width of canvas area */
  244. _DtCvUnit height; /* max height of canvas area */
  245. _DtCvUnit top_margin; /* top margin to allow for */
  246. _DtCvUnit side_margin; /* left margin to allow for */
  247. _DtCvUnit line_height; /* the height of an average line of */
  248. /* text */
  249. _DtCvUnit horiz_pad_hint; /* the optimul spacing to use if */
  250. /* lines have to be squeezed for */
  251. /* _DtCvUSE_BOUNDARY */
  252. } _DtCvMetrics;
  253. typedef struct _dtCvSpaceMetrics {
  254. _DtCvUnit space_before;
  255. _DtCvUnit space_after;
  256. _DtCvUnit space_above;
  257. _DtCvUnit space_below;
  258. } _DtCvSpaceMetrics;
  259. typedef struct _dtCvLocale {
  260. _DtCvModeType line_wrap_mode; /* specifies the wrap mode */
  261. const wchar_t *cant_begin_chars; /* specifies the characters */
  262. /* that can't begin a line */
  263. const wchar_t *cant_end_chars; /* specifies the characters */
  264. /* that can't end a line */
  265. } _DtCvLocale;
  266. typedef struct _dtCvStringInfo {
  267. const void *string;
  268. int byte_len;
  269. int wc;
  270. _DtCvPointer font_ptr;
  271. _DtCvPointer csd;
  272. } _DtCvStringInfo;
  273. typedef struct _dtCvLineInfo {
  274. _DtCvUnit x2;
  275. _DtCvUnit y2;
  276. _DtCvUnit width;
  277. _DtCvPointer data;
  278. } _DtCvLineInfo;
  279. typedef struct _dtCvRenderInfo {
  280. _DtCvPointer info;
  281. _DtCvUnit box_x;
  282. _DtCvUnit box_y;
  283. _DtCvUnit box_height;
  284. _DtCvUnit box_width;
  285. } _DtCvRenderInfo;
  286. typedef struct _dtCvLinkInfo {
  287. char *specification;
  288. char *description;
  289. int hyper_type;
  290. int win_hint;
  291. _DtCvUnit offset_x;
  292. _DtCvUnit offset_y;
  293. } _DtCvLinkInfo;
  294. typedef struct _dtCvPointInfo {
  295. _DtCvPointer client_data;
  296. _DtCvSegPts **segs;
  297. } _DtCvPointInfo;
  298. /******** Public Structure Typedef Declarations ********/
  299. typedef struct _dtCvTopicInfo* _DtCvTopicPtr;
  300. /******** Public Prototyped Procedures ********/
  301. typedef void (*_DtCvGetMetrics)(
  302. _DtCvPointer /* client_data */,
  303. _DtCvElemType /* elem_type */,
  304. _DtCvPointer /* ret_metrics */
  305. );
  306. typedef void (*_DtCvRenderElem)(
  307. _DtCvPointer /* client_data */,
  308. _DtCvElemType /* elem_type */,
  309. _DtCvUnit /* x */,
  310. _DtCvUnit /* y */,
  311. int /* link_type */,
  312. _DtCvFlags /* old_flags */,
  313. _DtCvFlags /* new_flags */,
  314. _DtCvElemType /* trav_type */,
  315. _DtCvPointer /* trav_data */,
  316. _DtCvPointer /* data */
  317. );
  318. typedef _DtCvUnit (*_DtCvGetElemWidth)(
  319. _DtCvPointer /* client_data */,
  320. _DtCvElemType /* elem_type */,
  321. _DtCvPointer /* data */
  322. );
  323. typedef void (*_DtCvGetFontMetrics)(
  324. _DtCvPointer /* client_data */,
  325. _DtCvPointer /* font_ptr */,
  326. _DtCvUnit* /* *ret_ascent */,
  327. _DtCvUnit* /* *ret_descent */,
  328. _DtCvUnit* /* *ret_width */,
  329. _DtCvUnit* /* *ret_super */,
  330. _DtCvUnit* /* *ret_sub */
  331. );
  332. typedef _DtCvStatus (*_DtCvBuildSelection)(
  333. _DtCvPointer /* client_data */,
  334. _DtCvElemType /* elem_type */,
  335. unsigned int /* mask */,
  336. _DtCvPointer* /* prev_info */,
  337. _DtCvUnit /* space */,
  338. _DtCvUnit /* width */,
  339. _DtCvFlags /* flags */,
  340. _DtCvPointer /* data */
  341. );
  342. typedef int (*_DtCvFilterExecCmd)(
  343. _DtCvPointer /* client_data */,
  344. const char* /* cmd */,
  345. char** /* ret_cmd */
  346. );
  347. /******** Public Structures Declarations ********/
  348. typedef struct _dtCvVirtualInfo {
  349. _DtCvGetMetrics get_metrics;
  350. _DtCvRenderElem render_elem;
  351. _DtCvGetElemWidth get_width;
  352. _DtCvGetFontMetrics get_font_metrics;
  353. _DtCvBuildSelection build_selection;
  354. _DtCvFilterExecCmd exec_cmd_filter;
  355. } _DtCvVirtualInfo;
  356. typedef struct _dtCvMarkPos {
  357. _DtCvPointer client_data;
  358. _DtCvUnit x1;
  359. _DtCvUnit y1;
  360. _DtCvUnit baseline1;
  361. _DtCvUnit x2;
  362. _DtCvUnit y2;
  363. _DtCvUnit baseline2;
  364. } _DtCvMarkPos;
  365. /******** Public Macro Declarations ********/
  366. /******** Semi-Public Function Declarations ********/
  367. extern int _DtCvGetSearchLineMetrics(
  368. _DtCvHandle canvas_handle,
  369. int search_hit_index,
  370. _DtCvUnit* baseline,
  371. _DtCvUnit* descent,
  372. _DtCvUnit* ascent);
  373. /******** Public Function Declarations ********/
  374. extern _DtCvStatus _DtCanvasActivatePts(
  375. _DtCvHandle canvas_handle,
  376. unsigned int mask,
  377. _DtCvPointInfo *info,
  378. _DtCvUnit *ret_y1,
  379. _DtCvUnit *ret_y2);
  380. extern void _DtCanvasClean(
  381. _DtCvHandle canvas_handle);
  382. extern _DtCvHandle _DtCanvasCreate(
  383. _DtCvVirtualInfo virt_info,
  384. _DtCvPointer client_data);
  385. extern void _DtCanvasDestroy(
  386. _DtCvHandle canvas_handle);
  387. extern _DtCvStatus _DtCanvasGetCurLink(
  388. _DtCvHandle canvas_handle,
  389. _DtCvLinkInfo *ret_info);
  390. extern _DtCvStatus _DtCanvasGetCurTraversal(
  391. _DtCvHandle canvas_handle,
  392. _DtCvLinkInfo *ret_info,
  393. _DtCvPointer *ret_data);
  394. extern _DtCvStatus _DtCanvasGetMarkPositions(
  395. _DtCvHandle canvas_handle,
  396. _DtCvMarkPos ***ret_pos);
  397. extern _DtCvStatus _DtCanvasGetPosLink(
  398. _DtCvHandle canvas_handle,
  399. _DtCvUnit x1,
  400. _DtCvUnit y1,
  401. _DtCvUnit x2,
  402. _DtCvUnit y2,
  403. _DtCvLinkInfo *ret_info);
  404. extern _DtCvStatus _DtCanvasGetSelection(
  405. _DtCvHandle canvas_handle,
  406. unsigned int mask,
  407. _DtCvPointer *ret_select);
  408. extern _DtCvStatus _DtCanvasGetSelectionPoints(
  409. _DtCvHandle canvas_handle,
  410. _DtCvSegPts ***ret_segs,
  411. _DtCvUnit *ret_y1,
  412. _DtCvUnit *ret_y2);
  413. extern _DtCvStatus _DtCanvasGetSpotInfo(
  414. _DtCvHandle canvas_handle,
  415. _DtCvUnit x,
  416. _DtCvUnit y,
  417. _DtCvSegment **ret_seg,
  418. _DtCvUnit *ret_offx,
  419. _DtCvUnit *ret_offy,
  420. _DtCvElemType *ret_element);
  421. extern _DtCvStatus _DtCanvasMoveTraversal(
  422. _DtCvHandle canvas_handle,
  423. _DtCvTraversalCmd cmd,
  424. _DtCvValue wrap,
  425. _DtCvValue render,
  426. _DtCvPointer rid,
  427. _DtCvUnit *ret_x,
  428. _DtCvUnit *ret_y,
  429. _DtCvUnit *ret_baseline,
  430. _DtCvUnit *ret_height);
  431. extern void _DtCanvasProcessSelection (
  432. _DtCvHandle canvas_handle,
  433. _DtCvUnit x,
  434. _DtCvUnit y,
  435. _DtCvSelectMode mode);
  436. extern void _DtCanvasRender(
  437. _DtCvHandle canvas_handle,
  438. _DtCvUnit x1,
  439. _DtCvUnit y1,
  440. _DtCvUnit x2,
  441. _DtCvUnit y2,
  442. _DtCvRenderType flag,
  443. _DtCvValue pg_break,
  444. _DtCvUnit *max_y,
  445. _DtCvUnit *next_y);
  446. extern _DtCvStatus _DtCanvasResize(
  447. _DtCvHandle canvas_handle,
  448. _DtCvValue force,
  449. _DtCvUnit *ret_width,
  450. _DtCvUnit *ret_height);
  451. extern _DtCvStatus _DtCanvasSetTopic(
  452. _DtCvHandle canvas_handle,
  453. _DtCvTopicPtr topic_handle,
  454. _DtCvValue honor_size,
  455. _DtCvUnit *ret_width,
  456. _DtCvUnit *ret_height,
  457. _DtCvUnit *ret_y);
  458. extern void _DtCanvasLoadMetrics(
  459. _DtCvHandle canvas_handle);
  460. #ifdef __cplusplus
  461. } /* Close scope of 'extern "C"' declaration which encloses file. */
  462. #endif
  463. #endif /* _DtCanvasP_h */
  464. /* DON'T ADD ANYTHING AFTER THIS #endif */