1 /******************************************************************************** 2 * * 3 * M u l t i - L i n e T e x t W i d g e t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 1998,2020 by Jeroen van der Zijp. All Rights Reserved. * 7 ********************************************************************************* 8 * This library is free software; you can redistribute it and/or modify * 9 * it under the terms of the GNU Lesser General Public License as published by * 10 * the Free Software Foundation; either version 3 of the License, or * 11 * (at your option) any later version. * 12 * * 13 * This library is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 * GNU Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public License * 19 * along with this program. If not, see <http://www.gnu.org/licenses/> * 20 ********************************************************************************/ 21 #ifndef FXTEXT_H 22 #define FXTEXT_H 23 24 #ifndef FXSCROLLAREA_H 25 #include "FXScrollArea.h" 26 #endif 27 28 namespace FX { 29 30 31 /// Text widget options 32 enum { 33 TEXT_READONLY = 0x00100000, /// Text is NOT editable 34 TEXT_WORDWRAP = 0x00200000, /// Wrap at word breaks 35 TEXT_OVERSTRIKE = 0x00400000, /// Overstrike mode 36 TEXT_FIXEDWRAP = 0x00800000, /// Fixed wrap columns 37 TEXT_NO_TABS = 0x01000000, /// Insert spaces for tabs 38 TEXT_AUTOINDENT = 0x02000000, /// Autoindent 39 TEXT_SHOWACTIVE = 0x04000000, /// Show active line 40 TEXT_SHOWMATCH = 0x08000000, /// Show matching brace 41 }; 42 43 44 /// Highlight style entry 45 struct FXHiliteStyle { 46 FXColor normalForeColor; /// Normal text foreground color 47 FXColor normalBackColor; /// Normal text background color 48 FXColor selectForeColor; /// Selected text foreground color 49 FXColor selectBackColor; /// Selected text background color 50 FXColor hiliteForeColor; /// Highlight text foreground color 51 FXColor hiliteBackColor; /// Highlight text background color 52 FXColor activeBackColor; /// Active text background color 53 FXuint style; /// Highlight text style 54 }; 55 56 57 /** 58 * Text mutation callback data passed with the SEL_INSERTED, 59 * SEL_REPLACED, and SEL_DELETED messages; both old and new 60 * text is available on behalf of the undo system as well as 61 * syntax highlighting. 62 */ 63 struct FXTextChange { 64 FXint pos; /// Position in buffer 65 FXint ndel; /// Number characters deleted at position 66 FXint nins; /// Number characters inserted at position 67 FXchar *ins; /// Text inserted at position 68 FXchar *del; /// Text deleted at position 69 }; 70 71 72 /** 73 * Text selection data. 74 * A range-selection is in effect when startpos<endpos, while a block-select 75 * is in effect when startcol<endcol additionally. 76 */ 77 struct FXTextSelection { 78 FXint startpos; /// Start of selection (begin of first line if block-select) 79 FXint endpos; /// End of selection (start of line past last if block-select) 80 FXint startcol; /// Start column, if block-select (actually, indent) 81 FXint endcol; /// End column, if block select 82 }; 83 84 85 /** 86 * The text widget provides a multi-line text editing control. 87 * The widget supports both clipboard for cut-and-paste operations, 88 * as well as drag and drop of text. 89 * Text may be edited interactively by the user, or changed through 90 * the programmatic interface. 91 * 92 * During interactive editing, the text widget notifies its target 93 * of changes to the current cursor location by issueing SEL_CHANGED 94 * callbacks. If text is inserted, deleted, or replaced, the widget 95 * will send SEL_INSERTED, SEL_DELETED, or SEL_REPLACED messages, and 96 * pass along an FXTextChange to indicate what changes were made to the 97 * text buffer, in sufficient detail for recording undo and redo info. 98 * 99 * When selections are made, SEL_SELECTED or SEL_DESELECTED messages 100 * are issued, passing along the range of affected text affected as 101 * an array of four numbers: position, number of bytes, column, number 102 * of columns. 103 * 104 * As the cursor is being moved, matching parentheses, brackets, and 105 * braces may be highlighted for a short time if the brace-matching 106 * feature has been enabled. 107 * 108 * An auto-indent feature, enabled by TEXT_AUTOINDENT flag, will automatically 109 * enter a number of spaces if a newline is entered, starting new text entry at 110 * the same level of indent as the previous line. 111 * 112 * When styled mode is turned on, the text widget will maintain a parallel 113 * style-buffer along side the text-buffer. This style buffer is used to 114 * index into a style table (FXHiliteStyle), which describes what colors 115 * and visual attributes are to be used to draw the each character in the 116 * text buffer. 117 * 118 * When text is added to the widget programmatically, a style index may 119 * be passed in to apply to the newly added text. It is also possible to 120 * change the style of the text without changing the text itself. This 121 * could be used to form the basis of a colorizing text editor, for example. 122 * 123 * The first entry in the style table corresponds to a style index of 1. 124 * Style index 0 is used for the default text style, the style that would 125 * be shown if the styled mode is not in effect. 126 * 127 * In a typical scenario, the contents of the style buffer is either directly 128 * written when the text is added to the widget, or is continually modified 129 * by editing the text via syntax-based highlighting engine which 130 * colors the text based on syntactical patterns. 131 * 132 * The text widget has several controlling flags which affect its behaviour 133 * and display. TEXT_READONLY sets the widget in read-only mode. In this 134 * mode, the contents of the widget may only be changed programmatically, 135 * although it is possible for the user to select and paste out of the text 136 * buffer. 137 * The TEXT_WORDWRAP flag turns on line-wrapping. Normally, long lines extend 138 * past the right-hand side of the visible buffer. In wrap mode, text is folded 139 * at natural break points (breakable spaces, tabs, etc). The default wrap mode 140 * is a fluid wrap, that is, the text is reflowed as the widget is resized. 141 * The flag TEXT_FIXEDWRAP disables the fluid wrap mode and makes the widget 142 * wrap at a fixed column, regardless of the width of the widget. 143 * The TEXT_OVERSTRIKE mode causes text entered by the user to overstrike 144 * already existing text, instead of inserting new next. This mode can be 145 * toggled interactively by hitting the INS key on the keyboard. 146 * The flag TEXT_NO_TABS causes a TAB key to be replaced by the appropriate 147 * number of spaces when entered interactively; however, the user can still 148 * enter a TAB by entering Ctrl+TAB. 149 * The TEXT_SHOWACTIVE mode will cause the line containing the current 150 * cursor location to be highlighted. This makes it easier to find the insertion 151 * point when scrolling back and forth a large document. 152 * The flag TEXT_SHOWMATCH will briefly flash the matching brace, parenthesis, or 153 * bracket when the cursor is positioned at brace, parenthesis, or bracket. 154 */ 155 class FXAPI FXText : public FXScrollArea { 156 FXDECLARE(FXText) 157 protected: 158 FXchar *buffer; // Text buffer being edited 159 FXchar *sbuffer; // Text style buffer 160 FXint *visrows; // Starts of rows in buffer 161 FXint length; // Length of the actual text in the buffer 162 FXint nvisrows; // Number of visible rows 163 FXint nrows; // Total number of rows 164 FXint gapstart; // Start of the insertion point (the gap) 165 FXint gapend; // End of the insertion point+1 166 FXint toppos; // Start position of first visible row 167 FXint toprow; // Row number of first visible row 168 FXint keeppos; // Position to keep on top visible row 169 FXTextSelection select; // Text selection 170 FXTextSelection hilite; // Text highlight 171 FXint anchorpos; // Anchor position 172 FXint anchorrow; // Anchor row 173 FXint anchorcol; // Anchor column (kept inside text) 174 FXint anchorvcol; // Unconstrained anchor column 175 FXint cursorpos; // Cursor position 176 FXint cursorrow; // Cursor row 177 FXint cursorcol; // Cursor column (kept inside text) 178 FXint cursorvcol; // Unconstrained cursor column 179 FXint prefcol; // Preferred cursor column 180 FXint margintop; // Margins top 181 FXint marginbottom; // Margin bottom 182 FXint marginleft; // Margin left 183 FXint marginright; // Margin right 184 FXint wrapwidth; // Wrap width in pixels 185 FXint wrapcolumns; // Wrap columns 186 FXint tabwidth; // Tab width in pixels 187 FXint tabcolumns; // Tab columns 188 FXint barwidth; // Line number width 189 FXint barcolumns; // Line number columns 190 FXFont *font; // Text font 191 FXColor textColor; // Normal text color 192 FXColor selbackColor; // Select background color 193 FXColor seltextColor; // Select text color 194 FXColor hilitebackColor; // Highlight background color 195 FXColor hilitetextColor; // Highlight text color 196 FXColor activebackColor; // Background color for active line 197 FXColor numberColor; // Line number color 198 FXColor cursorColor; // Cursor color 199 FXColor barColor; // Bar background color 200 FXint textWidth; // Total width of all text 201 FXint textHeight; // Total height of all text 202 const FXchar *delimiters; // Delimiters 203 FXString clipped; // Clipped text 204 FXint vrows; // Default visible rows 205 FXint vcols; // Default visible columns 206 FXString help; // Status line help 207 FXString tip; // Tooltip 208 FXHiliteStyle *hilitestyles; // Style definitions 209 FXuint blink; // Next cursor blink state 210 FXTime matchtime; // Match time (ns) 211 FXint grabx; // Grab point x 212 FXint graby; // Grab point y 213 FXuchar mode; // Mode widget is in 214 FXbool modified; // User has modified text 215 protected: 216 FXText(); 217 void movegap(FXint pos); 218 void sizegap(FXint sz); 219 FXint charWidth(FXwchar ch,FXint indent) const; 220 FXint xoffset(FXint start,FXint pos) const; 221 FXint wrap(FXint start) const; 222 FXint rowFromPos(FXint pos) const; 223 FXint posFromRow(FXint row) const; 224 FXint columnFromPos(FXint start,FXint pos) const; 225 FXint posFromColumn(FXint start,FXint col) const; 226 FXbool isdelimiter(FXwchar w) const; 227 FXint measureText(FXint start,FXint end,FXint& wmax,FXint& hmax) const; 228 void calcVisRows(FXint s,FXint e); 229 void recompute(); 230 FXint matchForward(FXint pos,FXint end,FXwchar l,FXwchar r,FXint level) const; 231 FXint matchBackward(FXint pos,FXint beg,FXwchar l,FXwchar r,FXint level) const; 232 FXint findMatching(FXint pos,FXint beg,FXint end,FXwchar ch,FXint level) const; 233 void flashMatching(); 234 void moveContents(FXint x,FXint y); 235 FXint changeBeg(FXint pos) const; 236 FXint changeEnd(FXint pos) const; 237 void mutation(FXint pos,FXint ncins,FXint ncdel,FXint nrins,FXint nrdel); 238 FXint overstruck(FXint start,FXint end,const FXchar *text,FXint num); 239 void drawCursor(FXuint state); 240 virtual void paintCursor(FXDCWindow& dc) const; 241 virtual void eraseCursor(FXDCWindow& dc) const; 242 virtual void eraseCursorOverhang(); 243 virtual void drawBufferText(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXint pos,FXint n,FXuint style) const; 244 virtual void fillBufferRect(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXuint style) const; 245 virtual FXuint styleOf(FXint beg,FXint end,FXint row,FXint col,FXint pos) const; 246 virtual void drawTextRow(FXDCWindow& dc,FXint row) const; 247 virtual void drawContents(FXDCWindow& dc) const; 248 virtual void drawNumbers(FXDCWindow& dc) const; 249 virtual void replace(FXint pos,FXint del,const FXchar *text,FXint ins,FXint style); 250 void updateRow(FXint row) const; 251 void updateLines(FXint startpos,FXint endpos) const; 252 void updateRange(FXint startpos,FXint endpos) const; 253 FXint shiftText(FXint startpos,FXint endpos,FXint shift,FXbool notify); 254 FXint caseShift(FXint startpos,FXint endpos,FXint upper,FXbool notify); 255 FXbool deletePendingSelection(FXbool notify); 256 protected: 257 enum { 258 MOUSE_NONE, // No mouse operation 259 MOUSE_CHARS, // Selecting characters 260 MOUSE_WORDS, // Selecting words 261 MOUSE_LINES, // Selecting lines 262 MOUSE_BLOCK, // Select block 263 MOUSE_SCROLL, // Scrolling 264 MOUSE_DRAG, // Dragging text 265 MOUSE_TRYDRAG // Tentative drag 266 }; 267 protected: 268 enum { 269 STYLE_MASK = 0x00FF, // Mask color table 270 STYLE_TEXT = 0x0100, // Draw some content 271 STYLE_SELECTED = 0x0200, // Selected 272 STYLE_CONTROL = 0x0400, // Control character 273 STYLE_HILITE = 0x0800, // Highlighted 274 STYLE_ACTIVE = 0x1000, // Active 275 STYLE_INSERT = 0x2000 // Column insert 276 }; 277 public: 278 enum { 279 STYLE_UNDERLINE = 0x0001, /// Underline text 280 STYLE_STRIKEOUT = 0x0002, /// Strike out text 281 STYLE_BOLD = 0x0004 /// Bold text 282 }; 283 private: 284 FXText(const FXText&); 285 FXText& operator=(const FXText&); 286 public: 287 long onPaint(FXObject*,FXSelector,void*); 288 long onEnter(FXObject*,FXSelector,void*); 289 long onLeave(FXObject*,FXSelector,void*); 290 long onBlink(FXObject*,FXSelector,void*); 291 long onFlash(FXObject*,FXSelector,void*); 292 long onFocusIn(FXObject*,FXSelector,void*); 293 long onFocusOut(FXObject*,FXSelector,void*); 294 long onMotion(FXObject*,FXSelector,void*); 295 long onAutoScroll(FXObject*,FXSelector,void*); 296 long onLeftBtnPress(FXObject*,FXSelector,void*); 297 long onLeftBtnRelease(FXObject*,FXSelector,void*); 298 long onMiddleBtnPress(FXObject*,FXSelector,void*); 299 long onMiddleBtnRelease(FXObject*,FXSelector,void*); 300 long onRightBtnPress(FXObject*,FXSelector,void*); 301 long onRightBtnRelease(FXObject*,FXSelector,void*); 302 long onKeyPress(FXObject*,FXSelector,void*); 303 long onKeyRelease(FXObject*,FXSelector,void*); 304 long onUngrabbed(FXObject*,FXSelector,void*); 305 long onBeginDrag(FXObject*,FXSelector,void*); 306 long onEndDrag(FXObject*,FXSelector,void*); 307 long onDragged(FXObject*,FXSelector,void*); 308 long onDNDEnter(FXObject*,FXSelector,void*); 309 long onDNDLeave(FXObject*,FXSelector,void*); 310 long onDNDMotion(FXObject*,FXSelector,void*); 311 long onDNDDrop(FXObject*,FXSelector,void*); 312 long onDNDRequest(FXObject*,FXSelector,void*); 313 long onSelectionLost(FXObject*,FXSelector,void*); 314 long onSelectionGained(FXObject*,FXSelector,void*); 315 long onSelectionRequest(FXObject*,FXSelector,void* ptr); 316 long onClipboardLost(FXObject*,FXSelector,void*); 317 long onClipboardGained(FXObject*,FXSelector,void*); 318 long onClipboardRequest(FXObject*,FXSelector,void*); 319 long onCmdSetTip(FXObject*,FXSelector,void*); 320 long onCmdGetTip(FXObject*,FXSelector,void*); 321 long onCmdSetHelp(FXObject*,FXSelector,void*); 322 long onCmdGetHelp(FXObject*,FXSelector,void*); 323 long onQueryTip(FXObject*,FXSelector,void*); 324 long onQueryHelp(FXObject*,FXSelector,void*); 325 long onUpdIsEditable(FXObject*,FXSelector,void*); 326 long onUpdHaveSelection(FXObject*,FXSelector,void*); 327 long onUpdHaveEditableSelection(FXObject*,FXSelector,void*); 328 long onIMEStart(FXObject*,FXSelector,void*); 329 long onTipTimer(FXObject*,FXSelector,void*); 330 331 // Value access 332 long onCmdSetStringValue(FXObject*,FXSelector,void*); 333 long onCmdGetStringValue(FXObject*,FXSelector,void*); 334 335 // Cursor movement 336 long onCmdCursorTop(FXObject*,FXSelector,void*); 337 long onCmdCursorBottom(FXObject*,FXSelector,void*); 338 long onCmdCursorHome(FXObject*,FXSelector,void*); 339 long onCmdCursorEnd(FXObject*,FXSelector,void*); 340 long onCmdCursorRight(FXObject*,FXSelector,void*); 341 long onCmdCursorLeft(FXObject*,FXSelector,void*); 342 long onCmdCursorUp(FXObject*,FXSelector,void*); 343 long onCmdCursorDown(FXObject*,FXSelector,void*); 344 long onCmdCursorPageUp(FXObject*,FXSelector,void*); 345 long onCmdCursorPageDown(FXObject*,FXSelector,void*); 346 long onCmdCursorWordLeft(FXObject*,FXSelector,void*); 347 long onCmdCursorWordRight(FXObject*,FXSelector,void*); 348 349 // Cursor shift-drag movement 350 long onCmdCursorShiftTop(FXObject*,FXSelector,void*); 351 long onCmdCursorShiftBottom(FXObject*,FXSelector,void*); 352 long onCmdCursorShiftHome(FXObject*,FXSelector,void*); 353 long onCmdCursorShiftEnd(FXObject*,FXSelector,void*); 354 long onCmdCursorShiftRight(FXObject*,FXSelector,void*); 355 long onCmdCursorShiftLeft(FXObject*,FXSelector,void*); 356 long onCmdCursorShiftUp(FXObject*,FXSelector,void*); 357 long onCmdCursorShiftDown(FXObject*,FXSelector,void*); 358 long onCmdCursorShiftPageUp(FXObject*,FXSelector,void*); 359 long onCmdCursorShiftPageDown(FXObject*,FXSelector,void*); 360 long onCmdCursorShiftWordLeft(FXObject*,FXSelector,void*); 361 long onCmdCursorShiftWordRight(FXObject*,FXSelector,void*); 362 363 // Cursor alt-drag movement 364 long onCmdCursorAltUp(FXObject*,FXSelector,void*); 365 long onCmdCursorAltDown(FXObject*,FXSelector,void*); 366 long onCmdCursorAltLeft(FXObject*,FXSelector,void*); 367 long onCmdCursorAltRight(FXObject*,FXSelector,void*); 368 369 // Positioning 370 long onCmdScrollUp(FXObject*,FXSelector,void*); 371 long onCmdScrollDown(FXObject*,FXSelector,void*); 372 long onCmdScrollTop(FXObject*,FXSelector,void*); 373 long onCmdScrollBottom(FXObject*,FXSelector,void*); 374 long onCmdScrollCenter(FXObject*,FXSelector,void*); 375 376 // Inserting 377 long onCmdInsertString(FXObject*,FXSelector,void*); 378 long onCmdInsertNewline(FXObject*,FXSelector,void*); 379 long onCmdInsertNewlineOnly(FXObject*,FXSelector,void*); 380 long onCmdInsertNewlineIndent(FXObject*,FXSelector,void*); 381 long onCmdInsertTab(FXObject*,FXSelector,void*); 382 long onCmdInsertHardTab(FXObject*,FXSelector,void*); 383 long onCmdInsertSoftTab(FXObject*,FXSelector,void*); 384 385 // Manipulation Selection 386 long onCmdCutSel(FXObject*,FXSelector,void*); 387 long onCmdCopySel(FXObject*,FXSelector,void*); 388 long onCmdPasteSel(FXObject*,FXSelector,void*); 389 long onCmdPasteMiddle(FXObject*,FXSelector,void*); 390 long onCmdDeleteSel(FXObject*,FXSelector,void*); 391 long onCmdReplaceSel(FXObject*,FXSelector,void*); 392 long onCmdSelectChar(FXObject*,FXSelector,void*); 393 long onCmdSelectWord(FXObject*,FXSelector,void*); 394 long onCmdSelectLine(FXObject*,FXSelector,void*); 395 long onCmdSelectMatching(FXObject*,FXSelector,void*); 396 long onCmdSelectEnclosing(FXObject*,FXSelector,void*); 397 long onCmdSelectAll(FXObject*,FXSelector,void*); 398 long onCmdDeselectAll(FXObject*,FXSelector,void*); 399 400 // Deletion 401 long onCmdBackspaceChar(FXObject*,FXSelector,void*); 402 long onCmdBackspaceWord(FXObject*,FXSelector,void*); 403 long onCmdBackspaceBol(FXObject*,FXSelector,void*); 404 long onCmdDeleteChar(FXObject*,FXSelector,void*); 405 long onCmdDeleteWord(FXObject*,FXSelector,void*); 406 long onCmdDeleteEol(FXObject*,FXSelector,void*); 407 long onCmdDeleteAll(FXObject*,FXSelector,void*); 408 long onCmdDeleteLine(FXObject*,FXSelector,void*); 409 410 // Control commands 411 long onCmdShiftText(FXObject*,FXSelector,void*); 412 long onCmdChangeCase(FXObject*,FXSelector,void*); 413 long onCmdCopyLine(FXObject*,FXSelector,void*); 414 long onCmdMoveLineUp(FXObject*,FXSelector,void*); 415 long onCmdMoveLineDown(FXObject*,FXSelector,void*); 416 long onCmdJoinLines(FXObject*,FXSelector,void*); 417 long onCmdBlockBeg(FXObject*,FXSelector,void*); 418 long onCmdBlockEnd(FXObject*,FXSelector,void*); 419 long onCmdGotoMatching(FXObject*,FXSelector,void*); 420 long onCmdCursorRow(FXObject*,FXSelector,void*); 421 long onUpdCursorRow(FXObject*,FXSelector,void*); 422 long onCmdCursorColumn(FXObject*,FXSelector,void*); 423 long onUpdCursorColumn(FXObject*,FXSelector,void*); 424 long onCmdToggleEditable(FXObject*,FXSelector,void*); 425 long onUpdToggleEditable(FXObject*,FXSelector,void*); 426 long onCmdToggleOverstrike(FXObject*,FXSelector,void*); 427 long onUpdToggleOverstrike(FXObject*,FXSelector,void*); 428 public: 429 static const FXchar textDelimiters[]; 430 431 public: 432 433 /// Selection modes 434 enum { 435 SelectNone, /// Select nothing 436 SelectChars, /// Select characters 437 SelectWords, /// Select words 438 SelectRows, /// Select rows 439 SelectLines /// Select lines 440 }; 441 442 public: 443 444 enum { 445 ID_CURSOR_TOP=FXScrollArea::ID_LAST, 446 ID_CURSOR_BOTTOM, 447 ID_CURSOR_HOME, 448 ID_CURSOR_END, 449 ID_CURSOR_RIGHT, 450 ID_CURSOR_LEFT, 451 ID_CURSOR_UP, 452 ID_CURSOR_DOWN, 453 ID_CURSOR_PAGEUP, 454 ID_CURSOR_PAGEDOWN, 455 ID_CURSOR_WORD_LEFT, 456 ID_CURSOR_WORD_RIGHT, 457 ID_CURSOR_SHIFT_TOP, 458 ID_CURSOR_SHIFT_BOTTOM, 459 ID_CURSOR_SHIFT_HOME, 460 ID_CURSOR_SHIFT_END, 461 ID_CURSOR_SHIFT_UP, 462 ID_CURSOR_SHIFT_DOWN, 463 ID_CURSOR_SHIFT_LEFT, 464 ID_CURSOR_SHIFT_RIGHT, 465 ID_CURSOR_SHIFT_PAGEUP, 466 ID_CURSOR_SHIFT_PAGEDOWN, 467 ID_CURSOR_SHIFT_WORD_LEFT, 468 ID_CURSOR_SHIFT_WORD_RIGHT, 469 ID_CURSOR_ALT_UP, 470 ID_CURSOR_ALT_DOWN, 471 ID_CURSOR_ALT_LEFT, 472 ID_CURSOR_ALT_RIGHT, 473 ID_SCROLL_UP, 474 ID_SCROLL_DOWN, 475 ID_SCROLL_TOP, 476 ID_SCROLL_BOTTOM, 477 ID_SCROLL_CENTER, 478 ID_INSERT_STRING, 479 ID_INSERT_NEWLINE, 480 ID_INSERT_NEWLINE_ONLY, 481 ID_INSERT_NEWLINE_INDENT, 482 ID_INSERT_TAB, 483 ID_INSERT_HARDTAB, 484 ID_INSERT_SOFTTAB, 485 ID_CUT_SEL, 486 ID_COPY_SEL, 487 ID_DELETE_SEL, 488 ID_REPLACE_SEL, 489 ID_PASTE_SEL, 490 ID_PASTE_MIDDLE, 491 ID_SELECT_CHAR, 492 ID_SELECT_WORD, 493 ID_SELECT_LINE, 494 ID_SELECT_ALL, 495 ID_SELECT_MATCHING, 496 ID_SELECT_BRACE, 497 ID_SELECT_BRACK, 498 ID_SELECT_PAREN, 499 ID_SELECT_ANG, 500 ID_DESELECT_ALL, 501 ID_BACKSPACE_CHAR, 502 ID_BACKSPACE_WORD, 503 ID_BACKSPACE_BOL, 504 ID_DELETE_CHAR, 505 ID_DELETE_WORD, 506 ID_DELETE_EOL, 507 ID_DELETE_ALL, 508 ID_DELETE_LINE, 509 ID_TOGGLE_EDITABLE, 510 ID_TOGGLE_OVERSTRIKE, 511 ID_CURSOR_ROW, 512 ID_CURSOR_COLUMN, 513 ID_JOIN_LINES, 514 ID_SHIFT_LEFT, 515 ID_SHIFT_RIGHT, 516 ID_SHIFT_TABLEFT, 517 ID_SHIFT_TABRIGHT, 518 ID_CLEAN_INDENT, 519 ID_COPY_LINE, 520 ID_MOVE_LINE_UP, 521 ID_MOVE_LINE_DOWN, 522 ID_UPPER_CASE, 523 ID_LOWER_CASE, 524 ID_GOTO_MATCHING, 525 ID_LEFT_BRACE, 526 ID_LEFT_BRACK, 527 ID_LEFT_PAREN, 528 ID_LEFT_ANG, 529 ID_RIGHT_BRACE, 530 ID_RIGHT_BRACK, 531 ID_RIGHT_PAREN, 532 ID_RIGHT_ANG, 533 ID_BLINK, 534 ID_FLASH, 535 ID_LAST 536 }; 537 538 public: 539 540 /// Construct multi-line text widget 541 FXText(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=3,FXint pr=3,FXint pt=2,FXint pb=2); 542 543 /// Create server-side resources 544 virtual void create(); 545 546 /// Detach server-side resources 547 virtual void detach(); 548 549 /// Get default width 550 virtual FXint getContentWidth(); 551 552 /// Get default height 553 virtual FXint getContentHeight(); 554 555 /// Return visible scroll-area x position 556 virtual FXint getVisibleX() const; 557 558 /// Return visible scroll-area y position 559 virtual FXint getVisibleY() const; 560 561 /// Return visible scroll-area width 562 virtual FXint getVisibleWidth() const; 563 564 /// Return visible scroll-area height 565 virtual FXint getVisibleHeight() const; 566 567 /// Return default width 568 virtual FXint getDefaultWidth(); 569 570 /// Return default height 571 virtual FXint getDefaultHeight(); 572 573 /// Perform layout 574 virtual void layout(); 575 576 /// Enable the text widget 577 virtual void enable(); 578 579 /// Disable the text widget 580 virtual void disable(); 581 582 /// Need to recalculate size 583 virtual void recalc(); 584 585 /// Returns true because a text widget can receive focus 586 virtual FXbool canFocus() const; 587 588 /// Move the focus to this window 589 virtual void setFocus(); 590 591 /// Remove the focus from this window 592 virtual void killFocus(); 593 594 /// Set modified flag 595 void setModified(FXbool mod=true){ modified=mod; } 596 597 /// Return true if text was modified isModified()598 FXbool isModified() const { return modified; } 599 600 /// Set editable mode 601 void setEditable(FXbool edit=true); 602 603 /// Return true if text is editable 604 FXbool isEditable() const; 605 606 /// Set overstrike mode 607 void setOverstrike(FXbool over=true); 608 609 /// Return true if overstrike mode in effect 610 FXbool isOverstrike() const; 611 612 /// Return length of buffer getLength()613 FXint getLength() const { return length; } 614 615 /// Return number of rows in buffer getNumRows()616 FXint getNumRows() const { return nrows; } 617 618 /// Get byte at position in text buffer 619 FXint getByte(FXint pos) const; 620 621 /// Get wide character at position pos 622 FXwchar getChar(FXint pos) const; 623 624 /// Get length of wide character at position pos 625 FXint getCharLen(FXint pos) const; 626 627 /// Get style at position pos 628 FXint getStyle(FXint pos) const; 629 630 /// Retreat to the previous valid utf8 character start 631 FXint dec(FXint pos) const; 632 633 /// Advance to the next valid utf8 character start 634 FXint inc(FXint pos) const; 635 636 /// Return position of begin of line containing position pos 637 FXint lineStart(FXint pos) const; 638 639 /// Return position of end of line containing position pos 640 FXint lineEnd(FXint pos) const; 641 642 /// Return start of next line 643 FXint nextLine(FXint pos,FXint nl=1) const; 644 645 /// Return start of previous line 646 FXint prevLine(FXint pos,FXint nl=1) const; 647 648 /// Return row start 649 FXint rowStart(FXint pos) const; 650 651 /// Return row end 652 FXint rowEnd(FXint pos) const; 653 654 /// Return start of next row 655 FXint nextRow(FXint pos,FXint nr=1) const; 656 657 /// Return start of previous row 658 FXint prevRow(FXint pos,FXint nr=1) const; 659 660 /// Return end of previous word 661 FXint leftWord(FXint pos) const; 662 663 /// Return begin of next word 664 FXint rightWord(FXint pos) const; 665 666 /// Return begin of word 667 FXint wordStart(FXint pos) const; 668 669 /// Return end of word 670 FXint wordEnd(FXint pos) const; 671 672 /// Return validated utf8 character start position 673 FXint validPos(FXint pos) const; 674 675 /** 676 * Count number of columns taken up by some text. 677 * Start should be on a row start. 678 */ 679 FXint countCols(FXint start,FXint end) const; 680 681 /** 682 * Count number of rows taken up by some text. 683 * Start and end should be on a row start. 684 */ 685 FXint countRows(FXint start,FXint end) const; 686 687 /** 688 * Count number of newlines. 689 * Start should be on a line start. 690 */ 691 FXint countLines(FXint start,FXint end) const; 692 693 694 /// Change the text in the buffer to new text 695 virtual FXint setText(const FXchar* text,FXint num,FXbool notify=false); 696 virtual FXint setText(const FXString& text,FXbool notify=false); 697 698 /// Change the text in the buffer to new text 699 virtual FXint setStyledText(const FXchar* text,FXint num,FXint style=0,FXbool notify=false); 700 virtual FXint setStyledText(const FXString& text,FXint style=0,FXbool notify=false); 701 702 /// Replace del bytes at pos by ins characters of text 703 virtual FXint replaceText(FXint pos,FXint del,const FXchar *text,FXint ins,FXbool notify=false); 704 virtual FXint replaceText(FXint pos,FXint del,const FXString& text,FXbool notify=false); 705 706 /// Replace del bytes at pos by ins characters of text 707 virtual FXint replaceStyledText(FXint pos,FXint del,const FXchar *text,FXint ins,FXint style=0,FXbool notify=false); 708 virtual FXint replaceStyledText(FXint pos,FXint del,const FXString& text,FXint style=0,FXbool notify=false); 709 710 /// Replace text columns startcol to endcol in lines starting at startpos to endpos by new text 711 virtual FXint replaceTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXchar *text,FXint num,FXbool notify=false); 712 virtual FXint replaceTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXString& text,FXbool notify=false); 713 714 /// Replace text columns startcol to endcol in lines starting at startpos to endpos by new text with given style 715 virtual FXint replaceStyledTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXchar *text,FXint num,FXint style=0,FXbool notify=false); 716 virtual FXint replaceStyledTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXString& text,FXint style=0,FXbool notify=false); 717 718 /// Overstrike text block 719 virtual FXint overstrikeTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXchar *text,FXint num,FXbool notify=false); 720 virtual FXint overstrikeTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXString& text,FXbool notify=false); 721 722 /// Overstrike styled text block 723 virtual FXint overstrikeStyledTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXchar *text,FXint num,FXint style=0,FXbool notify=false); 724 virtual FXint overstrikeStyledTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXString& text,FXint style=0,FXbool notify=false); 725 726 /// Append n bytes of text at the end of the buffer 727 virtual FXint appendText(const FXchar *text,FXint num,FXbool notify=false); 728 virtual FXint appendText(const FXString& text,FXbool notify=false); 729 730 /// Append n bytes of text at the end of the buffer 731 virtual FXint appendStyledText(const FXchar *text,FXint num,FXint style=0,FXbool notify=false); 732 virtual FXint appendStyledText(const FXString& text,FXint style=0,FXbool notify=false); 733 734 /// Insert n bytes of text at position pos into the buffer 735 virtual FXint insertText(FXint pos,const FXchar *text,FXint num,FXbool notify=false); 736 virtual FXint insertText(FXint pos,const FXString& text,FXbool notify=false); 737 738 /// Insert n bytes of text at position pos into the buffer 739 virtual FXint insertStyledText(FXint pos,const FXchar *text,FXint num,FXint style=0,FXbool notify=false); 740 virtual FXint insertStyledText(FXint pos,const FXString& text,FXint style=0,FXbool notify=false); 741 742 /// Insert text columns at startcol in line starting at startpos to endpos 743 virtual FXint insertTextBlock(FXint startpos,FXint endpos,FXint startcol,const FXchar *text,FXint num,FXbool notify=false); 744 virtual FXint insertTextBlock(FXint startpos,FXint endpos,FXint startcol,const FXString& text,FXbool notify=false); 745 746 /// Insert text columns at startcol in line starting at startpos to endpos with given style 747 virtual FXint insertStyledTextBlock(FXint startpos,FXint endpos,FXint startcol,const FXchar *text,FXint num,FXint style=0,FXbool notify=false); 748 virtual FXint insertStyledTextBlock(FXint startpos,FXint endpos,FXint startcol,const FXString& text,FXint style=0,FXbool notify=false); 749 750 /// Change style of text range 751 virtual FXint changeStyle(FXint pos,FXint num,FXint style); 752 753 /// Change style of text range from style-array 754 virtual FXint changeStyle(FXint pos,const FXchar* style,FXint num); 755 virtual FXint changeStyle(FXint pos,const FXString& style); 756 757 /// Remove n bytes of text at position pos from the buffer 758 virtual FXint removeText(FXint pos,FXint num,FXbool notify=false); 759 760 /// Remove columns startcol to endcol from lines starting at startpos to endpos 761 virtual FXint removeTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,FXbool notify=false); 762 763 /// Remove all text from the buffer 764 virtual FXint clearText(FXbool notify=false); 765 766 767 /// Extract n bytes of text from position pos into already allocated buffer 768 void extractText(FXchar *text,FXint pos,FXint num) const; 769 770 /// Extract n bytes of text from position pos into string text 771 void extractText(FXString& text,FXint pos,FXint num) const; 772 773 /// Return n bytes of contents of text buffer from position pos 774 FXString extractText(FXint pos,FXint num) const; 775 776 /// Extract n bytes of style info from position pos into already allocated buffer 777 void extractStyle(FXchar *style,FXint pos,FXint num) const; 778 779 /// Extract n bytes of style info from position pos into string text 780 void extractStyle(FXString& style,FXint pos,FXint num) const; 781 782 /// Return n bytes of style info from buffer from position pos 783 FXString extractStyle(FXint pos,FXint num) const; 784 785 /// Extract text columns startcol to endcol from lines starting at startpos to endpos 786 void extractTextBlock(FXString& text,FXint startpos,FXint endpos,FXint startcol,FXint endcol) const; 787 788 /// Return text columns startcol to endcol from lines starting at startpos to endpos 789 FXString extractTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol) const; 790 791 /// Return entire text as string 792 FXString getText() const; 793 794 /// Retrieve text into buffer 795 void getText(FXchar* text,FXint num) const; 796 797 /// Retrieve text into string 798 void getText(FXString& text) const; 799 800 801 /// Select all text 802 virtual FXbool selectAll(FXbool notify=false); 803 804 /// Select len characters starting at given position pos 805 virtual FXbool setSelection(FXint pos,FXint len,FXbool notify=false); 806 807 /// Extend the primary selection from the anchor to the given position 808 virtual FXbool extendSelection(FXint pos,FXuint sel=SelectChars,FXbool notify=false); 809 810 /// Select block of characters within given box 811 virtual FXbool setBlockSelection(FXint trow,FXint lcol,FXint brow,FXint rcol,FXbool notify=false); 812 813 /// Extend primary selection from anchor to given row, column 814 virtual FXbool extendBlockSelection(FXint row,FXint col,FXbool notify=false); 815 816 /// Get selected text 817 FXString getSelectedText() const; 818 819 /// Return true if position pos is selected 820 FXbool isPosSelected(FXint pos) const; 821 822 /// Return true if position pos (and column col) is selected 823 FXbool isPosSelected(FXint pos,FXint col) const; 824 825 /// Return selection start position getSelStartPos()826 FXint getSelStartPos() const { return select.startpos; } 827 828 /// Return selection end position getSelEndPos()829 FXint getSelEndPos() const { return select.endpos; } 830 831 /// Return selection start column getSelStartColumn()832 FXint getSelStartColumn() const { return select.startcol; } 833 834 /// Return selection end column getSelEndColumn()835 FXint getSelEndColumn() const { return select.endcol; } 836 837 /// Kill or deselect primary selection 838 virtual FXbool killSelection(FXbool notify=false); 839 840 841 /// Copy primary selection to clipboard 842 FXbool copySelection(); 843 844 /// Cut primary selection to clipboard 845 FXbool cutSelection(FXbool notify=false); 846 847 /// Delete primary selection 848 FXbool deleteSelection(FXbool notify=false); 849 850 /// Paste primary ("middle-mouse") selection 851 FXbool pasteSelection(FXbool notify=false); 852 853 /// Paste clipboard 854 FXbool pasteClipboard(FXbool notify=false); 855 856 /// Replace primary selection by other text 857 FXbool replaceSelection(const FXString& text,FXbool notify=false); 858 859 /// Highlight len characters starting at given position pos 860 FXbool setHighlight(FXint start,FXint len); 861 862 /// Unhighlight the text 863 FXbool killHighlight(); 864 865 866 /// Make line containing pos the top line 867 void setTopLine(FXint pos); 868 869 /// Return position of top line 870 FXint getTopLine() const; 871 872 /// Make line containing pos the bottom line 873 void setBottomLine(FXint pos); 874 875 /// Return the position of the bottom line 876 FXint getBottomLine() const; 877 878 /// Make line containing pos the center line 879 void setCenterLine(FXint pos); 880 881 /// Return true if line containing position is fully visible 882 FXbool isPosVisible(FXint pos) const; 883 884 /// Scroll text to make the given position visible 885 void makePositionVisible(FXint pos); 886 887 888 /// Return text position at given visible x,y coordinate 889 FXint getPosAt(FXint x,FXint y) const; 890 891 /// Return text position containing x, y coordinate 892 FXint getPosContaining(FXint x,FXint y) const; 893 894 /// Return screen x-coordinate of pos 895 FXint getXOfPos(FXint pos) const; 896 897 /// Return screen y-coordinate of pos 898 FXint getYOfPos(FXint pos) const; 899 900 /** 901 * Return closest position and (row,col) of given x,y coordinate. 902 * The (row,col) is unconstrained, i.e. calculated as if tabs and 903 * area past the newline is comprised of spaces; the returned position 904 * however is inside the text. 905 * Note that when using proportional fonts, the width of a logical space 906 * inside a tab is variable, to account for the logical columns in a tab. 907 */ 908 FXint getRowColumnAt(FXint x,FXint y,FXint& row,FXint& col) const; 909 910 /// Return screen x-coordinate of unconstrained (row,col). 911 FXint getXOfRowColumn(FXint row,FXint col) const; 912 913 /// Return screen y-coordinate of unconstrained (row,col). 914 FXint getYOfRowColumn(FXint row,FXint col) const; 915 916 917 /// Set the cursor position 918 virtual void setCursorPos(FXint pos,FXbool notify=false); 919 920 /// Return the cursor position getCursorPos()921 FXint getCursorPos() const { return cursorpos; } 922 923 /// Set cursor row, column 924 void setCursorRowColumn(FXint row,FXint col,FXbool notify=false); 925 926 /// Set cursor row 927 void setCursorRow(FXint row,FXbool notify=false); 928 929 /// Return cursor row getCursorRow()930 FXint getCursorRow() const { return cursorrow; } 931 932 /// Set cursor column 933 void setCursorColumn(FXint col,FXbool notify=false); 934 935 /// Return cursor row, i.e. indent position getCursorColumn()936 FXint getCursorColumn() const { return cursorcol; } 937 938 /// Set the anchor position 939 void setAnchorPos(FXint pos); 940 941 /// Return the anchor position getAnchorPos()942 FXint getAnchorPos() const { return anchorpos; } 943 944 /// Set anchor row and column 945 void setAnchorRowColumn(FXint row,FXint col); 946 947 /// Return anchor row getAnchorRow()948 FXint getAnchorRow() const { return anchorrow; } 949 950 /// Return anchor row getAnchorColumn()951 FXint getAnchorColumn() const { return anchorcol; } 952 953 /// Move cursor to position, and scroll into view 954 void moveCursor(FXint pos,FXbool notify=false); 955 956 /// Move cursor to row and column, and scroll into view 957 void moveCursorRowColumn(FXint row,FXint col,FXbool notify=false); 958 959 /// Move cursor to position, and extend the selection to this point 960 void moveCursorAndSelect(FXint pos,FXuint sel,FXbool notify=false); 961 962 /// Move cursor to row and column, and extend the block selection to this point 963 void moveCursorRowColumnAndSelect(FXint row,FXint col,FXbool notify=false); 964 965 /** 966 * Search for string in text buffer, returning the extent of the string in beg and end. 967 * The search starts from the given starting position, scans forward (SEARCH_FORWARD) or 968 * backward (SEARCH_BACKWARD), and wraps around if SEARCH_WRAP has been specified. 969 * If neither SEARCH_FORWARD or SEARCH_BACKWARD flags are set, an anchored match is performed 970 * at the given starting position. 971 * The search type is either a plain search (SEARCH_EXACT), case insensitive search 972 * (SEARCH_IGNORECASE), or regular expression search (SEARCH_REGEX). 973 * For regular expression searches, capturing parentheses are used if npar is greater than 1; 974 * in this case, the number of entries in the beg[], end[] arrays must be npar also. 975 * If either beg or end or both are NULL, internal arrays are used. 976 */ 977 FXbool findText(const FXString& string,FXint* beg=NULL,FXint* end=NULL,FXint start=0,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP|SEARCH_EXACT,FXint npar=1); 978 979 /// Change text widget style 980 void setTextStyle(FXuint style); 981 982 /// Return text widget style 983 FXuint getTextStyle() const; 984 985 /// Change text font 986 void setFont(FXFont* fnt); 987 988 /// Return text font getFont()989 FXFont* getFont() const { return font; } 990 991 /// Change number of visible rows 992 void setVisibleRows(FXint rows); 993 994 /// Return number of visible rows getVisibleRows()995 FXint getVisibleRows() const { return vrows; } 996 997 /// Change number of visible columns 998 void setVisibleColumns(FXint cols); 999 1000 /// Return number of visible columns getVisibleColumns()1001 FXint getVisibleColumns() const { return vcols; } 1002 1003 /// Change top margin 1004 void setMarginTop(FXint pt); 1005 1006 /// Return top margin getMarginTop()1007 FXint getMarginTop() const { return margintop; } 1008 1009 /// Change bottom margin 1010 void setMarginBottom(FXint pb); 1011 1012 /// Return bottom margin getMarginBottom()1013 FXint getMarginBottom() const { return marginbottom; } 1014 1015 /// Change left margin 1016 void setMarginLeft(FXint pl); 1017 1018 /// Return left margin getMarginLeft()1019 FXint getMarginLeft() const { return marginleft; } 1020 1021 /// Change right margin 1022 void setMarginRight(FXint pr); 1023 1024 /// Return right margin getMarginRight()1025 FXint getMarginRight() const { return marginright; } 1026 1027 /// Return number of columns used for line numbers getBarColumns()1028 FXint getBarColumns() const { return barcolumns; } 1029 1030 /// Change number of columns used for line numbers 1031 void setBarColumns(FXint cols); 1032 1033 /// Set wrap columns 1034 void setWrapColumns(FXint cols); 1035 1036 /// Return wrap columns getWrapColumns()1037 FXint getWrapColumns() const { return wrapcolumns; } 1038 1039 /// Change tab columns 1040 void setTabColumns(FXint cols); 1041 1042 /// Return tab columns getTabColumns()1043 FXint getTabColumns() const { return tabcolumns; } 1044 1045 /// Change text color 1046 void setTextColor(FXColor clr); 1047 1048 /// Return text color getTextColor()1049 FXColor getTextColor() const { return textColor; } 1050 1051 /// Change selected background color 1052 void setSelBackColor(FXColor clr); 1053 1054 /// Return selected background color getSelBackColor()1055 FXColor getSelBackColor() const { return selbackColor; } 1056 1057 /// Change selected text color 1058 void setSelTextColor(FXColor clr); 1059 1060 /// Return selected text color getSelTextColor()1061 FXColor getSelTextColor() const { return seltextColor; } 1062 1063 /// Change highlighted text color 1064 void setHiliteTextColor(FXColor clr); 1065 1066 /// Return highlighted text color getHiliteTextColor()1067 FXColor getHiliteTextColor() const { return hilitetextColor; } 1068 1069 /// Change highlighted background color 1070 void setHiliteBackColor(FXColor clr); 1071 1072 /// Return highlighted background color getHiliteBackColor()1073 FXColor getHiliteBackColor() const { return hilitebackColor; } 1074 1075 /// Change active background color 1076 void setActiveBackColor(FXColor clr); 1077 1078 /// Return active background color getActiveBackColor()1079 FXColor getActiveBackColor() const { return activebackColor; } 1080 1081 /// Change cursor color 1082 void setCursorColor(FXColor clr); 1083 1084 /// Return cursor color getCursorColor()1085 FXColor getCursorColor() const { return cursorColor; } 1086 1087 /// Change line number color 1088 void setNumberColor(FXColor clr); 1089 1090 /// Return line number color getNumberColor()1091 FXColor getNumberColor() const { return numberColor; } 1092 1093 /// Change bar color 1094 void setBarColor(FXColor clr); 1095 1096 /// Return bar color getBarColor()1097 FXColor getBarColor() const { return barColor; } 1098 1099 /// Set styled text mode; return true if success 1100 FXbool setStyled(FXbool styled=true); 1101 1102 /// Return true if style buffer isStyled()1103 FXbool isStyled() const { return (sbuffer!=NULL); } 1104 1105 /** 1106 * Set highlight styles. 1107 * The table of styles is only referenced by the widget; it is not copied. 1108 * Thus, multiple widgets may share a common style table. 1109 * Some care must be taken to populate the style-buffer only with numbers 1110 * inside the style table. 1111 */ 1112 void setHiliteStyles(FXHiliteStyle* styles); 1113 1114 /// Return current value of the style table. getHiliteStyles()1115 FXHiliteStyle* getHiliteStyles() const { return hilitestyles; } 1116 1117 /// Change delimiters of words 1118 void setDelimiters(const FXchar* delims=textDelimiters){ delimiters=delims; } 1119 1120 /// Return word delimiters getDelimiters()1121 const FXchar* getDelimiters() const { return delimiters; } 1122 1123 /** 1124 * Change brace and parenthesis match highlighting time, in nanoseconds. 1125 * If highlighting for a small interval, only flash if the matching brace 1126 * is visible. If the highlighting interval is set to forever, highlighting 1127 * stays on till cursor moves, and the brace is highlighted even if not 1128 * (yet) visible. Note that this may be expensive as a large part of the 1129 * text buffer could be visited to find the matching brace. 1130 */ setHiliteMatchTime(FXTime t)1131 void setHiliteMatchTime(FXTime t){ matchtime=t; } 1132 1133 /// Return brace and parenthesis match highlighting time, in nanoseconds getHiliteMatchTime()1134 FXTime getHiliteMatchTime() const { return matchtime; } 1135 1136 /// Set help text setHelpText(const FXString & text)1137 void setHelpText(const FXString& text){ help=text; } 1138 1139 /// Return help text getHelpText()1140 FXString getHelpText() const { return help; } 1141 1142 /// Set the tool tip message for this text widget setTipText(const FXString & text)1143 void setTipText(const FXString& text){ tip=text; } 1144 1145 /// Get the tool tip message for this text widget getTipText()1146 FXString getTipText() const { return tip; } 1147 1148 /// Save to a stream 1149 virtual void save(FXStream& store) const; 1150 1151 /// Load from a stream 1152 virtual void load(FXStream& store); 1153 1154 /// Destructor 1155 virtual ~FXText(); 1156 }; 1157 1158 } 1159 1160 #endif 1161