2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: CanvasSegP.h /main/19 1996/10/04 18:30:19 rswiston $ */
24 /*************************************<+>*************************************
25 *****************************************************************************
31 ** Description: Public Header file for Canvas Engine
33 ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
35 ** (c) Copyright 1993, 1994 Hewlett-Packard Company
36 ** (c) Copyright 1993, 1994 International Business Machines Corp.
37 ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
38 ** (c) Copyright 1993, 1994 Novell, Inc.
39 *******************************************************************
40 *************************************<+>*************************************/
41 #ifndef _DtCanvasSegP_h
42 #define _DtCanvasSegP_h
48 /******** Public Defines Declarations ********/
49 /*****************************************************************************
50 * Some bits in passed in as a _DtCvFlags and the 'type' in _DtCvSegment
51 * must match because they are passed straight thought from the segment
52 * to the application. The following map is to help prevent colisions.
54 * (-------------------------> _DtCvEND_OF_LINE
55 * | (-----------------------> _DtCvSELECTED_FLAG
57 * | | (-------------------------> _DtCvAPP_FLAG4 \
58 * | | | (-----------------------> _DtCvAPP_FLAG3 \
59 * | | | | (---------------------> _DtCvAPP_FLAG2 / _DtCvAPP_FIELD
60 * | | | | | (-------------------> _DtCvAPP_FLAG1 /
62 * | | | | | | (---------------------> _DtCvTRAVERSAL_END
63 * | | | | | | | (-------------------> _DtCvTRAVERSAL_BEGIN
64 * | | | | | | | | (-----------------> _DtCvTRAVERSAL_FLAG
66 * | | | | | | | | | (-------------------> _DtCvMARK_ON
67 * | | | | | | | | | | (-----------------> _DtCvMARK_END
68 * | | | | | | | | | | | (---------------> _DtCvMARK_BEGIN
69 * | | | | | | | | | | | | (-------------> _DtCvMARK_FLAG
70 * | | | | | | | | | | | | |
71 * | | | | | | | | | | | | | (-------------> _DtCvSEARCH_CURR
72 * | | | | | | | | | | | | | | (-----------> _DtCvSEARCH_END
73 * | | | | | | | | | | | | | | | (---------> _DtCvSEARCH_BEGIN
74 * | | | | | | | | | | | | | | | | (-------> _DtCvSEARCH_FLAG
75 * | | | | | | | | | | | | | | | | |
76 * | | | | | | | | | | | | | | | | | (---------> _DtCvLINK_NEW_WINDOW
77 * | | | | | | | | | | | | | | | | | | (-------> _DtCvLINK_POP_UP
78 * | | | | | | | | | | | | | | | | | | | (-----> _DtCvLINK_END
79 * | | | | | | | | | | | | | | | | | | | | (---> _DtCvLINK_BEGIN
80 * | | | | | | | | | | | | | | | | | | | | | (-> _DtCvLINK_FLAG
81 * | | | | | | | | | | | | | | | | | | | | | |
82 * v v v v v v#v v v v v v v v#v v v v v v v v
83 * 1 0 9 8 7 6#5 4 3 2 1 0 9 8#7 6 5 4 3 2 1 0
84 * ------------#---------------#----------------
85 * |.|.|.|.|.|.#.|.|.|.|.|.|.|.#.|.|.|.|.|.|.|.|
86 * ------------#---------------#----------------
87 * ^ ^ ^ ^ ^#^ ^ ^ ^ ^ ^ ^ ^#^ ^ ^ ^ ^^^^^
88 * | | | | | | | | | | | | | | | | | \|/
89 * | | | | | | | | | | | | | | | | | |
90 * | | | | | | | | | | | | | | | | | (-> Segment type
91 * | | | | | | | | | | | | | | | | (-----> _DtCvWIDE_CHAR
92 * | | | | | | | | | | | | | | | |
93 * | | | | | | | | | | | | | | | (-----> _DtCvSEARCH_FLAG
94 * | | | | | | | | | | | | | | (-------> _DtCvSEARCH_BEGIN
95 * | | | | | | | | | | | | | (---------> _DtCvSEARCH_END
96 * | | | | | | | | | | | | (-----------> _DtCvSEARCH_CURR
97 * | | | | | | | | | | | |
98 * | | | | | | | | | | | (---------> _DtCvCONTROLLER/_DtCvBLOCK_LINE/
99 * | | | | | | | | | | | _DtCvNEW_LINE
100 * | | | | | | | | | | (-----------> _DtCvSUB_SCRIPT
101 * | | | | | | | | | (-------------> _DtCvSUPER_SCRIPT
102 * | | | | | | | | (---------------> _DtCvGHOST_LINK
103 * | | | | | | | (-----------------> _DtCvHYPER_TEXT
104 * | | | | | | (-------------------> _DtCvNON_BREAK
105 * | | | | | (---------------------> _DtCvIN_LINE
107 * | | | | (---------------> _DtCvAPP_FLAG1 \
108 * | | | (-----------------> _DtCvAPP_FLAG2 \ _DtCvAPP_FIELD
109 * | | (-------------------> _DtCvAPP_FLAG3 /
110 * | (---------------------> _DtCvAPP_FLAG4 /
112 * (------------------> _DtCvPAGE_BREAK
114 *****************************************************************************/
118 #define _DtCvNOOP (0x00)
119 #define _DtCvCONTAINER (0x01)
120 #define _DtCvLINE (0x02)
121 #define _DtCvMARKER (0x03)
122 #define _DtCvREGION (0x04)
123 #define _DtCvSTRING (0x05)
124 #define _DtCvTABLE (0x06)
126 #define _DtCvPRIMARY_MASK (0x07)
127 #define _DtCvSHIFT_PAST_PRIMARY 3
130 * character size manipulation
132 #define _DtCvWIDE_CHAR (0x01 << _DtCvSHIFT_PAST_PRIMARY)
137 /* leave a gap for the search flags defined in CanvasP.h */
138 #define _DtCvSHIFT_TO_FLAGS 9
141 #define _DtCvCONTROLLER (0x01 << (_DtCvSHIFT_TO_FLAGS + 0))
144 #define _DtCvBLOCK_LINE (0x01 << (_DtCvSHIFT_TO_FLAGS + 0))
146 /* string & region (_DtCvNEW_LINE works on _DtCvNOOP too) */
147 #define _DtCvNEW_LINE (0x01 << (_DtCvSHIFT_TO_FLAGS + 0))
148 #define _DtCvSUB_SCRIPT (0x01 << (_DtCvSHIFT_TO_FLAGS + 1))
149 #define _DtCvSUPER_SCRIPT (0x01 << (_DtCvSHIFT_TO_FLAGS + 2))
150 #define _DtCvGHOST_LINK (0x01 << (_DtCvSHIFT_TO_FLAGS + 3))
151 #define _DtCvHYPER_TEXT (0x01 << (_DtCvSHIFT_TO_FLAGS + 4))
152 #define _DtCvNON_BREAK (0x01 << (_DtCvSHIFT_TO_FLAGS + 5))
155 #define _DtCvIN_LINE (0x01 << (_DtCvSHIFT_TO_FLAGS + 6))
157 /* application flags - defined in CanvasP.h (starting at 16th bit for 4 bits) */
159 /* valid on any segment */
160 #define _DtCvPAGE_BREAK (0x01 << (_DtCvSHIFT_TO_FLAGS + 11))
162 /* highlight macros */
163 #define HILITE_OVERLINE 0
164 #define HILITE_STRIKETHROUGH 1
165 #define HILITE_UNDERLINE 2
167 /******** Public Enum Declarations ********/
172 * string breaking types
187 _DtCvBORDER_TOP_LEFT,
188 _DtCvBORDER_TOP_RIGHT,
189 _DtCvBORDER_BOTTOM_LEFT,
190 _DtCvBORDER_BOTTOM_RIGHT,
192 * controller horizontal orientation
194 _DtCvJUSTIFY_LEFT_CORNER,
195 _DtCvJUSTIFY_LEFT, /* also container horizontal text placement */
196 _DtCvJUSTIFY_LEFT_MARGIN,
197 _DtCvJUSTIFY_CENTER, /* also container horiz/vert text placement */
198 _DtCvJUSTIFY_RIGHT_MARGIN,
199 _DtCvJUSTIFY_RIGHT, /* also container horizontal text placement */
200 _DtCvJUSTIFY_RIGHT_CORNER,
202 * extra container horizontal text placement
207 * inherit the parent's horizontal text placement
211 * controller vertical orientation, includes _DtCvJUSTIFY_CENTER
213 _DtCvJUSTIFY_TOP, /* also container vertical text placement */
214 _DtCvJUSTIFY_BOTTOM, /* also container vertical text placement */
216 * controller flow types
224 hilite_overline = 0x01 << HILITE_OVERLINE,
225 hilite_strikethrough = 0x01 << HILITE_STRIKETHROUGH,
226 hilite_underline = 0x01 << HILITE_UNDERLINE
229 /******** Public Enum Typedef Declarations ********/
230 typedef enum _dtCvFrmtOption _DtCvFrmtOption;
232 /******** Public Structures Declarations ********/
233 typedef struct _dtCvLine {
239 typedef struct _dtCvSegment * _DtCvSegmentPointer;
242 typedef struct _dtCvContainer {
245 _DtCvFrmtOption type;
246 _DtCvFrmtOption border;
247 _DtCvFrmtOption justify;
248 _DtCvFrmtOption vjustify;
249 _DtCvFrmtOption orient;
250 _DtCvFrmtOption vorient;
251 _DtCvFrmtOption flow;
261 _DtCvSegmentPointer seg_list;
263 struct _dtCvSegment *seg_list;
267 typedef struct _DtCvString {
272 typedef struct _dtCvRegion {
279 typedef struct _dtCvTable {
282 _DtCvFrmtOption *col_justify;
285 struct _dtCvSegment **cells;
288 typedef union _dtCvSegHandles {
289 _DtCvContainer container;
297 struct _dtCvSegment {
300 _DtCvSegHandles handle;
301 struct _dtCvSegment *next_seg;
302 struct _dtCvSegment *next_disp;
303 _DtCvPointer client_use;
304 _DtCvPointer internal_use;
308 struct _dtCvSegment *segment;
314 typedef struct _dtCvLinkDb * _DtCvLinkDbPointer;
317 typedef struct _dtCvTopicInfo {
319 struct _dtCvSegment *seg_list;
320 _DtCvPointInfo **mark_list;
322 _DtCvLinkDbPointer link_data;
324 struct _dtCvLinkDb *link_data;
328 typedef struct _dtCvStringClientData {
332 unsigned int hilite_type;
336 unsigned long bg_pixel;
337 unsigned long fg_pixel;
338 } _DtCvStringClientData;
340 typedef struct _dtCvRegionClientData {
341 _DtCvPointer GraphicHandle;
342 } _DtCvRegionClientData;
344 typedef union _dtCvClientData {
345 _DtCvRegionClientData region;
346 _DtCvStringClientData string;
349 /******** Public Structure Typedef Declarations ********/
351 /******** Public Prototyped Procedures ********/
353 /******** Public Macro Declarations ********/
357 #define _DtCvSetTypeToContainer(x) \
358 (((x) & ~(_DtCvPRIMARY_MASK)) | _DtCvCONTAINER)
359 #define _DtCvSetTypeToLine(x) \
360 (((x) & ~(_DtCvPRIMARY_MASK)) | _DtCvLINE)
361 #define _DtCvSetTypeToMarker(x) \
362 (((x) & ~(_DtCvPRIMARY_MASK)) | _DtCvMARKER)
363 #define _DtCvSetTypeToNoop(x) \
364 (((x) & ~(_DtCvPRIMARY_MASK)) | _DtCvNOOP)
365 #define _DtCvSetTypeToRegion(x) \
366 (((x) & ~(_DtCvPRIMARY_MASK)) | _DtCvREGION)
367 #define _DtCvSetTypeToString(x) \
368 (((x) & ~(_DtCvPRIMARY_MASK)) | _DtCvSTRING)
369 #define _DtCvSetTypeToTable(x) \
370 (((x) & ~(_DtCvPRIMARY_MASK)) | _DtCvTABLE)
374 #define _DtCvSetTypeToBlockLine(x) ((x) | _DtCvBLOCK_LINE)
375 #define _DtCvSetTypeToController(x) ((x) | _DtCvCONTROLLER)
376 #define _DtCvSetTypeToGhostLink(x) ((x) | _DtCvGHOST_LINK)
377 #define _DtCvSetTypeToHyperText(x) ((x) | _DtCvHYPER_TEXT)
378 #define _DtCvSetTypeToInLine(x) ((x) | _DtCvIN_LINE)
379 #define _DtCvSetTypeToNewLine(x) ((x) | _DtCvNEW_LINE)
380 #define _DtCvSetTypeToNonBreak(x) ((x) | _DtCvNON_BREAK)
381 #define _DtCvSetTypeToSearch(x) ((x) | _DtCvSEARCH_FLAG)
382 #define _DtCvSetTypeToSearchBegin(x) ((x) | _DtCvSEARCH_BEGIN)
383 #define _DtCvSetTypeToSearchEnd(x) ((x) | _DtCvSEARCH_END)
384 #define _DtCvSetTypeToSubScript(x) ((x) | _DtCvSUB_SCRIPT)
385 #define _DtCvSetTypeToSuperScript(x) ((x) | _DtCvSUPER_SCRIPT)
390 #define _DtCvSetTypeToWideChar(x) ((x) | _DtCvWIDE_CHAR)
393 * set application flags and/or field
395 #define _DtCvSetAppFlag1(x) ((x) | _DtCvAPP_FLAG1)
396 #define _DtCvSetAppFlag2(x) ((x) | _DtCvAPP_FLAG2)
397 #define _DtCvSetAppFlag3(x) ((x) | _DtCvAPP_FLAG3)
398 #define _DtCvSetAppFlag4(x) ((x) | _DtCvAPP_FLAG4)
399 #define _DtCvSetAppField(x,y) \
400 (((x) & ~(_DtCvAPP_FIELD_MASK)) | \
401 ((y & _DtCvAPP_FIELD_MASK) << _DtCvAPP_FIELD_OFFSET))
402 #define _DtCvSetAppFieldSmall(x,y) \
403 (((x) & ~(_DtCvAPP_FIELD_S_MASK)) | \
404 ((y & _DtCvAPP_FIELD_S_MASK) << _DtCvAPP_FIELD_OFFSET))
407 * get the application field value
409 #define _DtCvGetAppField(x) \
410 (((x) & _DtCvAPP_FIELD_MASK) >> _DtCvAPP_FIELD_OFFSET)
411 #define _DtCvGetAppFieldSmall(x) \
412 (((x) & _DtCvAPP_FIELD_S_MASK) >> _DtCvAPP_FIELD_OFFSET)
414 /******** Semi-Public Macro Declarations ********/
418 #define _DtCvPrimaryTypeOfSeg(x) ((x->type) & _DtCvPRIMARY_MASK)
419 #define _DtCvIsSegContainer(x) \
420 (((((x)->type) & _DtCvPRIMARY_MASK) == _DtCvCONTAINER) ? 1 : 0)
421 #define _DtCvIsSegLine(x) \
422 (((((x)->type) & _DtCvPRIMARY_MASK) == _DtCvLINE) ? 1 : 0)
423 #define _DtCvIsSegMarker(x) \
424 (((((x)->type) & _DtCvPRIMARY_MASK) == _DtCvMARKER) ? 1 : 0)
425 #define _DtCvIsSegNoop(x) \
426 (((((x)->type) & _DtCvPRIMARY_MASK) == _DtCvNOOP) ? 1 : 0)
427 #define _DtCvIsSegRegion(x) \
428 (((((x)->type) & _DtCvPRIMARY_MASK) == _DtCvREGION) ? 1 : 0)
429 #define _DtCvIsSegString(x) \
430 (((((x)->type) & _DtCvPRIMARY_MASK) == _DtCvSTRING) ? 1 : 0)
431 #define _DtCvIsSegTable(x) \
432 (((((x)->type) & _DtCvPRIMARY_MASK) == _DtCvTABLE) ? 1 : 0)
437 #define _DtCvIsSegController(x) \
438 ((((x)->type) & _DtCvCONTROLLER) ? 1 : 0)
439 #define _DtCvIsSegBlockLine(x) \
440 ((((x)->type) & _DtCvBLOCK_LINE) ? 1 : 0)
441 #define _DtCvIsSegGhostLink(x) \
442 ((((x)->type) & _DtCvGHOST_LINK) ? 1 : 0)
443 #define _DtCvIsSegHyperText(x) \
444 ((((x)->type) & _DtCvHYPER_TEXT) ? 1 : 0)
445 #define _DtCvIsSegInLine(x) \
446 ((((x)->type) & _DtCvIN_LINE) ? 1 : 0)
447 #define _DtCvIsSegNewLine(x) \
448 ((((x)->type) & _DtCvNEW_LINE) ? 1 : 0)
449 #define _DtCvIsSegNonBreakingChar(x) \
450 ((((x)->type) & _DtCvNON_BREAK) ? 1 : 0)
451 #define _DtCvIsSegPageBreak(x) \
452 ((((x)->type) & _DtCvPAGE_BREAK) ? 1 : 0)
453 #define _DtCvIsSegRegChar(x) \
454 ((((x)->type) & _DtCvWIDE_CHAR) ? 0 : 1)
455 #define _DtCvIsSegSubScript(x) \
456 ((((x)->type) & _DtCvSUB_SCRIPT) ? 1 : 0)
457 #define _DtCvIsSegSuperScript(x) \
458 ((((x)->type) & _DtCvSUPER_SCRIPT) ? 1 : 0)
459 #define _DtCvIsSegWideChar(x) \
460 ((((x)->type) & _DtCvWIDE_CHAR) ? 1 : 0)
464 #define _DtCvNextSeg(x) ((x)->next_seg)
465 #define _DtCvNextDisp(x) ((x)->next_disp)
470 #define _DtCvContainerOfSeg(x) \
471 ((x)->handle.container)
472 #define _DtCvContainerBMarginOfSeg(x) \
473 ((x)->handle.container.bmargin)
474 #define _DtCvContainerBorderOfSeg(x) \
475 ((x)->handle.container.border)
476 #define _DtCvContainerFlowOfSeg(x) \
477 ((x)->handle.container.flow)
478 #define _DtCvContainerFMarginOfSeg(x) \
479 ((x)->handle.container.fmargin)
480 #define _DtCvContainerIdOfSeg(x) \
481 ((x)->handle.container.id)
482 #define _DtCvContainerJustifyCharOfSeg(x) \
483 ((x)->handle.container.justify_char)
484 #define _DtCvContainerJustifyOfSeg(x) \
485 ((x)->handle.container.justify)
486 #define _DtCvContainerLeadingOfSeg(x) \
487 ((x)->handle.container.leading)
488 #define _DtCvContainerLineWidthOfSeg(x) \
489 ((x)->handle.container.bdr_info.width)
490 #define _DtCvContainerLineDataOfSeg(x) \
491 ((x)->handle.container.bdr_info.data)
492 #define _DtCvContainerListOfSeg(x) \
493 ((x)->handle.container.seg_list)
494 #define _DtCvContainerLMarginOfSeg(x) \
495 ((x)->handle.container.lmargin)
496 #define _DtCvContainerOrientOfSeg(x) \
497 ((x)->handle.container.orient)
498 #define _DtCvContainerPercentOfSeg(x) \
499 ((x)->handle.container.percent)
500 #define _DtCvContainerRMarginOfSeg(x) \
501 ((x)->handle.container.rmargin)
502 #define _DtCvContainerTMarginOfSeg(x) \
503 ((x)->handle.container.tmargin)
504 #define _DtCvContainerTypeOfSeg(x) \
505 ((x)->handle.container.type)
506 #define _DtCvContainerVJustifyOfSeg(x) \
507 ((x)->handle.container.vjustify)
508 #define _DtCvContainerVOrientOfSeg(x) \
509 ((x)->handle.container.vorient)
514 #define _DtCvIdOfMarkerSeg(x) ((x)->handle.marker)
519 #define _DtCvDataOfLineSeg(x) ((x)->handle.rule.data)
520 #define _DtCvWidthOfLineSeg(x) ((x)->handle.rule.width)
525 #define _DtCvStringOfStringSeg(x) ((x)->handle.string.string)
526 #define _DtCvFontOfStringSeg(x) ((x)->handle.string.font)
531 #define _DtCvInfoOfRegionSeg(x) ((x)->handle.region.info)
532 #define _DtCvWidthOfRegionSeg(x) ((x)->handle.region.width)
533 #define _DtCvHeightOfRegionSeg(x) ((x)->handle.region.height)
534 #define _DtCvAscentOfRegionSeg(x) ((x)->handle.region.ascent)
539 #define _DtCvNumColsOfTableSeg(x) ((x)->handle.table.num_cols)
540 #define _DtCvColWOfTableSeg(x) ((x)->handle.table.col_w)
541 #define _DtCvColJustifyOfTableSeg(x) ((x)->handle.table.col_justify)
542 #define _DtCvJustifyCharsOfTableSeg(x) ((x)->handle.table.justify_chars)
543 #define _DtCvCellIdsOfTableSeg(x) ((x)->handle.table.cell_ids)
544 #define _DtCvCellsOfTableSeg(x) ((x)->handle.table.cells)
546 /******** Semi-Public Function Declarations ********/
547 /******** Public Function Declarations ********/
550 } /* Close scope of 'extern "C"' declaration which encloses file. */
553 #endif /* _DtCanvasSegP_h */
554 /* DON'T ADD ANYTHING AFTER THIS #endif */