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 libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 ** $XConsortium: TermPrimBuffer.h /main/1 1996/04/21 19:16:53 drk $
28 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
29 * (c) Copyright 1993, 1994 International Business Machines Corp. *
30 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
31 * (c) Copyright 1993, 1994 Novell, Inc. *
34 #ifndef _Dt_TermPrimBuffer_h
35 #define _Dt_TermPrimBuffer_h
37 typedef struct _TermLineSelectionRec *TermLineSelection;
38 typedef struct _TermBufferRec *TermBuffer;
39 typedef struct _TermEnhInfoRec *TermEnhInfo;
40 typedef struct _TermCharInfoRec *TermCharInfo;
43 #include "TermPrimOSDepI.h"
44 #include "TermPrimRender.h"
45 #include "TermPrimSelect.h"
47 #define TermENH_SECURE (1 << 0)
48 #define TermENH_UNDERLINE (1 << 1)
49 #define TermENH_OVERSTRIKE (1 << 2)
51 #define TermIS_SECURE(flags) ((flags) & TermENH_SECURE)
52 #define TermIS_UNDERLINE(flags) ((flags) & TermENH_UNDERLINE)
53 #define TermIS_OVERSTRIKE(flags) ((flags) & TermENH_OVERSTRIKE)
55 typedef unsigned char enhValue;
56 typedef enhValue *enhValues;
58 typedef enum _countSpec
65 #endif /* __cplusplus */
67 typedef unsigned char termChar;
69 typedef struct _TermEnhInfoRec {
76 typedef struct _TermCharInfoRec {
83 short idx; /* index into line buffer */
84 short len; /* bytes per character */
111 TermBuffer, short *, short *
117 Widget, enhValues, TermEnhInfo
193 #ifdef USE_SUN_WCWIDTH_PATCH
195 ** A small workaround for systems that don't have wcwidth...
202 #endif /* USE_SUN_WCWIDTH_PATCH */
204 #ifdef USE_USL_WCWIDTH_PATCH
206 ** A small workaround for systems that don't have wcwidth...
213 #endif /* USE_USL_WCWIDTH_PATCH */
217 ** Truncate the specified line to the desired width, return
220 ** tb - term buffer to act on
221 ** row - row to truncate
224 ** True/False to indicate success or failure
227 _DtTermPrimBufferClearLine
235 ** Create a new term buffer of the desired dimensions.
238 ** rows - desired number of rows
239 ** cols - desired number of columns
240 ** sizeOfBuffer - bytes per
241 ** sizeOfLine - bytes per line record
242 ** sizeOfEnh - bytes per enhancement chunk
245 ** pointer to new TermBuffer, else NULL
248 _DtTermPrimBufferCreateBuffer
253 const short sizeOfBuffer,
254 const short sizeOfLine,
255 const short sizeOfEnh
259 ** replace all characters between startCol, and endCol with spaces,
262 _DtTermPrimBufferErase
271 ** replace all wide characters between startCol, and endCol with spaces,
274 _DtTermPrimBufferEraseWc
284 ** Free all storage allocated to the specified buffer.
287 ** tb - TermBuffer to free
290 _DtTermPrimBufferFreeBuffer
296 ** Change the dimensions of the specified buffer to the new size.
299 ** *tb - pointer to term buffer to resize
300 ** *newRows - number of rows desired
301 ** *newCols - number of cols desired
304 ** potentially adjusted values for newRows and newCols
307 _DtTermPrimBufferResizeBuffer
315 ** Create an enhancement chunk at the specified position.
319 ** row,col - coordinates of new enhancement chunk
322 ** True/False depending on success/failure
325 _DtTermPrimBufferCreateEnhancement
333 ** Free the enhancement chunk at the specified position.
337 ** row,col - coordinates of new enhancement chunk
340 ** True/False depending on success/failure
343 _DtTermPrimBufferFreeEnhancement
351 ** Get text from the buffer.
355 ** row,col - coordinates to get text from
356 ** length - length of buffer
357 ** needWideChar - true if need wide characters (not multi-byte chars)
360 ** buffer - pointer to buffer containing text
363 ** the actual number of characters in the buffer
366 _DtTermPrimBufferGetText
373 const Boolean needWideChar
377 ** Return a pointer to the character at the specified position.
381 ** row,col - coordinates of desired character
384 ** pointer to desired character
387 _DtTermPrimBufferGetCharacterPointer
395 ** Insert 'numChar' characters into the buffer at the specified position.
400 _DtTermPrimBufferInsert
405 const termChar *newChars,
407 Boolean insertFlag, /* if TRUE, insert, else overwrite */
408 termChar **returnChars, /* pointer to overflow buffer */
409 short *returnCount /* count of characters in overflow buffer */
413 ** Delete enough characters from the buffer to exceed width.
415 ** If returnChars != NULL then the deleted characters are returned
416 ** in a buffer pointed to by returnChars. It is the responsibility
417 ** of the calling function to XtFree the buffer containing returned
418 ** characters when they are no longer needed.
421 _DtTermPrimBufferDelete
427 termChar **returnChars, /* pointer to delete buffer */
428 short *returnCount /* count of bytes in delete buffer */
432 _DtTermPrimBufferDeleteWc
438 termChar **returnChars, /* pointer to delete buffer */
439 short *returnCount /* count of bytes in delete buffer */
443 _DtTermPrimBufferSetLineWidth
451 _DtTermPrimBufferGetLineLength
458 _DtTermPrimBufferGetLineWidth
465 _DtTermPrimBufferSetEnhancement
470 const unsigned char id,
475 _DtTermPrimBufferGetEnhancement
482 const countSpec countWhich
486 ** Return the number of rows allocated to the term buffer.
489 _DtTermPrimBufferGetRows
495 ** Return the number of columns allocated to the term buffer.
498 _DtTermPrimBufferGetCols
504 ** Set the value of the term buffer's nextBuffer and prevBuffer pointers.
507 _DtTermPrimBufferSetLinks
510 const TermBuffer prev,
511 const TermBuffer next
515 ** Set the value of the term buffer's selectInfo pointer.
518 _DtTermPrimBufferSetSelectInfo
521 const TermSelectInfo si
525 _DtTermPrimBufferMoveLockArea
539 _DtTermPrimBufferInsertLine
548 _DtTermPrimBufferInsertLineFromTB
553 const InsertSource insertSource
557 _DtTermPrimBufferDeleteLine
562 const short lastUsedRow
566 _DtTermPrimBufferPadLine
574 _DtTermPrimBufferPadLineWc
582 _DtTermPrimGetCharacterInfo
587 TermCharInfo charInfo
591 _DtTermPrimBufferGetNextTab
598 _DtTermPrimBufferGetPreviousTab
605 _DtTermPrimBufferSetTab
612 _DtTermPrimBufferClearTab
619 _DtTermPrimBufferClearAllTabs
625 ** Return the value of the line wrap flag for the current line
628 _DtTermPrimBufferTestLineWrapFlag
635 ** set the line wrap flag to the desired state
638 _DtTermPrimBufferSetLineWrapFlag
646 ** Return the value of the in selection flag for the current line
648 extern TermLineSelection
649 _DtTermPrimBufferGetInSelectionFlag
656 ** set the in selection flag to the desired state
659 _DtTermPrimBufferSetInSelectionFlag
663 TermLineSelection state
667 _DtTermPrimBufferSetSelectLines
677 } /* close scope of 'extern "C"'... */
678 #endif /* __cplusplus */
680 #endif /* _Dt_TermPrimBuffer_h */
681 /* DON'T ADD ANYTHING AFTER THIS #endif... */