Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXText.h
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,2017 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 
32 enum {
33  TEXT_READONLY = 0x00100000,
34  TEXT_WORDWRAP = 0x00200000,
35  TEXT_OVERSTRIKE = 0x00400000,
36  TEXT_FIXEDWRAP = 0x00800000,
37  TEXT_NO_TABS = 0x01000000,
38  TEXT_AUTOINDENT = 0x02000000,
39  TEXT_SHOWACTIVE = 0x04000000,
40  TEXT_SHOWMATCH = 0x08000000,
41  };
42 
43 
45 struct FXHiliteStyle {
46  FXColor normalForeColor;
47  FXColor normalBackColor;
48  FXColor selectForeColor;
49  FXColor selectBackColor;
50  FXColor hiliteForeColor;
51  FXColor hiliteBackColor;
52  FXColor activeBackColor;
53  FXuint style;
54  };
55 
56 
63 struct FXTextChange {
64  FXint pos;
65  FXint ndel;
66  FXint nins;
67  FXchar *ins;
68  FXchar *del;
69  };
70 
71 
78  FXint startpos;
79  FXint endpos;
80  FXint startcol;
81  FXint endcol;
82  };
83 
84 
154 class FXAPI FXText : public FXScrollArea {
155  FXDECLARE(FXText)
156 protected:
157  FXchar *buffer; // Text buffer being edited
158  FXchar *sbuffer; // Text style buffer
159  FXint *visrows; // Starts of rows in buffer
160  FXint length; // Length of the actual text in the buffer
161  FXint nvisrows; // Number of visible rows
162  FXint nrows; // Total number of rows
163  FXint gapstart; // Start of the insertion point (the gap)
164  FXint gapend; // End of the insertion point+1
165  FXint toppos; // Start position of first visible row
166  FXint toprow; // Row number of first visible row
167  FXint keeppos; // Position to keep on top visible row
168  FXTextSelection select; // Text selection
169  FXTextSelection hilite; // Text highlight
170  FXint anchorpos; // Anchor position
171  FXint cursorpos; // Cursor position
172  FXint cursorstartpos; // Cursor row start pos
173  FXint cursorendpos; // Cursor row end pos
174  FXint cursorrow; // Cursor row
175  FXint cursorcol; // Cursor column (kept insided text)
176  FXint prefcol; // Preferred cursor column
177  FXint anchorvrow;
178  FXint anchorvcol;
179  FXint cursorvrow;
180  FXint cursorvcol;
181  FXint margintop; // Margins top
182  FXint marginbottom; // Margin bottom
183  FXint marginleft; // Margin left
184  FXint marginright; // Margin right
185  FXint wrapwidth; // Wrap width in pixels
186  FXint wrapcolumns; // Wrap columns
187  FXint tabwidth; // Tab width in pixels
188  FXint tabcolumns; // Tab columns
189  FXint barwidth; // Line number width
190  FXint barcolumns; // Line number columns
191  FXFont *font; // Text font
192  FXColor textColor; // Normal text color
193  FXColor selbackColor; // Select background color
194  FXColor seltextColor; // Select text color
195  FXColor hilitebackColor; // Highlight background color
196  FXColor hilitetextColor; // Highlight text color
197  FXColor activebackColor; // Background color for active line
198  FXColor numberColor; // Line number color
199  FXColor cursorColor; // Cursor color
200  FXColor barColor; // Bar background color
201  FXint textWidth; // Total width of all text
202  FXint textHeight; // Total height of all text
203  const FXchar *delimiters; // Delimiters
204  FXString clipped; // Clipped text
205  FXint vrows; // Default visible rows
206  FXint vcols; // Default visible columns
207  FXString help; // Status line help
208  FXString tip; // Tooltip
209  FXHiliteStyle *hilitestyles; // Style definitions
210  FXuint blink; // Next cursor blink state
211  FXTime matchtime; // Match time (ns)
212  FXint grabx; // Grab point x
213  FXint graby; // Grab point y
214  FXuchar mode; // Mode widget is in
215  FXbool modified; // User has modified text
216 protected:
217  FXText();
218  void movegap(FXint pos);
219  void sizegap(FXint sz);
220  void squeezegap();
221  FXint charWidth(FXwchar ch,FXint indent) const;
222  FXint xoffset(FXint start,FXint pos) const;
223  FXint wrap(FXint start) const;
224  FXint rowFromPos(FXint pos) const;
225  FXint posFromRow(FXint row) const;
226  FXint columnFromPos(FXint start,FXint pos) const;
227  FXint posFromColumn(FXint start,FXint col) const;
228  FXbool isdelimiter(FXwchar w) const;
229  FXint measureText(FXint start,FXint end,FXint& wmax,FXint& hmax) const;
230  void calcVisRows(FXint s,FXint e);
231  void recompute();
232  FXint matchForward(FXint pos,FXint end,FXwchar l,FXwchar r,FXint level) const;
233  FXint matchBackward(FXint pos,FXint beg,FXwchar l,FXwchar r,FXint level) const;
234  FXint findMatching(FXint pos,FXint beg,FXint end,FXwchar ch,FXint level) const;
235  void flashMatching();
236  void moveContents(FXint x,FXint y);
237  FXint changeBeg(FXint pos) const;
238  FXint changeEnd(FXint pos) const;
239  void mutation(FXint pos,FXint ncins,FXint ncdel,FXint nrins,FXint nrdel);
240  FXint overstruck(FXint start,FXint end,const FXchar *text,FXint n);
241  void drawCursor(FXuint state);
242  virtual void paintCursor(FXDCWindow& dc) const;
243  virtual void eraseCursor(FXDCWindow& dc) const;
244  virtual void eraseCursorOverhang();
245  virtual void drawBufferText(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXint pos,FXint n,FXuint style) const;
246  virtual void fillBufferRect(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXuint style) const;
247  virtual FXuint styleOf(FXint beg,FXint end,FXint row,FXint col,FXint pos) const;
248  virtual void drawTextRow(FXDCWindow& dc,FXint row) const;
249  virtual void drawContents(FXDCWindow& dc) const;
250  virtual void drawNumbers(FXDCWindow& dc) const;
251  virtual void replace(FXint pos,FXint m,const FXchar *text,FXint n,FXint style);
252  void updateRows(FXint startrow,FXint endrow) const;
253  void updateRange(FXint startpos,FXint endpos) const;
254  FXbool deletePendingSelection(FXbool notify);
255 protected:
256  enum {
257  MOUSE_NONE, // No mouse operation
258  MOUSE_CHARS, // Selecting characters
259  MOUSE_WORDS, // Selecting words
260  MOUSE_LINES, // Selecting lines
261  MOUSE_BLOCK, // Select block
262  MOUSE_SCROLL, // Scrolling
263  MOUSE_DRAG, // Dragging text
264  MOUSE_TRYDRAG // Tentative drag
265  };
266 protected:
267  enum {
268  STYLE_MASK = 0x00FF, // Mask color table
269  STYLE_TEXT = 0x0100, // Draw some content
270  STYLE_SELECTED = 0x0200, // Selected
271  STYLE_CONTROL = 0x0400, // Control character
272  STYLE_HILITE = 0x0800, // Highlighted
273  STYLE_ACTIVE = 0x1000 // Active
274  };
275 public:
276  enum {
277  STYLE_UNDERLINE = 0x0001,
278  STYLE_STRIKEOUT = 0x0002,
279  STYLE_BOLD = 0x0004
280  };
281 private:
282  FXText(const FXText&);
283  FXText& operator=(const FXText&);
284 public:
285  long onPaint(FXObject*,FXSelector,void*);
286  long onBlink(FXObject*,FXSelector,void*);
287  long onFlash(FXObject*,FXSelector,void*);
288  long onFocusIn(FXObject*,FXSelector,void*);
289  long onFocusOut(FXObject*,FXSelector,void*);
290  long onMotion(FXObject*,FXSelector,void*);
291  long onAutoScroll(FXObject*,FXSelector,void*);
292  long onLeftBtnPress(FXObject*,FXSelector,void*);
293  long onLeftBtnRelease(FXObject*,FXSelector,void*);
294  long onMiddleBtnPress(FXObject*,FXSelector,void*);
295  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
296  long onRightBtnPress(FXObject*,FXSelector,void*);
297  long onRightBtnRelease(FXObject*,FXSelector,void*);
298  long onKeyPress(FXObject*,FXSelector,void*);
299  long onKeyRelease(FXObject*,FXSelector,void*);
300  long onUngrabbed(FXObject*,FXSelector,void*);
301  long onBeginDrag(FXObject*,FXSelector,void*);
302  long onEndDrag(FXObject*,FXSelector,void*);
303  long onDragged(FXObject*,FXSelector,void*);
304  long onDNDEnter(FXObject*,FXSelector,void*);
305  long onDNDLeave(FXObject*,FXSelector,void*);
306  long onDNDMotion(FXObject*,FXSelector,void*);
307  long onDNDDrop(FXObject*,FXSelector,void*);
308  long onDNDRequest(FXObject*,FXSelector,void*);
309  long onSelectionLost(FXObject*,FXSelector,void*);
310  long onSelectionGained(FXObject*,FXSelector,void*);
311  long onSelectionRequest(FXObject*,FXSelector,void* ptr);
312  long onClipboardLost(FXObject*,FXSelector,void*);
313  long onClipboardGained(FXObject*,FXSelector,void*);
314  long onClipboardRequest(FXObject*,FXSelector,void*);
315  long onCmdSetTip(FXObject*,FXSelector,void*);
316  long onCmdGetTip(FXObject*,FXSelector,void*);
317  long onCmdSetHelp(FXObject*,FXSelector,void*);
318  long onCmdGetHelp(FXObject*,FXSelector,void*);
319  long onQueryTip(FXObject*,FXSelector,void*);
320  long onQueryHelp(FXObject*,FXSelector,void*);
321  long onUpdIsEditable(FXObject*,FXSelector,void*);
322  long onUpdHaveSelection(FXObject*,FXSelector,void*);
323  long onUpdHaveEditableSelection(FXObject*,FXSelector,void*);
324  long onIMEStart(FXObject*,FXSelector,void*);
325 
326  // Value access
327  long onCmdSetStringValue(FXObject*,FXSelector,void*);
328  long onCmdGetStringValue(FXObject*,FXSelector,void*);
329 
330  // Cursor movement
331  long onCmdCursorTop(FXObject*,FXSelector,void*);
332  long onCmdCursorBottom(FXObject*,FXSelector,void*);
333  long onCmdCursorHome(FXObject*,FXSelector,void*);
334  long onCmdCursorEnd(FXObject*,FXSelector,void*);
335  long onCmdCursorRight(FXObject*,FXSelector,void*);
336  long onCmdCursorLeft(FXObject*,FXSelector,void*);
337  long onCmdCursorUp(FXObject*,FXSelector,void*);
338  long onCmdCursorDown(FXObject*,FXSelector,void*);
339  long onCmdCursorPageUp(FXObject*,FXSelector,void*);
340  long onCmdCursorPageDown(FXObject*,FXSelector,void*);
341  long onCmdCursorWordLeft(FXObject*,FXSelector,void*);
342  long onCmdCursorWordRight(FXObject*,FXSelector,void*);
343 
344  // Cursor drag movement
345  long onCmdCursorShiftTop(FXObject*,FXSelector,void*);
346  long onCmdCursorShiftBottom(FXObject*,FXSelector,void*);
347  long onCmdCursorShiftHome(FXObject*,FXSelector,void*);
348  long onCmdCursorShiftEnd(FXObject*,FXSelector,void*);
349  long onCmdCursorShiftRight(FXObject*,FXSelector,void*);
350  long onCmdCursorShiftLeft(FXObject*,FXSelector,void*);
351  long onCmdCursorShiftUp(FXObject*,FXSelector,void*);
352  long onCmdCursorShiftDown(FXObject*,FXSelector,void*);
353  long onCmdCursorShiftPageUp(FXObject*,FXSelector,void*);
354  long onCmdCursorShiftPageDown(FXObject*,FXSelector,void*);
355  long onCmdCursorShiftWordLeft(FXObject*,FXSelector,void*);
356  long onCmdCursorShiftWordRight(FXObject*,FXSelector,void*);
357 
358  // Positioning
359  long onCmdScrollUp(FXObject*,FXSelector,void*);
360  long onCmdScrollDown(FXObject*,FXSelector,void*);
361  long onCmdScrollTop(FXObject*,FXSelector,void*);
362  long onCmdScrollBottom(FXObject*,FXSelector,void*);
363  long onCmdScrollCenter(FXObject*,FXSelector,void*);
364 
365  // Inserting
366  long onCmdInsertString(FXObject*,FXSelector,void*);
367  long onCmdInsertNewline(FXObject*,FXSelector,void*);
368  long onCmdInsertNewlineOnly(FXObject*,FXSelector,void*);
369  long onCmdInsertNewlineIndent(FXObject*,FXSelector,void*);
370  long onCmdInsertTab(FXObject*,FXSelector,void*);
371  long onCmdInsertHardTab(FXObject*,FXSelector,void*);
372  long onCmdInsertSoftTab(FXObject*,FXSelector,void*);
373 
374  // Manipulation Selection
375  long onCmdCutSel(FXObject*,FXSelector,void*);
376  long onCmdCopySel(FXObject*,FXSelector,void*);
377  long onCmdPasteSel(FXObject*,FXSelector,void*);
378  long onCmdDeleteSel(FXObject*,FXSelector,void*);
379  long onCmdReplaceSel(FXObject*,FXSelector,void*);
380  long onCmdPasteMiddle(FXObject*,FXSelector,void*);
381  long onCmdSelectChar(FXObject*,FXSelector,void*);
382  long onCmdSelectWord(FXObject*,FXSelector,void*);
383  long onCmdSelectLine(FXObject*,FXSelector,void*);
384  long onCmdSelectMatching(FXObject*,FXSelector,void*);
385  long onCmdSelectBlock(FXObject*,FXSelector,void*);
386  long onCmdSelectAll(FXObject*,FXSelector,void*);
387  long onCmdDeselectAll(FXObject*,FXSelector,void*);
388 
389  // Deletion
390  long onCmdBackspaceChar(FXObject*,FXSelector,void*);
391  long onCmdBackspaceWord(FXObject*,FXSelector,void*);
392  long onCmdBackspaceBol(FXObject*,FXSelector,void*);
393  long onCmdDeleteChar(FXObject*,FXSelector,void*);
394  long onCmdDeleteWord(FXObject*,FXSelector,void*);
395  long onCmdDeleteEol(FXObject*,FXSelector,void*);
396  long onCmdDeleteAll(FXObject*,FXSelector,void*);
397  long onCmdDeleteLine(FXObject*,FXSelector,void*);
398 
399  // Control commands
400  long onCmdShiftText(FXObject*,FXSelector,void*);
401  long onCmdChangeCase(FXObject*,FXSelector,void*);
402  long onCmdJoinLines(FXObject*,FXSelector,void*);
403  long onCmdBlockBeg(FXObject*,FXSelector,void*);
404  long onCmdBlockEnd(FXObject*,FXSelector,void*);
405  long onCmdGotoMatching(FXObject*,FXSelector,void*);
406  long onCmdCursorRow(FXObject*,FXSelector,void*);
407  long onUpdCursorRow(FXObject*,FXSelector,void*);
408  long onCmdCursorColumn(FXObject*,FXSelector,void*);
409  long onUpdCursorColumn(FXObject*,FXSelector,void*);
410  long onCmdToggleEditable(FXObject*,FXSelector,void*);
411  long onUpdToggleEditable(FXObject*,FXSelector,void*);
412  long onCmdToggleOverstrike(FXObject*,FXSelector,void*);
413  long onUpdToggleOverstrike(FXObject*,FXSelector,void*);
414 public:
415  static const FXchar textDelimiters[];
416 
417 public:
418 
420  enum {
421  SelectNone,
425  SelectLines
426  };
427 
428 public:
429 
430  enum {
431  ID_CURSOR_TOP=FXScrollArea::ID_LAST,
432  ID_CURSOR_BOTTOM,
433  ID_CURSOR_HOME,
434  ID_CURSOR_END,
435  ID_CURSOR_RIGHT,
436  ID_CURSOR_LEFT,
437  ID_CURSOR_UP,
438  ID_CURSOR_DOWN,
439  ID_CURSOR_PAGEUP,
440  ID_CURSOR_PAGEDOWN,
441  ID_CURSOR_WORD_LEFT,
442  ID_CURSOR_WORD_RIGHT,
443  ID_CURSOR_SHIFT_TOP,
444  ID_CURSOR_SHIFT_BOTTOM,
445  ID_CURSOR_SHIFT_HOME,
446  ID_CURSOR_SHIFT_END,
447  ID_CURSOR_SHIFT_UP,
448  ID_CURSOR_SHIFT_DOWN,
449  ID_CURSOR_SHIFT_LEFT,
450  ID_CURSOR_SHIFT_RIGHT,
451  ID_CURSOR_SHIFT_PAGEUP,
452  ID_CURSOR_SHIFT_PAGEDOWN,
453  ID_CURSOR_SHIFT_WORD_LEFT,
454  ID_CURSOR_SHIFT_WORD_RIGHT,
455  ID_SCROLL_UP,
456  ID_SCROLL_DOWN,
457  ID_SCROLL_TOP,
458  ID_SCROLL_BOTTOM,
459  ID_SCROLL_CENTER,
460  ID_INSERT_STRING,
461  ID_INSERT_NEWLINE,
462  ID_INSERT_NEWLINE_ONLY,
463  ID_INSERT_NEWLINE_INDENT,
464  ID_INSERT_TAB,
465  ID_INSERT_HARDTAB,
466  ID_INSERT_SOFTTAB,
467  ID_CUT_SEL,
468  ID_COPY_SEL,
469  ID_DELETE_SEL,
470  ID_REPLACE_SEL,
471  ID_PASTE_SEL,
472  ID_PASTE_MIDDLE,
473  ID_SELECT_CHAR,
474  ID_SELECT_WORD,
475  ID_SELECT_LINE,
476  ID_SELECT_ALL,
477  ID_SELECT_MATCHING,
478  ID_SELECT_BRACE,
479  ID_SELECT_BRACK,
480  ID_SELECT_PAREN,
481  ID_SELECT_ANG,
482  ID_DESELECT_ALL,
483  ID_BACKSPACE_CHAR,
484  ID_BACKSPACE_WORD,
485  ID_BACKSPACE_BOL,
486  ID_DELETE_CHAR,
487  ID_DELETE_WORD,
488  ID_DELETE_EOL,
489  ID_DELETE_ALL,
490  ID_DELETE_LINE,
491  ID_TOGGLE_EDITABLE,
492  ID_TOGGLE_OVERSTRIKE,
493  ID_CURSOR_ROW,
494  ID_CURSOR_COLUMN,
495  ID_CLEAN_INDENT,
496  ID_JOIN_LINES,
497  ID_SHIFT_LEFT,
498  ID_SHIFT_RIGHT,
499  ID_SHIFT_TABLEFT,
500  ID_SHIFT_TABRIGHT,
501  ID_UPPER_CASE,
502  ID_LOWER_CASE,
503  ID_GOTO_MATCHING,
504  ID_LEFT_BRACE,
505  ID_LEFT_BRACK,
506  ID_LEFT_PAREN,
507  ID_LEFT_ANG,
508  ID_RIGHT_BRACE,
509  ID_RIGHT_BRACK,
510  ID_RIGHT_PAREN,
511  ID_RIGHT_ANG,
512  ID_BLINK,
513  ID_FLASH,
514  ID_LAST
515  };
516 
517 public:
518 
520  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);
521 
523  virtual void create();
524 
526  virtual void detach();
527 
529  virtual FXint getContentWidth();
530 
532  virtual FXint getContentHeight();
533 
535  virtual FXint getVisibleX() const;
536 
538  virtual FXint getVisibleY() const;
539 
541  virtual FXint getVisibleWidth() const;
542 
544  virtual FXint getVisibleHeight() const;
545 
547  virtual FXint getDefaultWidth();
548 
550  virtual FXint getDefaultHeight();
551 
553  virtual void layout();
554 
556  virtual void enable();
557 
559  virtual void disable();
560 
562  virtual void recalc();
563 
565  virtual FXbool canFocus() const;
566 
568  virtual void setFocus();
569 
571  virtual void killFocus();
572 
574  void setMarginTop(FXint pt);
575 
577  FXint getMarginTop() const { return margintop; }
578 
580  void setMarginBottom(FXint pb);
581 
583  FXint getMarginBottom() const { return marginbottom; }
584 
586  void setMarginLeft(FXint pl);
587 
589  FXint getMarginLeft() const { return marginleft; }
590 
592  void setMarginRight(FXint pr);
593 
595  FXint getMarginRight() const { return marginright; }
596 
598  FXint getWrapColumns() const { return wrapcolumns; }
599 
601  void setWrapColumns(FXint cols);
602 
604  FXint getTabColumns() const { return tabcolumns; }
605 
607  void setTabColumns(FXint cols);
608 
610  FXint getBarColumns() const { return barcolumns; }
611 
613  void setBarColumns(FXint cols);
614 
616  FXbool isModified() const { return modified; }
617 
619  void setModified(FXbool mod=true){ modified=mod; }
620 
622  void setEditable(FXbool edit=true);
623 
625  FXbool isEditable() const;
626 
628  void setOverstrike(FXbool over=true);
629 
631  FXbool isOverstrike() const;
632 
634  FXbool setStyled(FXbool styled=true);
635 
637  FXbool isStyled() const { return (sbuffer!=NULL); }
638 
640  void setDelimiters(const FXchar* delims=textDelimiters){ delimiters=delims; }
641 
643  const FXchar* getDelimiters() const { return delimiters; }
644 
646  void setFont(FXFont* fnt);
647 
649  FXFont* getFont() const { return font; }
650 
652  void setTextColor(FXColor clr);
653 
655  FXColor getTextColor() const { return textColor; }
656 
658  void setSelBackColor(FXColor clr);
659 
661  FXColor getSelBackColor() const { return selbackColor; }
662 
664  void setSelTextColor(FXColor clr);
665 
667  FXColor getSelTextColor() const { return seltextColor; }
668 
670  void setHiliteTextColor(FXColor clr);
671 
673  FXColor getHiliteTextColor() const { return hilitetextColor; }
674 
676  void setHiliteBackColor(FXColor clr);
677 
679  FXColor getHiliteBackColor() const { return hilitebackColor; }
680 
682  void setActiveBackColor(FXColor clr);
683 
685  FXColor getActiveBackColor() const { return activebackColor; }
686 
688  void setCursorColor(FXColor clr);
689 
691  FXColor getCursorColor() const { return cursorColor; }
692 
694  void setNumberColor(FXColor clr);
695 
697  FXColor getNumberColor() const { return numberColor; }
698 
700  void setBarColor(FXColor clr);
701 
703  FXColor getBarColor() const { return barColor; }
704 
706  void setHelpText(const FXString& text){ help=text; }
707 
709  FXString getHelpText() const { return help; }
710 
712  void setTipText(const FXString& text){ tip=text; }
713 
715  FXString getTipText() const { return tip; }
716 
718  FXint getByte(FXint pos) const;
719 
721  FXwchar getChar(FXint pos) const;
722 
724  FXint getCharLen(FXint pos) const;
725 
727  FXint getStyle(FXint pos) const;
728 
730  FXint getLength() const { return length; }
731 
733  FXint getNumRows() const { return nrows; }
734 
736  FXString getText() const;
737 
739  FXString getSelectedText() const;
740 
742  void getText(FXchar* text,FXint n) const;
743  void getText(FXString& text) const;
744 
746  virtual void setText(const FXchar* text,FXint n,FXbool notify=false);
747  virtual void setText(const FXString& text,FXbool notify=false);
748 
750  virtual void setStyledText(const FXchar* text,FXint n,FXint style=0,FXbool notify=false);
751  virtual void setStyledText(const FXString& text,FXint style=0,FXbool notify=false);
752 
754  virtual void replaceText(FXint pos,FXint m,const FXchar *text,FXint n,FXbool notify=false);
755  virtual void replaceText(FXint pos,FXint m,const FXString& text,FXbool notify=false);
756 
758  virtual void replaceStyledText(FXint pos,FXint m,const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
759  virtual void replaceStyledText(FXint pos,FXint m,const FXString& text,FXint style=0,FXbool notify=false);
760 
762  virtual void appendText(const FXchar *text,FXint n,FXbool notify=false);
763  virtual void appendText(const FXString& text,FXbool notify=false);
764 
766  virtual void appendStyledText(const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
767  virtual void appendStyledText(const FXString& text,FXint style=0,FXbool notify=false);
768 
770  virtual void insertText(FXint pos,const FXchar *text,FXint n,FXbool notify=false);
771  virtual void insertText(FXint pos,const FXString& text,FXbool notify=false);
772 
774  virtual void insertStyledText(FXint pos,const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
775  virtual void insertStyledText(FXint pos,const FXString& text,FXint style=0,FXbool notify=false);
776 
778  virtual void removeText(FXint pos,FXint n,FXbool notify=false);
779 
781  virtual void clearText(FXbool notify=false);
782 
784  virtual void changeStyle(FXint pos,FXint n,FXint style);
785 
787  virtual void changeStyle(FXint pos,const FXchar* style,FXint n);
788  virtual void changeStyle(FXint pos,const FXString& style);
789 
791  void extractText(FXchar *text,FXint pos,FXint n) const;
792  void extractText(FXString& text,FXint pos,FXint n) const;
793 
795  void extractStyle(FXchar *style,FXint pos,FXint n) const;
796  void extractStyle(FXString& text,FXint pos,FXint n) const;
797 
799  FXint shiftText(FXint start,FXint end,FXint amount,FXbool notify=false);
800 
813  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);
814 
815 
817  FXint getPosAt(FXint x,FXint y) const;
818 
820  FXint getPosContaining(FXint x,FXint y) const;
821 
823  FXint getXOfPos(FXint pos) const;
824 
826  FXint getYOfPos(FXint pos) const;
827 
836  FXint getRowAndColumn(FXint x,FXint y,FXint& row,FXint& col) const;
837 
839  FXint getXOfRowAndColumn(FXint row,FXint col) const;
840 
842  FXint getYOfRowAndColumn(FXint row,FXint col) const;
843 
848  FXint countCols(FXint start,FXint end) const;
849 
854  FXint countRows(FXint start,FXint end) const;
855 
857  FXint countLines(FXint start,FXint end) const;
858 
860  FXint lineStart(FXint pos) const;
861 
863  FXint lineEnd(FXint pos) const;
864 
866  FXint nextLine(FXint pos,FXint nl=1) const;
867 
869  FXint prevLine(FXint pos,FXint nl=1) const;
870 
872  FXint rowStart(FXint pos) const;
873 
875  FXint rowEnd(FXint pos) const;
876 
878  FXint nextRow(FXint pos,FXint nr=1) const;
879 
881  FXint prevRow(FXint pos,FXint nr=1) const;
882 
884  FXint leftWord(FXint pos) const;
885 
887  FXint rightWord(FXint pos) const;
888 
890  FXint wordStart(FXint pos) const;
891 
893  FXint wordEnd(FXint pos) const;
894 
896  FXint validPos(FXint pos) const;
897 
899  FXint dec(FXint pos) const;
900 
902  FXint inc(FXint pos) const;
903 
905  void setTopLine(FXint pos);
906 
908  FXint getTopLine() const;
909 
911  void setBottomLine(FXint pos);
912 
914  FXint getBottomLine() const;
915 
917  void setCenterLine(FXint pos);
918 
920  virtual FXbool selectAll(FXbool notify=false);
921 
923  virtual FXbool setSelection(FXint pos,FXint len,FXbool notify=false);
924 
926  virtual FXbool extendSelection(FXint pos,FXuint sel=SelectChars,FXbool notify=false);
927 
929  virtual FXbool setBlockSelection(FXint trow,FXint lcol,FXint brow,FXint rcol,FXbool notify=false);
930 
932  virtual FXbool extendBlockSelection(FXint row,FXint col,FXbool notify=false);
933 
935  virtual FXbool killSelection(FXbool notify=false);
936 
938  FXbool copySelection();
939 
941  FXbool cutSelection(FXbool notify=false);
942 
944  FXbool deleteSelection(FXbool notify=false);
945 
947  FXbool pasteSelection(FXbool notify=false);
948 
950  FXbool pasteClipboard(FXbool notify=false);
951 
953  FXbool replaceSelection(const FXchar *text,FXint n,FXbool notify=false);
954 
956  FXbool replaceSelection(const FXString& text,FXbool notify=false);
957 
959  void enterText(const FXchar *text,FXint n,FXbool notify=false);
960 
962  void enterText(const FXString& text,FXbool notify=false);
963 
965  FXbool isPosSelected(FXint pos) const;
966 
968  FXbool isPosVisible(FXint pos) const;
969 
971  void makePositionVisible(FXint pos);
972 
974  FXbool setHighlight(FXint start,FXint len);
975 
977  FXbool killHighlight();
978 
980  virtual void setCursorPos(FXint pos,FXbool notify=false);
981 
983  FXint getCursorPos() const { return cursorpos; }
984 
986  void setCursorRowColumn(FXint row,FXint col,FXbool notify=false);
987 
989  void setCursorRow(FXint row,FXbool notify=false);
990 
992  FXint getCursorRow() const { return cursorrow; }
993 
995  void setCursorColumn(FXint col,FXbool notify=false);
996 
998  FXint getCursorColumn() const { return cursorcol; }
999 
1001  void moveCursor(FXint pos,FXbool notify=false);
1002 
1004  void moveCursorAndSelect(FXint pos,FXuint sel,FXbool notify=false);
1005 
1007  void setAnchorPos(FXint pos);
1008 
1010  FXint getAnchorPos() const { return anchorpos; }
1011 
1013  FXint getSelStartPos() const { return select.startpos; }
1014 
1016  FXint getSelEndPos() const { return select.endpos; }
1017 
1019  FXint getSelStartColumn() const { return select.startcol; }
1020 
1022  FXint getSelEndColumn() const { return select.endcol; }
1023 
1025  void setTextStyle(FXuint style);
1026 
1028  FXuint getTextStyle() const;
1029 
1035  void setVisibleRows(FXint rows);
1036 
1038  FXint getVisibleRows() const { return vrows; }
1039 
1045  void setVisibleColumns(FXint cols);
1046 
1048  FXint getVisibleColumns() const { return vcols; }
1049 
1058  void setHiliteMatchTime(FXTime t){ matchtime=t; }
1059 
1063  FXTime getHiliteMatchTime() const { return matchtime; }
1064 
1072  void setHiliteStyles(FXHiliteStyle* styles);
1073 
1077  FXHiliteStyle* getHiliteStyles() const { return hilitestyles; }
1078 
1080  virtual void save(FXStream& store) const;
1081 
1083  virtual void load(FXStream& store);
1084 
1086  virtual ~FXText();
1087  };
1088 
1089 }
1090 
1091 #endif

Copyright © 1997-2016 Jeroen van der Zijp