X11 Work Bench Toolkit  1.0
text_object.h
Go to the documentation of this file.
1 // //
3 // _ _ _ _ _ _ //
4 // | |_ ___ __ __| |_ ___ | |__ (_) ___ ___ | |_ | |__ //
5 // | __|/ _ \\ \/ /| __| / _ \ | '_ \ | | / _ \ / __|| __| | '_ \ //
6 // | |_| __/ > < | |_ | (_) || |_) || || __/| (__ | |_ _ | | | | //
7 // \__|\___|/_/\_\ \__|_____\___/ |_.__/_/ | \___| \___| \__|(_)|_| |_| //
8 // |_____| |__/ //
9 // //
10 // //
12 
13 /*****************************************************************************
14 
15  X11workbench - X11 programmer's 'work bench' application and toolkit
16  Copyright (c) 2010-2016 by Bob Frazier (aka 'Big Bad Bombastic Bob')
17  all rights reserved
18 
19  DISCLAIMER: The X11workbench application and toolkit software are supplied
20  'as-is', with no warranties, either implied or explicit.
21  Any claims to alleged functionality or features should be
22  considered 'preliminary', and might not function as advertised.
23 
24  BSD-like license:
25 
26  There is no restriction as to what you can do with this software, so long
27  as you include the above copyright notice and DISCLAIMER for any distributed
28  work that is equal to or derived from this one, along with this paragraph
29  that explains the terms of the license if the source is also being made
30  available. A "derived work" describes a work that uses a significant portion
31  of the source files or algorithms that are included with this one.
32  Specifically excluded from this are files that were generated by the software,
33  or anything that is included with the software that is part of another package
34  (such as files that were created or added during the 'configure' process).
35  Specifically included is the use of part or all of any of the X11 workbench
36  toolkit source or header files in your distributed application. If you do not
37  ship the source, the above copyright statement is still required to be placed
38  in a reasonably prominent place, such as documentation, splash screens, and/or
39  'about the application' dialog boxes.
40 
41  Use and distribution are in accordance with GPL, LGPL, and/or the above
42  BSD-like license. See COPYING and README files for more information.
43 
44 
45  Additional information at http://sourceforge.net/projects/X11workbench
46 
47 ******************************************************************************/
48 
49 
56 #ifndef _TEXT_OBJECT_H_INCLUDED_
57 #define _TEXT_OBJECT_H_INCLUDED_
58 
59 #include "window_helper.h"
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif // __cplusplus
64 
65 
66 // FILE TYPE CONSTANTS
67 
72 {
73  FileType_MAKEFILE = -1,
74  FileType_PLAIN_TEXT = 0,
75  FileType_CLANG = 1,
76  FileType_JAVA = 2, // sample
77  FileType_PERL = 3, // sample
78  FileType_PHP = 4, // sample
79  FileType_SHELL = 5, // sample
80 
81  FileType_MASK = 0x7fff,
82 
83  // and now the bit flags
84  FileType_HARDTAB = 0x10000,
85  FileType_RESERVED2 = 0x20000,
86  FileType_RESERVED3 = 0x40000,
87  FileType_RESERVED4 = 0x80000
88 };
89 
94 {
102 };
103 
108 {
113 };
114 
119 {
123 };
124 
129 {
133 };
134 
137 #define HARD_TAB_CHAR '\xa0'
141 #define DEFAULT_TAB_WIDTH 8
145 #define AUTO_HSCROLL_SIZE 8
149 #define MIN_LINE_SPACING 2
153 #define MIN_BORDER_SPACING 2
156 // define the interface for the object
157 
158 struct _text_object_; // forward declaration
159 
267 typedef struct _text_object_vtable_
268 {
273  void (* destroy)(struct _text_object_ *pThis);
274 
279  void (* init)(struct _text_object_ *pThis);
280 
287  void (* highlight_colors)(struct _text_object_ *pThis, XColor clrHFG, XColor clrHBG);
288 
296  char * (* get_text)(struct _text_object_ *pThis);
297 
309  void (* set_text)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen);
310 
321  int (* get_rows)(const struct _text_object_ *pThis);
322 
335  int (* get_cols)(struct _text_object_ *pThis);
336 
344  int (* get_filetype)(const struct _text_object_ *pThis);
345 
354  void (* set_filetype)(struct _text_object_ *pThis, int iLineFeed);
355 
362  int (* get_linefeed)(const struct _text_object_ *pThis);
363 
371  void (* set_linefeed)(struct _text_object_ *pThis, int iLineFeed);
372 
377  int (* get_insmode)(const struct _text_object_ *pThis);
378 
384  void (* set_insmode)(struct _text_object_ *pThis, int iInsMode);
385 
390  int (* get_selmode)(const struct _text_object_ *pThis);
391 
397  void (* set_selmode)(struct _text_object_ *pThis, int iSelMode);
398 
409  int (* get_tab)(const struct _text_object_ *pThis);
410 
422  void (* set_tab)(struct _text_object_ *pThis, int iTab);
423 
428  int (* get_scrollmode)(const struct _text_object_ *pThis);
429 
435  void (* set_scrollmode)(struct _text_object_ *pThis, int iScrollMode);
436 
442  void (* get_select)(const struct _text_object_ *pThis, WB_RECT *pRct);
443 
449  void (* set_select)(struct _text_object_ *pThis, const WB_RECT *pRct);
450 
455  int (* has_select)(const struct _text_object_ *pThis);
456 
469  char* (* get_sel_text)(const struct _text_object_ *pThis, const WB_RECT *pRct);
470 
475  int (* get_row)(const struct _text_object_ *pThis);
476 
482  void (* set_row)(struct _text_object_ *pThis, int iRow);
483 
488  int (* get_col)(const struct _text_object_ *pThis);
489 
499  void (* set_col)(struct _text_object_ *pThis, int iCol);
500 
505  void (* del_select)(struct _text_object_ *pThis);
506 
513  void (* replace_select)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen);
514 
520  void (* del_chars)(struct _text_object_ *pThis, int nChar); // delete 1 or more chars, negative deletes BEFORE cursor, 0 does nothing
521 
536  void (* ins_chars)(struct _text_object_ *pThis, const char *pChar, int nChar);
537 
546  void (* indent)(struct _text_object_ *pThis, int nCol);
547 
552  int (* can_undo)(struct _text_object_ *pThis);
553 
558  void (* undo)(struct _text_object_ *pThis);
559 
564  int (* can_redo)(struct _text_object_ *pThis);
565 
570  void (* redo)(struct _text_object_ *pThis);
571 
580  void (* get_view)(const struct _text_object_ *pThis, WB_RECT *pRct);
589  void (* set_view)(struct _text_object_ *pThis, const WB_RECT *pRct);
590 
602  void (* begin_highlight)(struct _text_object_ *pThis);
612  void (* end_highlight)(struct _text_object_ *pThis);
613 
614  // mouse conversion
615 
630  void (* mouse_click)(struct _text_object_ *pThis, int iMouseXDelta, int iMouseYDelta, int iType, int iACS);
631 
640  void (* begin_mouse_drag)(struct _text_object_ *pThis);
648  void (* end_mouse_drag)(struct _text_object_ *pThis);
649 
650  // cursor motion
651 
655  void (* cursor_up)(struct _text_object_ *pThis);
656 
660  void (* cursor_down)(struct _text_object_ *pThis);
661 
665  void (* cursor_left)(struct _text_object_ *pThis);
666 
670  void (* cursor_right)(struct _text_object_ *pThis);
671 
675  void (* page_up)(struct _text_object_ *pThis);
676 
680  void (* page_down)(struct _text_object_ *pThis);
681 
685  void (* page_left)(struct _text_object_ *pThis);
686 
690  void (* page_right)(struct _text_object_ *pThis);
691 
695  void (* cursor_home)(struct _text_object_ *pThis);
696 
700  void (* cursor_end)(struct _text_object_ *pThis);
701 
705  void (* cursor_top)(struct _text_object_ *pThis);
706 
710  void (* cursor_bottom)(struct _text_object_ *pThis);
711 
716  void (* scroll_vertical)(struct _text_object_ *pThis, int nRows);
717 
722  void (* scroll_horizontal)(struct _text_object_ *pThis, int nCols);
723 
724 
725  // handling expose events for the text area
726 
761  void (* do_expose)(struct _text_object_ *pThis, Display *pDisplay, Window wID,
762  GC gc, const WB_GEOM *pPaintGeom, const WB_GEOM *pViewGeom,
763  XFontSet rFontSet);
764 
773  void (* cursor_blink)(struct _text_object_ *pThis, int bHasFocus);
774 
776 
777 
778 
782 static __inline__ const TEXT_OBJECT_VTABLE *WBGetDefaultTextObjectVTable(void)
783 {
784 extern const TEXT_OBJECT_VTABLE WBDefaultTextObjectVTable;
785 
786  return &WBDefaultTextObjectVTable;
787 }
788 
789 
793 #define TEXT_OBJECT_TAG (*((const unsigned int *)"WBTX"))
794 
795 
860 typedef struct _text_object_
861 {
863 
864  unsigned int ulTag;
865  Window wIDOwner;
868 
869  XColor clrHFG;
870  XColor clrHBG;
871 
872  int iFileType;
873  enum _LineFeed_ iLineFeed;
874  int iInsMode;
875  int iSelMode;
877  int iTab;
878 
879  // cursor position
880  int iRow;
881  int iCol;
882  int iPos;
883 
884  int iCursorX;
885  int iCursorY;
887 
890 
891  int iAsc;
892  int iDesc;
894 
895  // viewport
896 
899 
900 
901  // the data
902 
903  void *pText;
904 
905  void *pUndo;
906  void *pRedo;
907 
908 } TEXT_OBJECT;
909 
917 static __inline__ int WBIsValidTextObject(const TEXT_OBJECT *pObj)
918 {
919  return pObj && pObj->ulTag == TEXT_OBJECT_TAG;
920 }
921 
934 static __inline__ void WBInitializeInPlaceTextObject(TEXT_OBJECT *pTextObject, Window wIDOwner)
935 {
936  if(pTextObject)
937  {
938  bzero(pTextObject, sizeof(*pTextObject)); // most contained things will accept 'nulling' as "unassigned"
939 
940  pTextObject->vtable = WBGetDefaultTextObjectVTable();
941  pTextObject->vtable->init(pTextObject);
942 
943  pTextObject->wIDOwner = wIDOwner;
944  }
945 }
946 
959 static __inline__ void WBDestroyInPlaceTextObject(TEXT_OBJECT *pTextObject)
960 {
961  if(pTextObject &&
962  WBIsValidTextObject(pTextObject) &&
963  pTextObject->vtable &&
964  pTextObject->vtable->destroy)
965  {
966  pTextObject->vtable->destroy(pTextObject);
967  }
968 }
969 
970 #define TEXT_BUFFER_LINE_CACHE_SIZE 32
971 
1004 typedef struct _text_buffer_
1005 {
1006  unsigned long nArraySize;
1007  unsigned long nEntries;
1008 
1009  // cached information
1010  unsigned int nMaxCol;
1011  unsigned int nMinMaxCol;
1012  unsigned long aLineCache[TEXT_BUFFER_LINE_CACHE_SIZE];
1014  unsigned int aLineCacheLen[TEXT_BUFFER_LINE_CACHE_SIZE];
1016 
1017  char * aLines[2];
1018 
1019 } TEXT_BUFFER;
1020 
1021 
1031 TEXT_BUFFER * WBAllocTextBuffer(const char *pBuf, unsigned int cbBufSize);
1032 
1042 int WBCheckReAllocTextBuffer(TEXT_BUFFER **ppBuf, int nLinesToAdd);
1043 
1052 void WBFreeTextBuffer(TEXT_BUFFER *pBuf);
1053 
1070 void WBTextBufferLineChange(TEXT_BUFFER *pBuf, unsigned long nLine, int nNewLen);
1071 
1088 
1089 
1090 
1091 
1106 TEXT_OBJECT *WBTextObjectConstructor(unsigned long cbStructSize, const char *szText, unsigned long cbLen, Window wIDOwner);
1107 
1108 
1120 
1121 
1136 int WBTextObjectCalculateLineHeight(int iAscent, int iDescent);
1137 
1138 
1139 
1140 // MBCS-related utilities
1141 
1171 char * WBInsertMBChars(char *pString, int iCol, const char *pszMBString, int cbString,
1172  int fTab, int fOverwrite, int *piNewCol, char **ppInserted);
1173 
1174 
1189 char * WBSplitMBLine(char *pString, int iCol);
1190 
1191 
1207 char * WBJoinMBLine(char *pString, int iCol, const char *pJoin);
1208 
1209 
1234 int WBDelMBChars(char *pString, int iCol, int nDel, int *piNewCol, char **ppDeleted);
1235 
1236 
1245 int WBGetMBLength(const char *pString);
1246 
1247 
1258 char * WBGetMBCharPtr(char *pString, int iCol, int *pcbLen);
1259 
1269 int WBGetMBColIndex(const char *pString, const char *pChar);
1270 
1271 
1272 #ifdef __cplusplus
1273 };
1274 #endif // __cplusplus
1275 
1276 #endif // _TEXT_OBJECT_H_INCLUDED_
1277 
1278 
mouse &#39;drag&#39; (select mode)
Definition: text_object.h:132
LFCR 0AH,0DH.
Definition: text_object.h:100
CHAR (i.e. stream)
Definition: text_object.h:110
char * WBSplitMBLine(char *pString, int iCol)
Split a multi-byte characters into a WBAlloc&#39;d string, at a specified column, terminating the origina...
Definition: text_object.c:5576
unsigned int ulTag
tag word, always assigned to TEXT_OBJECT_TAG
Definition: text_object.h:864
single line
Definition: text_object.h:95
int iRow
current row (cursor)
Definition: text_object.h:880
int iFontWidth
width of font in pixels (fixed pitch) - assigned by &#39;expose&#39; handler
Definition: text_object.h:893
int iFileType
file type - -1=Makefile, 0=plain text, others are &#39;file type&#39; constants, bit flags to preserve hard t...
Definition: text_object.h:872
int WBGetMBColIndex(const char *pString, const char *pChar)
Obtain the column index from a pointer within a multi-byte character string.
Definition: text_object.c:5856
char * WBGetMBCharPtr(char *pString, int iCol, int *pcbLen)
Obtain the pointer to a specific multi-byte character within a multi-byte character string...
Definition: text_object.c:5824
_InsertMode_
Insert/Overwrite mode for TEXT_OBJECT.
Definition: text_object.h:118
static __inline__ int WBIsValidTextObject(const TEXT_OBJECT *pObj)
&#39;TEXT_OBJECT&#39; validator
Definition: text_object.h:917
&#39;window helper&#39; main header file for the X11workbench Toolkit API
WB_RECT rctView
viewport, in characters (rctView.top is the top visible line, always)
Definition: text_object.h:897
_FileType_
file types for TEXT_OBJECT
Definition: text_object.h:71
&#39;vtable&#39; structure for TEXT_OBJECT
Definition: text_object.h:267
const TEXT_OBJECT_VTABLE * vtable
method function pointers (similar to C++ virtual member functions)
Definition: text_object.h:862
int(* can_undo)(struct _text_object_ *pThis)
Indicate whether an &#39;undo&#39; operation is possible (mostly for menu UI)
Definition: text_object.h:552
int iTab
tab width in characters (0 = system default)
Definition: text_object.h:877
static __inline__ void WBDestroyInPlaceTextObject(TEXT_OBJECT *pTextObject)
Destroy a previously initialized &#39;in-place&#39; TEXT_OBJECT structure.
Definition: text_object.h:959
void WBTextObjectDestructor(TEXT_OBJECT *pObj)
Generic detructor for a TEXT_OBJECT.
Definition: text_object.c:746
int(* get_rows)(const struct _text_object_ *pThis)
Call this function to obtain the total number of rows for display purposes.
Definition: text_object.h:321
void(* scroll_horizontal)(struct _text_object_ *pThis, int nCols)
Scroll the cursor to the right/left a specified number of columns.
Definition: text_object.h:722
void(* init)(struct _text_object_ *pThis)
Call this to initialize or re-initialize an object. Must call &#39;destroy&#39; first for an existing object...
Definition: text_object.h:279
BOX (selects a &#39;box&#39; using virtual spacing)
Definition: text_object.h:112
void(* end_highlight)(struct _text_object_ *pThis)
End a highlight block.
Definition: text_object.h:612
int(* get_insmode)(const struct _text_object_ *pThis)
Get the current insert mode for the object.
Definition: text_object.h:377
CRLF 0DH,0AH.
Definition: text_object.h:99
INSERT mode, character inserted at cursor.
Definition: text_object.h:121
XColor clrHBG
highlight BG color
Definition: text_object.h:870
void(* end_mouse_drag)(struct _text_object_ *pThis)
End a mouse &#39;drag&#39; operation.
Definition: text_object.h:648
WB_RECT rctHighLight
highlight rect {0,0,0,0} implies NONE
Definition: text_object.h:867
void * pText
pointer to (abstracted) object containing the text. void pointer allows abstraction. member functions must handle correctly
Definition: text_object.h:903
int iBlinkState
cursor blink state
Definition: text_object.h:888
void(* cursor_top)(struct _text_object_ *pThis)
Move the cursor to the top line.
Definition: text_object.h:705
int(* get_col)(const struct _text_object_ *pThis)
Get the current column cursor for the object.
Definition: text_object.h:488
unsigned long nEntries
number of entries currently in the array - call WBCheckReAllocTextBuffer() before increasing ...
Definition: text_object.h:1007
int iCol
current col (cursor)
Definition: text_object.h:881
void(* page_right)(struct _text_object_ *pThis)
Move the current cursor position right one page.
Definition: text_object.h:690
int(* get_cols)(struct _text_object_ *pThis)
Call this function to obtain the estimated column extent of the document.
Definition: text_object.h:335
void(* cursor_left)(struct _text_object_ *pThis)
Move the current cursor position left one column.
Definition: text_object.h:665
void * pUndo
pointer to &#39;undo&#39; buffer. NULL if empty.
Definition: text_object.h:905
int(* get_row)(const struct _text_object_ *pThis)
Get the current row cursor for the object.
Definition: text_object.h:475
struct _text_object_vtable_ TEXT_OBJECT_VTABLE
&#39;vtable&#39; structure for TEXT_OBJECT
void(* highlight_colors)(struct _text_object_ *pThis, XColor clrHFG, XColor clrHBG)
Call this to assign the highlight colors. Default colors are GC&#39;s BG and FG.
Definition: text_object.h:287
int iInsMode
insert mode - 0=overwrite, 1=insert
Definition: text_object.h:874
void WBTextBufferLineChange(TEXT_BUFFER *pBuf, unsigned long nLine, int nNewLen)
Text buffer &#39;cached information&#39; update function indicating a change to a line&#39;s length.
Definition: text_object.c:457
int iScrollMode
scroll mode - 0=normal, 1=&#39;scroll lock&#39;
Definition: text_object.h:876
void(* set_text)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen)
Call this function to re-assign all text in the control.
Definition: text_object.h:309
unsigned int nMinMaxCol
The &#39;smallest maximum&#39; recorded in &#39;aLineCache&#39;.
Definition: text_object.h:1011
system default, usually &#39;insert&#39;
Definition: text_object.h:120
char * WBInsertMBChars(char *pString, int iCol, const char *pszMBString, int cbString, int fTab, int fOverwrite, int *piNewCol, char **ppInserted)
Insert multi-byte characters into a WBAlloc&#39;d string, at a specified column.
Definition: text_object.c:5556
void(* cursor_home)(struct _text_object_ *pThis)
Move the cursor &#39;home&#39; (left or BOL)
Definition: text_object.h:695
_LineFeed_
line feed (line ending) types for TEXT_OBJECT
Definition: text_object.h:93
int(* get_tab)(const struct _text_object_ *pThis)
Get the current tab type for the object.
Definition: text_object.h:409
int WBTextObjectCalculateLineHeight(int iAscent, int iDescent)
Calculate the correct per-line height (in pixels) for a specified font ascent and descent...
Definition: text_object.c:756
void WBTextBufferRefreshCache(TEXT_BUFFER *pBuf)
Text buffer &#39;cached information&#39; refresh function.
Definition: text_object.c:598
int(* can_redo)(struct _text_object_ *pThis)
Indicate whether a &#39;redo&#39; operation is possible (mostly for menu UI)
Definition: text_object.h:564
void(* undo)(struct _text_object_ *pThis)
Perform a single &#39;undo&#39; operation.
Definition: text_object.h:558
static __inline__ void WBInitializeInPlaceTextObject(TEXT_OBJECT *pTextObject, Window wIDOwner)
initialize an &#39;in-place&#39; TEXT_OBJECT structure
Definition: text_object.h:934
WB_RECT rctWinView
viewport, in window coordinates, or &#39;empty&#39; if unknown
Definition: text_object.h:898
int iPos
position within buffer (reserved, MBCS may require it)
Definition: text_object.h:882
int iCursorX
X position of cursor as last drawn in expose event.
Definition: text_object.h:884
unsigned int nMaxCol
The maximum column number for any line, rounded up by &#39;DEFAULT_TAB_WIDTH&#39;.
Definition: text_object.h:1010
void(* set_selmode)(struct _text_object_ *pThis, int iSelMode)
Set the current selection mode for the object.
Definition: text_object.h:397
OVERWRITE mode, character inserted on top of character to the right of the cursor (if any)...
Definition: text_object.h:122
POSIX newline 0AH.
Definition: text_object.h:97
void * pRedo
pointer to &#39;redo&#39; buffer. NULL if empty.
Definition: text_object.h:906
struct _text_buffer_ TEXT_BUFFER
&#39;base class&#39; structure for TEXT_OBJECT
int iAsc
font height ascension
Definition: text_object.h:891
no drag in progress
Definition: text_object.h:130
int(* has_select)(const struct _text_object_ *pThis)
Returns a non-zero value if there is currently a &#39;selection&#39;.
Definition: text_object.h:455
void(* redo)(struct _text_object_ *pThis)
Perform a single &#39;redo&#39; operation.
Definition: text_object.h:570
int WBGetMBLength(const char *pString)
Obtain the length of a multi-byte character string in &#39;characters&#39; (not bytes)
Definition: text_object.c:5814
void(* scroll_vertical)(struct _text_object_ *pThis, int nRows)
Scroll the viewport up/down by the specified number of rows.
Definition: text_object.h:716
void(* set_view)(struct _text_object_ *pThis, const WB_RECT *pRct)
Set the current viewport (in characters). Only &#39;left&#39; and &#39;top&#39; are relevant if the expose method has...
Definition: text_object.h:589
struct _text_object_ TEXT_OBJECT
&#39;base class&#39; structure for TEXT_OBJECT
void(* do_expose)(struct _text_object_ *pThis, Display *pDisplay, Window wID, GC gc, const WB_GEOM *pPaintGeom, const WB_GEOM *pViewGeom, XFontSet rFontSet)
Member function to properly render the text in a window (Expose event)
Definition: text_object.h:761
default for OS
Definition: text_object.h:96
void(* set_scrollmode)(struct _text_object_ *pThis, int iScrollMode)
Set the current scroll mode for the object.
Definition: text_object.h:435
int iDragState
if &#39;1&#39; bit is set, cursor drag. if &#39;2&#39; bit is set, mouse drag
Definition: text_object.h:889
unsigned long nArraySize
allocated size of aLines array
Definition: text_object.h:1006
cursor &#39;drag&#39; (select mode)
Definition: text_object.h:131
int iCursorHeight
height of cursor as last drawn in expose event (always 1 if &#39;overwrite&#39; cursor)
Definition: text_object.h:886
OSX return 0DH.
Definition: text_object.h:98
void(* set_col)(struct _text_object_ *pThis, int iCol)
Set the current column cursor for the object.
Definition: text_object.h:499
_DragState_
State flags for mouse/cursor &#39;drag&#39; (i.e. selection)
Definition: text_object.h:128
_SelectMode_
select mode types for TEXT_OBJECT
Definition: text_object.h:107
void(* page_up)(struct _text_object_ *pThis)
Move the current cursor position up one page.
Definition: text_object.h:675
void(* ins_chars)(struct _text_object_ *pThis, const char *pChar, int nChar)
Insert &#39;n&#39; characters (including new lines) from the current cursor.
Definition: text_object.h:536
XColor clrHFG
highlight FG color
Definition: text_object.h:869
void(* set_insmode)(struct _text_object_ *pThis, int iInsMode)
Set the current insert mode for the object.
Definition: text_object.h:384
int(* get_linefeed)(const struct _text_object_ *pThis)
Get the current linefeed type for the object.
Definition: text_object.h:362
void(* cursor_right)(struct _text_object_ *pThis)
Move the current cursor position right one column.
Definition: text_object.h:670
void(* cursor_bottom)(struct _text_object_ *pThis)
Move the cursor to the last line.
Definition: text_object.h:710
void(* get_select)(const struct _text_object_ *pThis, WB_RECT *pRct)
Get the current selection rectangle as WB_RECT.
Definition: text_object.h:442
void(* get_view)(const struct _text_object_ *pThis, WB_RECT *pRct)
Get the current viewport (in characters). The return value is not relevant if the expose method has n...
Definition: text_object.h:580
internal wrapper struct for &#39;rectangle&#39; definition
void(* set_row)(struct _text_object_ *pThis, int iRow)
Set the current row cursor for the object.
Definition: text_object.h:482
int iDesc
font height descension
Definition: text_object.h:892
&#39;base class&#39; structure for TEXT_OBJECT
Definition: text_object.h:860
static __inline__ const TEXT_OBJECT_VTABLE * WBGetDefaultTextObjectVTable(void)
returns the default vtable for a TEXT_OBJECT structure
Definition: text_object.h:782
void(* begin_highlight)(struct _text_object_ *pThis)
Begin a highlight block.
Definition: text_object.h:602
void(* cursor_up)(struct _text_object_ *pThis)
Move the current cursor position up one line.
Definition: text_object.h:655
int WBDelMBChars(char *pString, int iCol, int nDel, int *piNewCol, char **ppDeleted)
Delete a specified number of multi-byte characters from a string &#39;in place&#39;, starting at a specified ...
Definition: text_object.c:5650
WB_RECT rctSel
select boundary in characters, {0,0,0,0} implies NONE, {-1,x,x,x} implies ALL. if top == bottom...
Definition: text_object.h:866
void(* set_filetype)(struct _text_object_ *pThis, int iLineFeed)
Set the current file type for the object.
Definition: text_object.h:354
void(* replace_select)(struct _text_object_ *pThis, const char *szText, unsigned long cbLen)
Replace the current selection assigned via &#39;set_select&#39; with new text.
Definition: text_object.h:513
LINE (always selects entire line when spanning multiple lines)
Definition: text_object.h:111
int(* get_selmode)(const struct _text_object_ *pThis)
Get the current selection mode for the object.
Definition: text_object.h:390
void(* mouse_click)(struct _text_object_ *pThis, int iMouseXDelta, int iMouseYDelta, int iType, int iACS)
Translate mouse cursor position into actual row/column. This function is irrelevant if the expose met...
Definition: text_object.h:630
void(* page_left)(struct _text_object_ *pThis)
Move the current cursor position left one page.
Definition: text_object.h:685
#define TEXT_OBJECT_TAG
The &#39;tag&#39; for a TEXT_OBJECT structure.
Definition: text_object.h:793
int(* get_scrollmode)(const struct _text_object_ *pThis)
Get the current scroll mode for the object.
Definition: text_object.h:428
DEFAULT (typically CHAR)
Definition: text_object.h:109
&#39;base class&#39; structure for TEXT_OBJECT
Definition: text_object.h:1004
void(* del_chars)(struct _text_object_ *pThis, int nChar)
Delete &#39;n&#39; characters from the current cursor. Negative deletes BEFORE the cursor. &#39;newline&#39; counts as 1 character.
Definition: text_object.h:520
void(* begin_mouse_drag)(struct _text_object_ *pThis)
Begin a mouse &#39;drag&#39; operation.
Definition: text_object.h:640
void(* indent)(struct _text_object_ *pThis, int nCol)
Indent selected text by &#39;n&#39; columns.
Definition: text_object.h:546
TEXT_BUFFER * WBAllocTextBuffer(const char *pBuf, unsigned int cbBufSize)
Generic constructor for a TEXT_BUFFER using defaults.
Definition: text_object.c:284
void(* cursor_blink)(struct _text_object_ *pThis, int bHasFocus)
Periodic callback to &#39;blink&#39; the cursor.
Definition: text_object.h:773
enum _LineFeed_ iLineFeed
linefeed type (see enum). LineFeed_NONE implies SINGLE LINE
Definition: text_object.h:873
void(* set_linefeed)(struct _text_object_ *pThis, int iLineFeed)
Set the current linefeed type for the object.
Definition: text_object.h:371
int iCursorY
Y position of cursor as last drawn in expose event (top of cursor)
Definition: text_object.h:885
void(* cursor_down)(struct _text_object_ *pThis)
Move the current cursor position down one line.
Definition: text_object.h:660
int WBCheckReAllocTextBuffer(TEXT_BUFFER **ppBuf, int nLinesToAdd)
Re-allocator for TEXT_BUFFER object.
Definition: text_object.c:399
void(* cursor_end)(struct _text_object_ *pThis)
Move the cursor to &#39;end&#39; (full doc width or EOL)
Definition: text_object.h:700
void(* set_tab)(struct _text_object_ *pThis, int iTab)
Set the current tab type for the object.
Definition: text_object.h:422
void(* set_select)(struct _text_object_ *pThis, const WB_RECT *pRct)
Set the current selection rectangle as WB_RECT.
Definition: text_object.h:449
TEXT_OBJECT * WBTextObjectConstructor(unsigned long cbStructSize, const char *szText, unsigned long cbLen, Window wIDOwner)
Generic constructor for a TEXT_OBJECT using defaults.
Definition: text_object.c:724
int iSelMode
selection mode - 0=normal, 1=line, 2=box
Definition: text_object.h:875
int(* get_filetype)(const struct _text_object_ *pThis)
Get the current linefeed type for the object.
Definition: text_object.h:344
internal wrapper struct for X11 &#39;geometry&#39; definition
void(* page_down)(struct _text_object_ *pThis)
Move the current cursor position down one page.
Definition: text_object.h:680
void WBFreeTextBuffer(TEXT_BUFFER *pBuf)
Re-allocator for TEXT_BUFFER object, returns ZERO on success. Pointer may be modified (or not)...
Definition: text_object.c:434
void(* del_select)(struct _text_object_ *pThis)
Delete the current selection assigned via &#39;set_select&#39;.
Definition: text_object.h:505
void(* destroy)(struct _text_object_ *pThis)
Call this prior to de-allocating memory to free up any internal objects or storage.
Definition: text_object.h:273
size of array containing values, excluding negative indices
Definition: text_object.h:101
Window wIDOwner
owner window (cached from paint/expose handling and/or cursor blink)
Definition: text_object.h:865
char * WBJoinMBLine(char *pString, int iCol, const char *pJoin)
Split a multi-byte characters into a WBAlloc&#39;d string, at a specified column, terminating the origina...
Definition: text_object.c:5613