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 */
206 ** Truncate the specified line to the desired width, return
209 ** tb - term buffer to act on
210 ** row - row to truncate
213 ** True/False to indicate success or failure
216 _DtTermPrimBufferClearLine
224 ** Create a new term buffer of the desired dimensions.
227 ** rows - desired number of rows
228 ** cols - desired number of columns
229 ** sizeOfBuffer - bytes per
230 ** sizeOfLine - bytes per line record
231 ** sizeOfEnh - bytes per enhancement chunk
234 ** pointer to new TermBuffer, else NULL
237 _DtTermPrimBufferCreateBuffer
242 const short sizeOfBuffer,
243 const short sizeOfLine,
244 const short sizeOfEnh
248 ** replace all characters between startCol, and endCol with spaces,
251 _DtTermPrimBufferErase
260 ** replace all wide characters between startCol, and endCol with spaces,
263 _DtTermPrimBufferEraseWc
273 ** Free all storage allocated to the specified buffer.
276 ** tb - TermBuffer to free
279 _DtTermPrimBufferFreeBuffer
285 ** Change the dimensions of the specified buffer to the new size.
288 ** *tb - pointer to term buffer to resize
289 ** *newRows - number of rows desired
290 ** *newCols - number of cols desired
293 ** potentially adjusted values for newRows and newCols
296 _DtTermPrimBufferResizeBuffer
304 ** Create an enhancement chunk at the specified position.
308 ** row,col - coordinates of new enhancement chunk
311 ** True/False depending on success/failure
314 _DtTermPrimBufferCreateEnhancement
322 ** Free the enhancement chunk at the specified position.
326 ** row,col - coordinates of new enhancement chunk
329 ** True/False depending on success/failure
332 _DtTermPrimBufferFreeEnhancement
340 ** Get text from the buffer.
344 ** row,col - coordinates to get text from
345 ** length - length of buffer
346 ** needWideChar - true if need wide characters (not multi-byte chars)
349 ** buffer - pointer to buffer containing text
352 ** the actual number of characters in the buffer
355 _DtTermPrimBufferGetText
362 const Boolean needWideChar
366 ** Return a pointer to the character at the specified position.
370 ** row,col - coordinates of desired character
373 ** pointer to desired character
376 _DtTermPrimBufferGetCharacterPointer
384 ** Insert 'numChar' characters into the buffer at the specified position.
389 _DtTermPrimBufferInsert
394 const termChar *newChars,
396 Boolean insertFlag, /* if TRUE, insert, else overwrite */
397 termChar **returnChars, /* pointer to overflow buffer */
398 short *returnCount /* count of characters in overflow buffer */
402 ** Delete enough characters from the buffer to exceed width.
404 ** If returnChars != NULL then the deleted characters are returned
405 ** in a buffer pointed to by returnChars. It is the responsibility
406 ** of the calling function to XtFree the buffer containing returned
407 ** characters when they are no longer needed.
410 _DtTermPrimBufferDelete
416 termChar **returnChars, /* pointer to delete buffer */
417 short *returnCount /* count of bytes in delete buffer */
421 _DtTermPrimBufferDeleteWc
427 termChar **returnChars, /* pointer to delete buffer */
428 short *returnCount /* count of bytes in delete buffer */
432 _DtTermPrimBufferSetLineWidth
440 _DtTermPrimBufferGetLineLength
447 _DtTermPrimBufferGetLineWidth
454 _DtTermPrimBufferSetEnhancement
459 const unsigned char id,
464 _DtTermPrimBufferGetEnhancement
471 const countSpec countWhich
475 ** Return the number of rows allocated to the term buffer.
478 _DtTermPrimBufferGetRows
484 ** Return the number of columns allocated to the term buffer.
487 _DtTermPrimBufferGetCols
493 ** Set the value of the term buffer's nextBuffer and prevBuffer pointers.
496 _DtTermPrimBufferSetLinks
499 const TermBuffer prev,
500 const TermBuffer next
504 ** Set the value of the term buffer's selectInfo pointer.
507 _DtTermPrimBufferSetSelectInfo
510 const TermSelectInfo si
514 _DtTermPrimBufferMoveLockArea
528 _DtTermPrimBufferInsertLine
537 _DtTermPrimBufferInsertLineFromTB
542 const InsertSource insertSource
546 _DtTermPrimBufferDeleteLine
551 const short lastUsedRow
555 _DtTermPrimBufferPadLine
563 _DtTermPrimBufferPadLineWc
571 _DtTermPrimGetCharacterInfo
576 TermCharInfo charInfo
580 _DtTermPrimBufferGetNextTab
587 _DtTermPrimBufferGetPreviousTab
594 _DtTermPrimBufferSetTab
601 _DtTermPrimBufferClearTab
608 _DtTermPrimBufferClearAllTabs
614 ** Return the value of the line wrap flag for the current line
617 _DtTermPrimBufferTestLineWrapFlag
624 ** set the line wrap flag to the desired state
627 _DtTermPrimBufferSetLineWrapFlag
635 ** Return the value of the in selection flag for the current line
637 extern TermLineSelection
638 _DtTermPrimBufferGetInSelectionFlag
645 ** set the in selection flag to the desired state
648 _DtTermPrimBufferSetInSelectionFlag
652 TermLineSelection state
656 _DtTermPrimBufferSetSelectLines
666 } /* close scope of 'extern "C"'... */
667 #endif /* __cplusplus */
669 #endif /* _Dt_TermPrimBuffer_h */
670 /* DON'T ADD ANYTHING AFTER THIS #endif... */