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,2018 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 anchorrow; // Anchor row
172  FXint anchorcol; // Anchor column (kept inside text)
173  FXint anchorvcol; // Unconstrained anchor column
174  FXint cursorpos; // Cursor position
175  FXint cursorrow; // Cursor row
176  FXint cursorcol; // Cursor column (kept inside text)
177  FXint cursorvcol; // Unconstrained cursor column
178  FXint prefcol; // Preferred cursor column
179  FXint margintop; // Margins top
180  FXint marginbottom; // Margin bottom
181  FXint marginleft; // Margin left
182  FXint marginright; // Margin right
183  FXint wrapwidth; // Wrap width in pixels
184  FXint wrapcolumns; // Wrap columns
185  FXint tabwidth; // Tab width in pixels
186  FXint tabcolumns; // Tab columns
187  FXint barwidth; // Line number width
188  FXint barcolumns; // Line number columns
189  FXFont *font; // Text font
190  FXColor textColor; // Normal text color
191  FXColor selbackColor; // Select background color
192  FXColor seltextColor; // Select text color
193  FXColor hilitebackColor; // Highlight background color
194  FXColor hilitetextColor; // Highlight text color
195  FXColor activebackColor; // Background color for active line
196  FXColor numberColor; // Line number color
197  FXColor cursorColor; // Cursor color
198  FXColor barColor; // Bar background color
199  FXint textWidth; // Total width of all text
200  FXint textHeight; // Total height of all text
201  const FXchar *delimiters; // Delimiters
202  FXString clipped; // Clipped text
203  FXint vrows; // Default visible rows
204  FXint vcols; // Default visible columns
205  FXString help; // Status line help
206  FXString tip; // Tooltip
207  FXHiliteStyle *hilitestyles; // Style definitions
208  FXuint blink; // Next cursor blink state
209  FXTime matchtime; // Match time (ns)
210  FXint grabx; // Grab point x
211  FXint graby; // Grab point y
212  FXuchar mode; // Mode widget is in
213  FXbool modified; // User has modified text
214 protected:
215  FXText();
216  void movegap(FXint pos);
217  void sizegap(FXint sz);
218  void squeezegap();
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 n);
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 m,const FXchar *text,FXint n,FXint style);
250  void updateRows(FXint startrow,FXint endrow) const;
251  void updateRange(FXint startpos,FXint endpos) const;
252  FXbool deletePendingSelection(FXbool notify);
253  FXint shiftText(FXint startpos,FXint endpos,FXint shift,FXbool notify);
254  FXint caseShift(FXint startpos,FXint endpos,FXint upper,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  STYLE_INSERT = 0x2000 // Column insert
275  };
276 public:
277  enum {
278  STYLE_UNDERLINE = 0x0001,
279  STYLE_STRIKEOUT = 0x0002,
280  STYLE_BOLD = 0x0004
281  };
282 private:
283  FXText(const FXText&);
284  FXText& operator=(const FXText&);
285 public:
286  long onPaint(FXObject*,FXSelector,void*);
287  long onEnter(FXObject*,FXSelector,void*);
288  long onLeave(FXObject*,FXSelector,void*);
289  long onBlink(FXObject*,FXSelector,void*);
290  long onFlash(FXObject*,FXSelector,void*);
291  long onFocusIn(FXObject*,FXSelector,void*);
292  long onFocusOut(FXObject*,FXSelector,void*);
293  long onMotion(FXObject*,FXSelector,void*);
294  long onAutoScroll(FXObject*,FXSelector,void*);
295  long onLeftBtnPress(FXObject*,FXSelector,void*);
296  long onLeftBtnRelease(FXObject*,FXSelector,void*);
297  long onMiddleBtnPress(FXObject*,FXSelector,void*);
298  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
299  long onRightBtnPress(FXObject*,FXSelector,void*);
300  long onRightBtnRelease(FXObject*,FXSelector,void*);
301  long onKeyPress(FXObject*,FXSelector,void*);
302  long onKeyRelease(FXObject*,FXSelector,void*);
303  long onUngrabbed(FXObject*,FXSelector,void*);
304  long onBeginDrag(FXObject*,FXSelector,void*);
305  long onEndDrag(FXObject*,FXSelector,void*);
306  long onDragged(FXObject*,FXSelector,void*);
307  long onDNDEnter(FXObject*,FXSelector,void*);
308  long onDNDLeave(FXObject*,FXSelector,void*);
309  long onDNDMotion(FXObject*,FXSelector,void*);
310  long onDNDDrop(FXObject*,FXSelector,void*);
311  long onDNDRequest(FXObject*,FXSelector,void*);
312  long onSelectionLost(FXObject*,FXSelector,void*);
313  long onSelectionGained(FXObject*,FXSelector,void*);
314  long onSelectionRequest(FXObject*,FXSelector,void* ptr);
315  long onClipboardLost(FXObject*,FXSelector,void*);
316  long onClipboardGained(FXObject*,FXSelector,void*);
317  long onClipboardRequest(FXObject*,FXSelector,void*);
318  long onCmdSetTip(FXObject*,FXSelector,void*);
319  long onCmdGetTip(FXObject*,FXSelector,void*);
320  long onCmdSetHelp(FXObject*,FXSelector,void*);
321  long onCmdGetHelp(FXObject*,FXSelector,void*);
322  long onQueryTip(FXObject*,FXSelector,void*);
323  long onQueryHelp(FXObject*,FXSelector,void*);
324  long onUpdIsEditable(FXObject*,FXSelector,void*);
325  long onUpdHaveSelection(FXObject*,FXSelector,void*);
326  long onUpdHaveEditableSelection(FXObject*,FXSelector,void*);
327  long onIMEStart(FXObject*,FXSelector,void*);
328  long onTipTimer(FXObject*,FXSelector,void*);
329 
330  // Value access
331  long onCmdSetStringValue(FXObject*,FXSelector,void*);
332  long onCmdGetStringValue(FXObject*,FXSelector,void*);
333 
334  // Cursor movement
335  long onCmdCursorTop(FXObject*,FXSelector,void*);
336  long onCmdCursorBottom(FXObject*,FXSelector,void*);
337  long onCmdCursorHome(FXObject*,FXSelector,void*);
338  long onCmdCursorEnd(FXObject*,FXSelector,void*);
339  long onCmdCursorRight(FXObject*,FXSelector,void*);
340  long onCmdCursorLeft(FXObject*,FXSelector,void*);
341  long onCmdCursorUp(FXObject*,FXSelector,void*);
342  long onCmdCursorDown(FXObject*,FXSelector,void*);
343  long onCmdCursorPageUp(FXObject*,FXSelector,void*);
344  long onCmdCursorPageDown(FXObject*,FXSelector,void*);
345  long onCmdCursorWordLeft(FXObject*,FXSelector,void*);
346  long onCmdCursorWordRight(FXObject*,FXSelector,void*);
347 
348  // Cursor drag movement
349  long onCmdCursorShiftTop(FXObject*,FXSelector,void*);
350  long onCmdCursorShiftBottom(FXObject*,FXSelector,void*);
351  long onCmdCursorShiftHome(FXObject*,FXSelector,void*);
352  long onCmdCursorShiftEnd(FXObject*,FXSelector,void*);
353  long onCmdCursorShiftRight(FXObject*,FXSelector,void*);
354  long onCmdCursorShiftLeft(FXObject*,FXSelector,void*);
355  long onCmdCursorShiftUp(FXObject*,FXSelector,void*);
356  long onCmdCursorShiftDown(FXObject*,FXSelector,void*);
357  long onCmdCursorShiftPageUp(FXObject*,FXSelector,void*);
358  long onCmdCursorShiftPageDown(FXObject*,FXSelector,void*);
359  long onCmdCursorShiftWordLeft(FXObject*,FXSelector,void*);
360  long onCmdCursorShiftWordRight(FXObject*,FXSelector,void*);
361 
362  // Positioning
363  long onCmdScrollUp(FXObject*,FXSelector,void*);
364  long onCmdScrollDown(FXObject*,FXSelector,void*);
365  long onCmdScrollTop(FXObject*,FXSelector,void*);
366  long onCmdScrollBottom(FXObject*,FXSelector,void*);
367  long onCmdScrollCenter(FXObject*,FXSelector,void*);
368 
369  // Inserting
370  long onCmdInsertString(FXObject*,FXSelector,void*);
371  long onCmdInsertNewline(FXObject*,FXSelector,void*);
372  long onCmdInsertNewlineOnly(FXObject*,FXSelector,void*);
373  long onCmdInsertNewlineIndent(FXObject*,FXSelector,void*);
374  long onCmdInsertTab(FXObject*,FXSelector,void*);
375  long onCmdInsertHardTab(FXObject*,FXSelector,void*);
376  long onCmdInsertSoftTab(FXObject*,FXSelector,void*);
377 
378  // Manipulation Selection
379  long onCmdCutSel(FXObject*,FXSelector,void*);
380  long onCmdCopySel(FXObject*,FXSelector,void*);
381  long onCmdPasteSel(FXObject*,FXSelector,void*);
382  long onCmdPasteMiddle(FXObject*,FXSelector,void*);
383  long onCmdDeleteSel(FXObject*,FXSelector,void*);
384  long onCmdReplaceSel(FXObject*,FXSelector,void*);
385  long onCmdSelectChar(FXObject*,FXSelector,void*);
386  long onCmdSelectWord(FXObject*,FXSelector,void*);
387  long onCmdSelectLine(FXObject*,FXSelector,void*);
388  long onCmdSelectMatching(FXObject*,FXSelector,void*);
389  long onCmdSelectBlock(FXObject*,FXSelector,void*);
390  long onCmdSelectAll(FXObject*,FXSelector,void*);
391  long onCmdDeselectAll(FXObject*,FXSelector,void*);
392 
393  // Deletion
394  long onCmdBackspaceChar(FXObject*,FXSelector,void*);
395  long onCmdBackspaceWord(FXObject*,FXSelector,void*);
396  long onCmdBackspaceBol(FXObject*,FXSelector,void*);
397  long onCmdDeleteChar(FXObject*,FXSelector,void*);
398  long onCmdDeleteWord(FXObject*,FXSelector,void*);
399  long onCmdDeleteEol(FXObject*,FXSelector,void*);
400  long onCmdDeleteAll(FXObject*,FXSelector,void*);
401  long onCmdDeleteLine(FXObject*,FXSelector,void*);
402 
403  // Control commands
404  long onCmdShiftText(FXObject*,FXSelector,void*);
405  long onCmdChangeCase(FXObject*,FXSelector,void*);
406  long onCmdCopyLine(FXObject*,FXSelector,void*);
407  long onCmdMoveLineUp(FXObject*,FXSelector,void*);
408  long onCmdMoveLineDown(FXObject*,FXSelector,void*);
409  long onCmdJoinLines(FXObject*,FXSelector,void*);
410  long onCmdBlockBeg(FXObject*,FXSelector,void*);
411  long onCmdBlockEnd(FXObject*,FXSelector,void*);
412  long onCmdGotoMatching(FXObject*,FXSelector,void*);
413  long onCmdCursorRow(FXObject*,FXSelector,void*);
414  long onUpdCursorRow(FXObject*,FXSelector,void*);
415  long onCmdCursorColumn(FXObject*,FXSelector,void*);
416  long onUpdCursorColumn(FXObject*,FXSelector,void*);
417  long onCmdToggleEditable(FXObject*,FXSelector,void*);
418  long onUpdToggleEditable(FXObject*,FXSelector,void*);
419  long onCmdToggleOverstrike(FXObject*,FXSelector,void*);
420  long onUpdToggleOverstrike(FXObject*,FXSelector,void*);
421 public:
422  static const FXchar textDelimiters[];
423 
424 public:
425 
427  enum {
428  SelectNone,
432  SelectLines
433  };
434 
435 public:
436 
437  enum {
438  ID_CURSOR_TOP=FXScrollArea::ID_LAST,
439  ID_CURSOR_BOTTOM,
440  ID_CURSOR_HOME,
441  ID_CURSOR_END,
442  ID_CURSOR_RIGHT,
443  ID_CURSOR_LEFT,
444  ID_CURSOR_UP,
445  ID_CURSOR_DOWN,
446  ID_CURSOR_PAGEUP,
447  ID_CURSOR_PAGEDOWN,
448  ID_CURSOR_WORD_LEFT,
449  ID_CURSOR_WORD_RIGHT,
450  ID_CURSOR_SHIFT_TOP,
451  ID_CURSOR_SHIFT_BOTTOM,
452  ID_CURSOR_SHIFT_HOME,
453  ID_CURSOR_SHIFT_END,
454  ID_CURSOR_SHIFT_UP,
455  ID_CURSOR_SHIFT_DOWN,
456  ID_CURSOR_SHIFT_LEFT,
457  ID_CURSOR_SHIFT_RIGHT,
458  ID_CURSOR_SHIFT_PAGEUP,
459  ID_CURSOR_SHIFT_PAGEDOWN,
460  ID_CURSOR_SHIFT_WORD_LEFT,
461  ID_CURSOR_SHIFT_WORD_RIGHT,
462  ID_SCROLL_UP,
463  ID_SCROLL_DOWN,
464  ID_SCROLL_TOP,
465  ID_SCROLL_BOTTOM,
466  ID_SCROLL_CENTER,
467  ID_INSERT_STRING,
468  ID_INSERT_NEWLINE,
469  ID_INSERT_NEWLINE_ONLY,
470  ID_INSERT_NEWLINE_INDENT,
471  ID_INSERT_TAB,
472  ID_INSERT_HARDTAB,
473  ID_INSERT_SOFTTAB,
474  ID_CUT_SEL,
475  ID_COPY_SEL,
476  ID_DELETE_SEL,
477  ID_REPLACE_SEL,
478  ID_PASTE_SEL,
479  ID_PASTE_MIDDLE,
480  ID_SELECT_CHAR,
481  ID_SELECT_WORD,
482  ID_SELECT_LINE,
483  ID_SELECT_ALL,
484  ID_SELECT_MATCHING,
485  ID_SELECT_BRACE,
486  ID_SELECT_BRACK,
487  ID_SELECT_PAREN,
488  ID_SELECT_ANG,
489  ID_DESELECT_ALL,
490  ID_BACKSPACE_CHAR,
491  ID_BACKSPACE_WORD,
492  ID_BACKSPACE_BOL,
493  ID_DELETE_CHAR,
494  ID_DELETE_WORD,
495  ID_DELETE_EOL,
496  ID_DELETE_ALL,
497  ID_DELETE_LINE,
498  ID_TOGGLE_EDITABLE,
499  ID_TOGGLE_OVERSTRIKE,
500  ID_CURSOR_ROW,
501  ID_CURSOR_COLUMN,
502  ID_JOIN_LINES,
503  ID_SHIFT_LEFT,
504  ID_SHIFT_RIGHT,
505  ID_SHIFT_TABLEFT,
506  ID_SHIFT_TABRIGHT,
507  ID_CLEAN_INDENT,
508  ID_COPY_LINE,
509  ID_MOVE_LINE_UP,
510  ID_MOVE_LINE_DOWN,
511  ID_UPPER_CASE,
512  ID_LOWER_CASE,
513  ID_GOTO_MATCHING,
514  ID_LEFT_BRACE,
515  ID_LEFT_BRACK,
516  ID_LEFT_PAREN,
517  ID_LEFT_ANG,
518  ID_RIGHT_BRACE,
519  ID_RIGHT_BRACK,
520  ID_RIGHT_PAREN,
521  ID_RIGHT_ANG,
522  ID_BLINK,
523  ID_FLASH,
524  ID_LAST
525  };
526 
527 public:
528 
530  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);
531 
533  virtual void create();
534 
536  virtual void detach();
537 
539  virtual FXint getContentWidth();
540 
542  virtual FXint getContentHeight();
543 
545  virtual FXint getVisibleX() const;
546 
548  virtual FXint getVisibleY() const;
549 
551  virtual FXint getVisibleWidth() const;
552 
554  virtual FXint getVisibleHeight() const;
555 
557  virtual FXint getDefaultWidth();
558 
560  virtual FXint getDefaultHeight();
561 
563  virtual void layout();
564 
566  virtual void enable();
567 
569  virtual void disable();
570 
572  virtual void recalc();
573 
575  virtual FXbool canFocus() const;
576 
578  virtual void setFocus();
579 
581  virtual void killFocus();
582 
584  void setMarginTop(FXint pt);
585 
587  FXint getMarginTop() const { return margintop; }
588 
590  void setMarginBottom(FXint pb);
591 
593  FXint getMarginBottom() const { return marginbottom; }
594 
596  void setMarginLeft(FXint pl);
597 
599  FXint getMarginLeft() const { return marginleft; }
600 
602  void setMarginRight(FXint pr);
603 
605  FXint getMarginRight() const { return marginright; }
606 
608  FXint getWrapColumns() const { return wrapcolumns; }
609 
611  void setWrapColumns(FXint cols);
612 
614  FXint getTabColumns() const { return tabcolumns; }
615 
617  void setTabColumns(FXint cols);
618 
620  FXint getBarColumns() const { return barcolumns; }
621 
623  void setBarColumns(FXint cols);
624 
626  FXbool isModified() const { return modified; }
627 
629  void setModified(FXbool mod=true){ modified=mod; }
630 
632  void setEditable(FXbool edit=true);
633 
635  FXbool isEditable() const;
636 
638  void setOverstrike(FXbool over=true);
639 
641  FXbool isOverstrike() const;
642 
644  FXbool setStyled(FXbool styled=true);
645 
647  FXbool isStyled() const { return (sbuffer!=NULL); }
648 
650  void setDelimiters(const FXchar* delims=textDelimiters){ delimiters=delims; }
651 
653  const FXchar* getDelimiters() const { return delimiters; }
654 
656  void setFont(FXFont* fnt);
657 
659  FXFont* getFont() const { return font; }
660 
662  void setTextColor(FXColor clr);
663 
665  FXColor getTextColor() const { return textColor; }
666 
668  void setSelBackColor(FXColor clr);
669 
671  FXColor getSelBackColor() const { return selbackColor; }
672 
674  void setSelTextColor(FXColor clr);
675 
677  FXColor getSelTextColor() const { return seltextColor; }
678 
680  void setHiliteTextColor(FXColor clr);
681 
683  FXColor getHiliteTextColor() const { return hilitetextColor; }
684 
686  void setHiliteBackColor(FXColor clr);
687 
689  FXColor getHiliteBackColor() const { return hilitebackColor; }
690 
692  void setActiveBackColor(FXColor clr);
693 
695  FXColor getActiveBackColor() const { return activebackColor; }
696 
698  void setCursorColor(FXColor clr);
699 
701  FXColor getCursorColor() const { return cursorColor; }
702 
704  void setNumberColor(FXColor clr);
705 
707  FXColor getNumberColor() const { return numberColor; }
708 
710  void setBarColor(FXColor clr);
711 
713  FXColor getBarColor() const { return barColor; }
714 
716  void setHelpText(const FXString& text){ help=text; }
717 
719  FXString getHelpText() const { return help; }
720 
722  void setTipText(const FXString& text){ tip=text; }
723 
725  FXString getTipText() const { return tip; }
726 
728  FXint getByte(FXint pos) const;
729 
731  FXwchar getChar(FXint pos) const;
732 
734  FXint getCharLen(FXint pos) const;
735 
737  FXint getStyle(FXint pos) const;
738 
740  FXint getLength() const { return length; }
741 
743  FXint getNumRows() const { return nrows; }
744 
746  void getText(FXchar* text,FXint n) const;
747 
749  void getText(FXString& text) const;
750 
752  FXString getText() const;
753 
755  FXString getSelectedText() const;
756 
758  virtual FXint setText(const FXchar* text,FXint n,FXbool notify=false);
759  virtual FXint setText(const FXString& text,FXbool notify=false);
760 
762  virtual FXint setStyledText(const FXchar* text,FXint n,FXint style=0,FXbool notify=false);
763  virtual FXint setStyledText(const FXString& text,FXint style=0,FXbool notify=false);
764 
766  virtual FXint replaceText(FXint pos,FXint m,const FXchar *text,FXint n,FXbool notify=false);
767  virtual FXint replaceText(FXint pos,FXint m,const FXString& text,FXbool notify=false);
768 
770  virtual FXint replaceTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXchar *text,FXint n,FXbool notify=false);
771  virtual FXint replaceTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXString& text,FXbool notify=false);
772 
774  virtual FXint replaceStyledText(FXint pos,FXint m,const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
775  virtual FXint replaceStyledText(FXint pos,FXint m,const FXString& text,FXint style=0,FXbool notify=false);
776 
778  virtual FXint replaceTextStyledBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
779  virtual FXint replaceTextStyledBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXString& text,FXint style=0,FXbool notify=false);
780 
782  virtual FXint appendText(const FXchar *text,FXint n,FXbool notify=false);
783  virtual FXint appendText(const FXString& text,FXbool notify=false);
784 
786  virtual FXint appendStyledText(const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
787  virtual FXint appendStyledText(const FXString& text,FXint style=0,FXbool notify=false);
788 
790  virtual FXint insertText(FXint pos,const FXchar *text,FXint n,FXbool notify=false);
791  virtual FXint insertText(FXint pos,const FXString& text,FXbool notify=false);
792 
794  virtual FXint insertStyledText(FXint pos,const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
795  virtual FXint insertStyledText(FXint pos,const FXString& text,FXint style=0,FXbool notify=false);
796 
798  virtual FXint changeStyle(FXint pos,FXint n,FXint style);
799 
801  virtual FXint changeStyle(FXint pos,const FXchar* style,FXint n);
802  virtual FXint changeStyle(FXint pos,const FXString& style);
803 
805  virtual FXint removeText(FXint pos,FXint n,FXbool notify=false);
806 
808  virtual FXint removeTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol,FXbool notify=false);
809 
811  virtual FXint clearText(FXbool notify=false);
812 
814  void extractText(FXchar *text,FXint pos,FXint n) const;
815 
817  void extractText(FXString& text,FXint pos,FXint n) const;
818 
820  FXString extractText(FXint pos,FXint n) const;
821 
823  void extractStyle(FXchar *style,FXint pos,FXint n) const;
824 
826  void extractStyle(FXString& style,FXint pos,FXint n) const;
827 
829  FXString extractStyle(FXint pos,FXint n) const;
830 
832  void extractTextBlock(FXString& text,FXint startpos,FXint endpos,FXint startcol,FXint endcol) const;
833 
835  FXString extractTextBlock(FXint startpos,FXint endpos,FXint startcol,FXint endcol) const;
836 
849  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);
850 
851 
853  FXint getPosAt(FXint x,FXint y) const;
854 
856  FXint getPosContaining(FXint x,FXint y) const;
857 
859  FXint getXOfPos(FXint pos) const;
860 
862  FXint getYOfPos(FXint pos) const;
863 
872  FXint getRowColumnAt(FXint x,FXint y,FXint& row,FXint& col) const;
873 
875  FXint getXOfRowColumn(FXint row,FXint col) const;
876 
878  FXint getYOfRowColumn(FXint row,FXint col) const;
879 
884  FXint countCols(FXint start,FXint end) const;
885 
890  FXint countRows(FXint start,FXint end) const;
891 
893  FXint countLines(FXint start,FXint end) const;
894 
896  FXint lineStart(FXint pos) const;
897 
899  FXint lineEnd(FXint pos) const;
900 
902  FXint nextLine(FXint pos,FXint nl=1) const;
903 
905  FXint prevLine(FXint pos,FXint nl=1) const;
906 
908  FXint rowStart(FXint pos) const;
909 
911  FXint rowEnd(FXint pos) const;
912 
914  FXint nextRow(FXint pos,FXint nr=1) const;
915 
917  FXint prevRow(FXint pos,FXint nr=1) const;
918 
920  FXint leftWord(FXint pos) const;
921 
923  FXint rightWord(FXint pos) const;
924 
926  FXint wordStart(FXint pos) const;
927 
929  FXint wordEnd(FXint pos) const;
930 
932  FXint validPos(FXint pos) const;
933 
935  FXint dec(FXint pos) const;
936 
938  FXint inc(FXint pos) const;
939 
941  void setTopLine(FXint pos);
942 
944  FXint getTopLine() const;
945 
947  void setBottomLine(FXint pos);
948 
950  FXint getBottomLine() const;
951 
953  void setCenterLine(FXint pos);
954 
956  virtual FXbool selectAll(FXbool notify=false);
957 
959  virtual FXbool setSelection(FXint pos,FXint len,FXbool notify=false);
960 
962  virtual FXbool extendSelection(FXint pos,FXuint sel=SelectChars,FXbool notify=false);
963 
965  virtual FXbool setBlockSelection(FXint trow,FXint lcol,FXint brow,FXint rcol,FXbool notify=false);
966 
968  virtual FXbool extendBlockSelection(FXint row,FXint col,FXbool notify=false);
969 
971  virtual FXbool killSelection(FXbool notify=false);
972 
974  FXbool copySelection();
975 
977  FXbool cutSelection(FXbool notify=false);
978 
980  FXbool deleteSelection(FXbool notify=false);
981 
983  FXbool pasteSelection(FXbool notify=false);
984 
986  FXbool pasteClipboard(FXbool notify=false);
987 
989  FXbool replaceSelection(const FXString& text,FXbool notify=false);
990 
992  void enterText(const FXchar *text,FXint n,FXbool notify=false);
993 
995  void enterText(const FXString& text,FXbool notify=false);
996 
998  FXbool isPosSelected(FXint pos) const;
999 
1001  FXbool isPosSelected(FXint pos,FXint col) const;
1002 
1004  FXbool isPosVisible(FXint pos) const;
1005 
1007  void makePositionVisible(FXint pos);
1008 
1010  FXbool setHighlight(FXint start,FXint len);
1011 
1013  FXbool killHighlight();
1014 
1016  virtual void setCursorPos(FXint pos,FXbool notify=false);
1017 
1019  FXint getCursorPos() const { return cursorpos; }
1020 
1022  void setCursorRowColumn(FXint row,FXint col,FXbool notify=false);
1023 
1025  void setCursorRow(FXint row,FXbool notify=false);
1026 
1028  FXint getCursorRow() const { return cursorrow; }
1029 
1031  void setCursorColumn(FXint col,FXbool notify=false);
1032 
1034  FXint getCursorColumn() const { return cursorcol; }
1035 
1037  void setAnchorPos(FXint pos);
1038 
1040  FXint getAnchorPos() const { return anchorpos; }
1041 
1043  void setAnchorRowColumn(FXint row,FXint col);
1044 
1046  FXint getAnchorRow() const { return anchorrow; }
1047 
1049  FXint getAnchorColumn() const { return anchorcol; }
1050 
1052  void moveCursor(FXint pos,FXbool notify=false);
1053 
1055  void moveCursorRowColumn(FXint row,FXint col,FXbool notify=false);
1056 
1058  void moveCursorAndSelect(FXint pos,FXuint sel,FXbool notify=false);
1059 
1061  void moveCursorRowColumnAndSelect(FXint row,FXint col,FXbool notify=false);
1062 
1064  FXint getSelStartPos() const { return select.startpos; }
1065 
1067  FXint getSelEndPos() const { return select.endpos; }
1068 
1070  FXint getSelStartColumn() const { return select.startcol; }
1071 
1073  FXint getSelEndColumn() const { return select.endcol; }
1074 
1076  void setTextStyle(FXuint style);
1077 
1079  FXuint getTextStyle() const;
1080 
1086  void setVisibleRows(FXint rows);
1087 
1089  FXint getVisibleRows() const { return vrows; }
1090 
1096  void setVisibleColumns(FXint cols);
1097 
1099  FXint getVisibleColumns() const { return vcols; }
1100 
1109  void setHiliteMatchTime(FXTime t){ matchtime=t; }
1110 
1114  FXTime getHiliteMatchTime() const { return matchtime; }
1115 
1123  void setHiliteStyles(FXHiliteStyle* styles);
1124 
1128  FXHiliteStyle* getHiliteStyles() const { return hilitestyles; }
1129 
1131  virtual void save(FXStream& store) const;
1132 
1134  virtual void load(FXStream& store);
1135 
1137  virtual ~FXText();
1138  };
1139 
1140 }
1141 
1142 #endif
The text widget provides a multi-line text editing control.
Definition: FXText.h:154
FXint getSelStartColumn() const
Return selection start column.
Definition: FXText.h:1070
void setHelpText(const FXString &text)
Set help text.
Definition: FXText.h:716
FXbool isModified() const
Return true if text was modified.
Definition: FXText.h:626
FXColor selectBackColor
Selected text foreground color.
Definition: FXText.h:49
FXint getSelEndColumn() const
Return selection end column.
Definition: FXText.h:1073
FXint getVisibleRows() const
Return number of visible rows.
Definition: FXText.h:1089
FXint getSelEndPos() const
Return selection end position.
Definition: FXText.h:1067
FXint getTabColumns() const
Return tab columns.
Definition: FXText.h:614
FXColor normalBackColor
Normal text foreground color.
Definition: FXText.h:47
FXint getLength() const
Return length of buffer.
Definition: FXText.h:740
FXColor getBarColor() const
Return bar color.
Definition: FXText.h:713
FXbool isStyled() const
Return true if style buffer.
Definition: FXText.h:647
FXString getHelpText() const
Return help text.
Definition: FXText.h:719
FXint getSelStartPos() const
Return selection start position.
Definition: FXText.h:1064
FXint getCursorRow() const
Return cursor row.
Definition: FXText.h:1028
FXint getMarginBottom() const
Return bottom margin.
Definition: FXText.h:593
void setTipText(const FXString &text)
Set the tool tip message for this text widget.
Definition: FXText.h:722
Highlight style entry.
Definition: FXText.h:45
Base composite.
Definition: FXComposite.h:32
FXint ndel
Position in buffer.
Definition: FXText.h:65
FXint getWrapColumns() const
Return wrap columns.
Definition: FXText.h:608
FXchar * ins
Number characters inserted at position.
Definition: FXText.h:67
FXColor getSelBackColor() const
Return selected background color.
Definition: FXText.h:671
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:78
const FXchar * getDelimiters() const
Return word delimiters.
Definition: FXText.h:653
FXColor getTextColor() const
Return text color.
Definition: FXText.h:665
Select characters.
Definition: FXText.h:430
FXColor getCursorColor() const
Return cursor color.
Definition: FXText.h:701
FXint getMarginTop() const
Return top margin.
Definition: FXText.h:587
FXColor hiliteForeColor
Selected text background color.
Definition: FXText.h:50
Definition: FX4Splitter.h:28
FXColor getSelTextColor() const
Return selected text color.
Definition: FXText.h:677
FXHiliteStyle * getHiliteStyles() const
Return current value of the style table.
Definition: FXText.h:1128
FXint getMarginLeft() const
Return left margin.
Definition: FXText.h:599
Select words.
Definition: FXText.h:431
FXColor getHiliteTextColor() const
Return highlighted text color.
Definition: FXText.h:683
void setModified(FXbool mod=true)
Set modified flag.
Definition: FXText.h:629
FXint getAnchorColumn() const
Return anchor row.
Definition: FXText.h:1049
FXint endpos
Start of selection (begin of first line if block-select)
Definition: FXText.h:79
FXFont * getFont() const
Return text font.
Definition: FXText.h:659
The scroll area widget manages a content area and a viewport area through which the content is viewed...
Definition: FXScrollArea.h:65
void setDelimiters(const FXchar *delims=textDelimiters)
Change delimiters of words.
Definition: FXText.h:650
FXint endcol
Start column, if block-select (actually, indent)
Definition: FXText.h:81
FXint getVisibleColumns() const
Return number of visible columns.
Definition: FXText.h:1099
Text selection data.
Definition: FXText.h:77
Text mutation callback data passed with the SEL_INSERTED, SEL_REPLACED, and SEL_DELETED messages; bot...
Definition: FXText.h:63
FXColor getActiveBackColor() const
Return active background color.
Definition: FXText.h:695
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:104
Window Device Context.
Definition: FXDCWindow.h:48
FXint getCursorPos() const
Return the cursor position.
Definition: FXText.h:1019
Select nothing.
Definition: FXText.h:429
FXint getAnchorRow() const
Return anchor row.
Definition: FXText.h:1046
FXint startcol
End of selection (start of line past last if block-select)
Definition: FXText.h:80
FXint getCursorColumn() const
Return cursor row, i.e. indent position.
Definition: FXText.h:1034
FXTime getHiliteMatchTime() const
Return brace and parenthesis match highlighting time, in nanoseconds.
Definition: FXText.h:1114
FXint getNumRows() const
Return number of rows in buffer.
Definition: FXText.h:743
FXString getTipText() const
Get the tool tip message for this text widget.
Definition: FXText.h:725
FXColor selectForeColor
Normal text background color.
Definition: FXText.h:48
FXColor activeBackColor
Highlight text background color.
Definition: FXText.h:52
FXchar * del
Text inserted at position.
Definition: FXText.h:68
FXint nins
Number characters deleted at position.
Definition: FXText.h:66
FXint getAnchorPos() const
Return the anchor position.
Definition: FXText.h:1040
void setHiliteMatchTime(FXTime t)
Change brace and parenthesis match highlighting time, in nanoseconds.
Definition: FXText.h:1109
FXint getMarginRight() const
Return right margin.
Definition: FXText.h:605
FXColor getNumberColor() const
Return line number color.
Definition: FXText.h:707
Font class.
Definition: FXFont.h:137
FXint getBarColumns() const
Return number of columns used for line numbers.
Definition: FXText.h:620
FXuint style
Active text background color.
Definition: FXText.h:53
FXColor getHiliteBackColor() const
Return highlighted background color.
Definition: FXText.h:689
FXColor hiliteBackColor
Highlight text foreground color.
Definition: FXText.h:51
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2018 Jeroen van der Zijp