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  FXString tabbify(const FXchar* str,FXint len,FXint indent=0,FXint outdent=0,FXint shift=0,FXbool tab=false) const;
254  void extractColumns(FXString& text,FXint startpos,FXint endpos,FXint startcol,FXint endcol);
255  FXint removeColumns(FXint startpos,FXint endpos,FXint startcol,FXint endcol,FXbool notify);
256  void insertColumns(FXint startpos,FXint endpos,FXint startcol,FXint endcol,const FXString& text,FXbool notify);
257  FXint shiftText(FXint startpos,FXint endpos,FXint shift,FXbool notify);
258  FXint caseShift(FXint startpos,FXint endpos,FXint upper,FXbool notify);
259 protected:
260  enum {
261  MOUSE_NONE, // No mouse operation
262  MOUSE_CHARS, // Selecting characters
263  MOUSE_WORDS, // Selecting words
264  MOUSE_LINES, // Selecting lines
265  MOUSE_BLOCK, // Select block
266  MOUSE_SCROLL, // Scrolling
267  MOUSE_DRAG, // Dragging text
268  MOUSE_TRYDRAG // Tentative drag
269  };
270 protected:
271  enum {
272  STYLE_MASK = 0x00FF, // Mask color table
273  STYLE_TEXT = 0x0100, // Draw some content
274  STYLE_SELECTED = 0x0200, // Selected
275  STYLE_CONTROL = 0x0400, // Control character
276  STYLE_HILITE = 0x0800, // Highlighted
277  STYLE_ACTIVE = 0x1000 // Active
278  };
279 public:
280  enum {
281  STYLE_UNDERLINE = 0x0001,
282  STYLE_STRIKEOUT = 0x0002,
283  STYLE_BOLD = 0x0004
284  };
285 private:
286  FXText(const FXText&);
287  FXText& operator=(const FXText&);
288 public:
289  long onPaint(FXObject*,FXSelector,void*);
290  long onEnter(FXObject*,FXSelector,void*);
291  long onLeave(FXObject*,FXSelector,void*);
292  long onBlink(FXObject*,FXSelector,void*);
293  long onFlash(FXObject*,FXSelector,void*);
294  long onFocusIn(FXObject*,FXSelector,void*);
295  long onFocusOut(FXObject*,FXSelector,void*);
296  long onMotion(FXObject*,FXSelector,void*);
297  long onAutoScroll(FXObject*,FXSelector,void*);
298  long onLeftBtnPress(FXObject*,FXSelector,void*);
299  long onLeftBtnRelease(FXObject*,FXSelector,void*);
300  long onMiddleBtnPress(FXObject*,FXSelector,void*);
301  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
302  long onRightBtnPress(FXObject*,FXSelector,void*);
303  long onRightBtnRelease(FXObject*,FXSelector,void*);
304  long onKeyPress(FXObject*,FXSelector,void*);
305  long onKeyRelease(FXObject*,FXSelector,void*);
306  long onUngrabbed(FXObject*,FXSelector,void*);
307  long onBeginDrag(FXObject*,FXSelector,void*);
308  long onEndDrag(FXObject*,FXSelector,void*);
309  long onDragged(FXObject*,FXSelector,void*);
310  long onDNDEnter(FXObject*,FXSelector,void*);
311  long onDNDLeave(FXObject*,FXSelector,void*);
312  long onDNDMotion(FXObject*,FXSelector,void*);
313  long onDNDDrop(FXObject*,FXSelector,void*);
314  long onDNDRequest(FXObject*,FXSelector,void*);
315  long onSelectionLost(FXObject*,FXSelector,void*);
316  long onSelectionGained(FXObject*,FXSelector,void*);
317  long onSelectionRequest(FXObject*,FXSelector,void* ptr);
318  long onClipboardLost(FXObject*,FXSelector,void*);
319  long onClipboardGained(FXObject*,FXSelector,void*);
320  long onClipboardRequest(FXObject*,FXSelector,void*);
321  long onCmdSetTip(FXObject*,FXSelector,void*);
322  long onCmdGetTip(FXObject*,FXSelector,void*);
323  long onCmdSetHelp(FXObject*,FXSelector,void*);
324  long onCmdGetHelp(FXObject*,FXSelector,void*);
325  long onQueryTip(FXObject*,FXSelector,void*);
326  long onQueryHelp(FXObject*,FXSelector,void*);
327  long onUpdIsEditable(FXObject*,FXSelector,void*);
328  long onUpdHaveSelection(FXObject*,FXSelector,void*);
329  long onUpdHaveEditableSelection(FXObject*,FXSelector,void*);
330  long onIMEStart(FXObject*,FXSelector,void*);
331  long onTipTimer(FXObject*,FXSelector,void*);
332 
333  // Value access
334  long onCmdSetStringValue(FXObject*,FXSelector,void*);
335  long onCmdGetStringValue(FXObject*,FXSelector,void*);
336 
337  // Cursor movement
338  long onCmdCursorTop(FXObject*,FXSelector,void*);
339  long onCmdCursorBottom(FXObject*,FXSelector,void*);
340  long onCmdCursorHome(FXObject*,FXSelector,void*);
341  long onCmdCursorEnd(FXObject*,FXSelector,void*);
342  long onCmdCursorRight(FXObject*,FXSelector,void*);
343  long onCmdCursorLeft(FXObject*,FXSelector,void*);
344  long onCmdCursorUp(FXObject*,FXSelector,void*);
345  long onCmdCursorDown(FXObject*,FXSelector,void*);
346  long onCmdCursorPageUp(FXObject*,FXSelector,void*);
347  long onCmdCursorPageDown(FXObject*,FXSelector,void*);
348  long onCmdCursorWordLeft(FXObject*,FXSelector,void*);
349  long onCmdCursorWordRight(FXObject*,FXSelector,void*);
350 
351  // Cursor drag movement
352  long onCmdCursorShiftTop(FXObject*,FXSelector,void*);
353  long onCmdCursorShiftBottom(FXObject*,FXSelector,void*);
354  long onCmdCursorShiftHome(FXObject*,FXSelector,void*);
355  long onCmdCursorShiftEnd(FXObject*,FXSelector,void*);
356  long onCmdCursorShiftRight(FXObject*,FXSelector,void*);
357  long onCmdCursorShiftLeft(FXObject*,FXSelector,void*);
358  long onCmdCursorShiftUp(FXObject*,FXSelector,void*);
359  long onCmdCursorShiftDown(FXObject*,FXSelector,void*);
360  long onCmdCursorShiftPageUp(FXObject*,FXSelector,void*);
361  long onCmdCursorShiftPageDown(FXObject*,FXSelector,void*);
362  long onCmdCursorShiftWordLeft(FXObject*,FXSelector,void*);
363  long onCmdCursorShiftWordRight(FXObject*,FXSelector,void*);
364 
365  // Positioning
366  long onCmdScrollUp(FXObject*,FXSelector,void*);
367  long onCmdScrollDown(FXObject*,FXSelector,void*);
368  long onCmdScrollTop(FXObject*,FXSelector,void*);
369  long onCmdScrollBottom(FXObject*,FXSelector,void*);
370  long onCmdScrollCenter(FXObject*,FXSelector,void*);
371 
372  // Inserting
373  long onCmdInsertString(FXObject*,FXSelector,void*);
374  long onCmdInsertNewline(FXObject*,FXSelector,void*);
375  long onCmdInsertNewlineOnly(FXObject*,FXSelector,void*);
376  long onCmdInsertNewlineIndent(FXObject*,FXSelector,void*);
377  long onCmdInsertTab(FXObject*,FXSelector,void*);
378  long onCmdInsertHardTab(FXObject*,FXSelector,void*);
379  long onCmdInsertSoftTab(FXObject*,FXSelector,void*);
380 
381  // Manipulation Selection
382  long onCmdCutSel(FXObject*,FXSelector,void*);
383  long onCmdCopySel(FXObject*,FXSelector,void*);
384  long onCmdPasteSel(FXObject*,FXSelector,void*);
385  long onCmdPasteMiddle(FXObject*,FXSelector,void*);
386  long onCmdDeleteSel(FXObject*,FXSelector,void*);
387  long onCmdReplaceSel(FXObject*,FXSelector,void*);
388  long onCmdSelectChar(FXObject*,FXSelector,void*);
389  long onCmdSelectWord(FXObject*,FXSelector,void*);
390  long onCmdSelectLine(FXObject*,FXSelector,void*);
391  long onCmdSelectMatching(FXObject*,FXSelector,void*);
392  long onCmdSelectBlock(FXObject*,FXSelector,void*);
393  long onCmdSelectAll(FXObject*,FXSelector,void*);
394  long onCmdDeselectAll(FXObject*,FXSelector,void*);
395 
396  // Deletion
397  long onCmdBackspaceChar(FXObject*,FXSelector,void*);
398  long onCmdBackspaceWord(FXObject*,FXSelector,void*);
399  long onCmdBackspaceBol(FXObject*,FXSelector,void*);
400  long onCmdDeleteChar(FXObject*,FXSelector,void*);
401  long onCmdDeleteWord(FXObject*,FXSelector,void*);
402  long onCmdDeleteEol(FXObject*,FXSelector,void*);
403  long onCmdDeleteAll(FXObject*,FXSelector,void*);
404  long onCmdDeleteLine(FXObject*,FXSelector,void*);
405 
406  // Control commands
407  long onCmdShiftText(FXObject*,FXSelector,void*);
408  long onCmdChangeCase(FXObject*,FXSelector,void*);
409  long onCmdCopyLine(FXObject*,FXSelector,void*);
410  long onCmdMoveLineUp(FXObject*,FXSelector,void*);
411  long onCmdMoveLineDown(FXObject*,FXSelector,void*);
412  long onCmdJoinLines(FXObject*,FXSelector,void*);
413  long onCmdBlockBeg(FXObject*,FXSelector,void*);
414  long onCmdBlockEnd(FXObject*,FXSelector,void*);
415  long onCmdGotoMatching(FXObject*,FXSelector,void*);
416  long onCmdCursorRow(FXObject*,FXSelector,void*);
417  long onUpdCursorRow(FXObject*,FXSelector,void*);
418  long onCmdCursorColumn(FXObject*,FXSelector,void*);
419  long onUpdCursorColumn(FXObject*,FXSelector,void*);
420  long onCmdToggleEditable(FXObject*,FXSelector,void*);
421  long onUpdToggleEditable(FXObject*,FXSelector,void*);
422  long onCmdToggleOverstrike(FXObject*,FXSelector,void*);
423  long onUpdToggleOverstrike(FXObject*,FXSelector,void*);
424 public:
425  static const FXchar textDelimiters[];
426 
427 public:
428 
430  enum {
431  SelectNone,
435  SelectLines
436  };
437 
438 public:
439 
440  enum {
441  ID_CURSOR_TOP=FXScrollArea::ID_LAST,
442  ID_CURSOR_BOTTOM,
443  ID_CURSOR_HOME,
444  ID_CURSOR_END,
445  ID_CURSOR_RIGHT,
446  ID_CURSOR_LEFT,
447  ID_CURSOR_UP,
448  ID_CURSOR_DOWN,
449  ID_CURSOR_PAGEUP,
450  ID_CURSOR_PAGEDOWN,
451  ID_CURSOR_WORD_LEFT,
452  ID_CURSOR_WORD_RIGHT,
453  ID_CURSOR_SHIFT_TOP,
454  ID_CURSOR_SHIFT_BOTTOM,
455  ID_CURSOR_SHIFT_HOME,
456  ID_CURSOR_SHIFT_END,
457  ID_CURSOR_SHIFT_UP,
458  ID_CURSOR_SHIFT_DOWN,
459  ID_CURSOR_SHIFT_LEFT,
460  ID_CURSOR_SHIFT_RIGHT,
461  ID_CURSOR_SHIFT_PAGEUP,
462  ID_CURSOR_SHIFT_PAGEDOWN,
463  ID_CURSOR_SHIFT_WORD_LEFT,
464  ID_CURSOR_SHIFT_WORD_RIGHT,
465  ID_SCROLL_UP,
466  ID_SCROLL_DOWN,
467  ID_SCROLL_TOP,
468  ID_SCROLL_BOTTOM,
469  ID_SCROLL_CENTER,
470  ID_INSERT_STRING,
471  ID_INSERT_NEWLINE,
472  ID_INSERT_NEWLINE_ONLY,
473  ID_INSERT_NEWLINE_INDENT,
474  ID_INSERT_TAB,
475  ID_INSERT_HARDTAB,
476  ID_INSERT_SOFTTAB,
477  ID_CUT_SEL,
478  ID_COPY_SEL,
479  ID_DELETE_SEL,
480  ID_REPLACE_SEL,
481  ID_PASTE_SEL,
482  ID_PASTE_MIDDLE,
483  ID_SELECT_CHAR,
484  ID_SELECT_WORD,
485  ID_SELECT_LINE,
486  ID_SELECT_ALL,
487  ID_SELECT_MATCHING,
488  ID_SELECT_BRACE,
489  ID_SELECT_BRACK,
490  ID_SELECT_PAREN,
491  ID_SELECT_ANG,
492  ID_DESELECT_ALL,
493  ID_BACKSPACE_CHAR,
494  ID_BACKSPACE_WORD,
495  ID_BACKSPACE_BOL,
496  ID_DELETE_CHAR,
497  ID_DELETE_WORD,
498  ID_DELETE_EOL,
499  ID_DELETE_ALL,
500  ID_DELETE_LINE,
501  ID_TOGGLE_EDITABLE,
502  ID_TOGGLE_OVERSTRIKE,
503  ID_CURSOR_ROW,
504  ID_CURSOR_COLUMN,
505  ID_JOIN_LINES,
506  ID_SHIFT_LEFT,
507  ID_SHIFT_RIGHT,
508  ID_SHIFT_TABLEFT,
509  ID_SHIFT_TABRIGHT,
510  ID_CLEAN_INDENT,
511  ID_COPY_LINE,
512  ID_MOVE_LINE_UP,
513  ID_MOVE_LINE_DOWN,
514  ID_UPPER_CASE,
515  ID_LOWER_CASE,
516  ID_GOTO_MATCHING,
517  ID_LEFT_BRACE,
518  ID_LEFT_BRACK,
519  ID_LEFT_PAREN,
520  ID_LEFT_ANG,
521  ID_RIGHT_BRACE,
522  ID_RIGHT_BRACK,
523  ID_RIGHT_PAREN,
524  ID_RIGHT_ANG,
525  ID_BLINK,
526  ID_FLASH,
527  ID_LAST
528  };
529 
530 public:
531 
533  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);
534 
536  virtual void create();
537 
539  virtual void detach();
540 
542  virtual FXint getContentWidth();
543 
545  virtual FXint getContentHeight();
546 
548  virtual FXint getVisibleX() const;
549 
551  virtual FXint getVisibleY() const;
552 
554  virtual FXint getVisibleWidth() const;
555 
557  virtual FXint getVisibleHeight() const;
558 
560  virtual FXint getDefaultWidth();
561 
563  virtual FXint getDefaultHeight();
564 
566  virtual void layout();
567 
569  virtual void enable();
570 
572  virtual void disable();
573 
575  virtual void recalc();
576 
578  virtual FXbool canFocus() const;
579 
581  virtual void setFocus();
582 
584  virtual void killFocus();
585 
587  void setMarginTop(FXint pt);
588 
590  FXint getMarginTop() const { return margintop; }
591 
593  void setMarginBottom(FXint pb);
594 
596  FXint getMarginBottom() const { return marginbottom; }
597 
599  void setMarginLeft(FXint pl);
600 
602  FXint getMarginLeft() const { return marginleft; }
603 
605  void setMarginRight(FXint pr);
606 
608  FXint getMarginRight() const { return marginright; }
609 
611  FXint getWrapColumns() const { return wrapcolumns; }
612 
614  void setWrapColumns(FXint cols);
615 
617  FXint getTabColumns() const { return tabcolumns; }
618 
620  void setTabColumns(FXint cols);
621 
623  FXint getBarColumns() const { return barcolumns; }
624 
626  void setBarColumns(FXint cols);
627 
629  FXbool isModified() const { return modified; }
630 
632  void setModified(FXbool mod=true){ modified=mod; }
633 
635  void setEditable(FXbool edit=true);
636 
638  FXbool isEditable() const;
639 
641  void setOverstrike(FXbool over=true);
642 
644  FXbool isOverstrike() const;
645 
647  FXbool setStyled(FXbool styled=true);
648 
650  FXbool isStyled() const { return (sbuffer!=NULL); }
651 
653  void setDelimiters(const FXchar* delims=textDelimiters){ delimiters=delims; }
654 
656  const FXchar* getDelimiters() const { return delimiters; }
657 
659  void setFont(FXFont* fnt);
660 
662  FXFont* getFont() const { return font; }
663 
665  void setTextColor(FXColor clr);
666 
668  FXColor getTextColor() const { return textColor; }
669 
671  void setSelBackColor(FXColor clr);
672 
674  FXColor getSelBackColor() const { return selbackColor; }
675 
677  void setSelTextColor(FXColor clr);
678 
680  FXColor getSelTextColor() const { return seltextColor; }
681 
683  void setHiliteTextColor(FXColor clr);
684 
686  FXColor getHiliteTextColor() const { return hilitetextColor; }
687 
689  void setHiliteBackColor(FXColor clr);
690 
692  FXColor getHiliteBackColor() const { return hilitebackColor; }
693 
695  void setActiveBackColor(FXColor clr);
696 
698  FXColor getActiveBackColor() const { return activebackColor; }
699 
701  void setCursorColor(FXColor clr);
702 
704  FXColor getCursorColor() const { return cursorColor; }
705 
707  void setNumberColor(FXColor clr);
708 
710  FXColor getNumberColor() const { return numberColor; }
711 
713  void setBarColor(FXColor clr);
714 
716  FXColor getBarColor() const { return barColor; }
717 
719  void setHelpText(const FXString& text){ help=text; }
720 
722  FXString getHelpText() const { return help; }
723 
725  void setTipText(const FXString& text){ tip=text; }
726 
728  FXString getTipText() const { return tip; }
729 
731  FXint getByte(FXint pos) const;
732 
734  FXwchar getChar(FXint pos) const;
735 
737  FXint getCharLen(FXint pos) const;
738 
740  FXint getStyle(FXint pos) const;
741 
743  FXint getLength() const { return length; }
744 
746  FXint getNumRows() const { return nrows; }
747 
749  FXString getText() const;
750 
752  FXString getSelectedText() const;
753 
755  void getText(FXchar* text,FXint n) const;
756  void getText(FXString& text) const;
757 
759  virtual void setText(const FXchar* text,FXint n,FXbool notify=false);
760  virtual void setText(const FXString& text,FXbool notify=false);
761 
763  virtual void setStyledText(const FXchar* text,FXint n,FXint style=0,FXbool notify=false);
764  virtual void setStyledText(const FXString& text,FXint style=0,FXbool notify=false);
765 
767  virtual void replaceText(FXint pos,FXint m,const FXchar *text,FXint n,FXbool notify=false);
768  virtual void replaceText(FXint pos,FXint m,const FXString& text,FXbool notify=false);
769 
771  virtual void replaceStyledText(FXint pos,FXint m,const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
772  virtual void replaceStyledText(FXint pos,FXint m,const FXString& text,FXint style=0,FXbool notify=false);
773 
775  virtual void appendText(const FXchar *text,FXint n,FXbool notify=false);
776  virtual void appendText(const FXString& text,FXbool notify=false);
777 
779  virtual void appendStyledText(const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
780  virtual void appendStyledText(const FXString& text,FXint style=0,FXbool notify=false);
781 
783  virtual void insertText(FXint pos,const FXchar *text,FXint n,FXbool notify=false);
784  virtual void insertText(FXint pos,const FXString& text,FXbool notify=false);
785 
787  virtual void insertStyledText(FXint pos,const FXchar *text,FXint n,FXint style=0,FXbool notify=false);
788  virtual void insertStyledText(FXint pos,const FXString& text,FXint style=0,FXbool notify=false);
789 
791  virtual void removeText(FXint pos,FXint n,FXbool notify=false);
792 
794  virtual void clearText(FXbool notify=false);
795 
797  virtual void changeStyle(FXint pos,FXint n,FXint style);
798 
800  virtual void changeStyle(FXint pos,const FXchar* style,FXint n);
801  virtual void changeStyle(FXint pos,const FXString& style);
802 
804  void extractText(FXchar *text,FXint pos,FXint n) const;
805  void extractText(FXString& text,FXint pos,FXint n) const;
806 
808  void extractStyle(FXchar *style,FXint pos,FXint n) const;
809  void extractStyle(FXString& text,FXint pos,FXint n) const;
810 
823  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);
824 
825 
827  FXint getPosAt(FXint x,FXint y) const;
828 
830  FXint getPosContaining(FXint x,FXint y) const;
831 
833  FXint getXOfPos(FXint pos) const;
834 
836  FXint getYOfPos(FXint pos) const;
837 
846  FXint getRowColumnAt(FXint x,FXint y,FXint& row,FXint& col) const;
847 
849  FXint getXOfRowColumn(FXint row,FXint col) const;
850 
852  FXint getYOfRowColumn(FXint row,FXint col) const;
853 
858  FXint countCols(FXint start,FXint end) const;
859 
864  FXint countRows(FXint start,FXint end) const;
865 
867  FXint countLines(FXint start,FXint end) const;
868 
870  FXint lineStart(FXint pos) const;
871 
873  FXint lineEnd(FXint pos) const;
874 
876  FXint nextLine(FXint pos,FXint nl=1) const;
877 
879  FXint prevLine(FXint pos,FXint nl=1) const;
880 
882  FXint rowStart(FXint pos) const;
883 
885  FXint rowEnd(FXint pos) const;
886 
888  FXint nextRow(FXint pos,FXint nr=1) const;
889 
891  FXint prevRow(FXint pos,FXint nr=1) const;
892 
894  FXint leftWord(FXint pos) const;
895 
897  FXint rightWord(FXint pos) const;
898 
900  FXint wordStart(FXint pos) const;
901 
903  FXint wordEnd(FXint pos) const;
904 
906  FXint validPos(FXint pos) const;
907 
909  FXint dec(FXint pos) const;
910 
912  FXint inc(FXint pos) const;
913 
915  void setTopLine(FXint pos);
916 
918  FXint getTopLine() const;
919 
921  void setBottomLine(FXint pos);
922 
924  FXint getBottomLine() const;
925 
927  void setCenterLine(FXint pos);
928 
930  virtual FXbool selectAll(FXbool notify=false);
931 
933  virtual FXbool setSelection(FXint pos,FXint len,FXbool notify=false);
934 
936  virtual FXbool extendSelection(FXint pos,FXuint sel=SelectChars,FXbool notify=false);
937 
939  virtual FXbool setBlockSelection(FXint trow,FXint lcol,FXint brow,FXint rcol,FXbool notify=false);
940 
942  virtual FXbool extendBlockSelection(FXint row,FXint col,FXbool notify=false);
943 
945  virtual FXbool killSelection(FXbool notify=false);
946 
948  FXbool copySelection();
949 
951  FXbool cutSelection(FXbool notify=false);
952 
954  FXbool deleteSelection(FXbool notify=false);
955 
957  FXbool pasteSelection(FXbool notify=false);
958 
960  FXbool pasteClipboard(FXbool notify=false);
961 
963  FXbool replaceSelection(const FXchar *text,FXint n,FXbool notify=false);
964 
966  FXbool replaceSelection(const FXString& text,FXbool notify=false);
967 
969  void enterText(const FXchar *text,FXint n,FXbool notify=false);
970 
972  void enterText(const FXString& text,FXbool notify=false);
973 
975  FXbool isPosSelected(FXint pos) const;
976 
978  FXbool isPosSelected(FXint pos,FXint col) const;
979 
981  FXbool isPosVisible(FXint pos) const;
982 
984  void makePositionVisible(FXint pos);
985 
987  FXbool setHighlight(FXint start,FXint len);
988 
990  FXbool killHighlight();
991 
993  virtual void setCursorPos(FXint pos,FXbool notify=false);
994 
996  FXint getCursorPos() const { return cursorpos; }
997 
999  void setCursorRowColumn(FXint row,FXint col,FXbool notify=false);
1000 
1002  void setCursorRow(FXint row,FXbool notify=false);
1003 
1005  FXint getCursorRow() const { return cursorrow; }
1006 
1008  void setCursorColumn(FXint col,FXbool notify=false);
1009 
1011  FXint getCursorColumn() const { return cursorcol; }
1012 
1014  void setAnchorPos(FXint pos);
1015 
1017  FXint getAnchorPos() const { return anchorpos; }
1018 
1020  void setAnchorRowColumn(FXint row,FXint col);
1021 
1023  FXint getAnchorRow() const { return anchorrow; }
1024 
1026  FXint getAnchorColumn() const { return anchorcol; }
1027 
1029  void moveCursor(FXint pos,FXbool notify=false);
1030 
1032  void moveCursorRowColumn(FXint row,FXint col,FXbool notify=false);
1033 
1035  void moveCursorAndSelect(FXint pos,FXuint sel,FXbool notify=false);
1036 
1038  void moveCursorRowColumnAndSelect(FXint row,FXint col,FXbool notify=false);
1039 
1041  FXint getSelStartPos() const { return select.startpos; }
1042 
1044  FXint getSelEndPos() const { return select.endpos; }
1045 
1047  FXint getSelStartColumn() const { return select.startcol; }
1048 
1050  FXint getSelEndColumn() const { return select.endcol; }
1051 
1053  void setTextStyle(FXuint style);
1054 
1056  FXuint getTextStyle() const;
1057 
1063  void setVisibleRows(FXint rows);
1064 
1066  FXint getVisibleRows() const { return vrows; }
1067 
1073  void setVisibleColumns(FXint cols);
1074 
1076  FXint getVisibleColumns() const { return vcols; }
1077 
1086  void setHiliteMatchTime(FXTime t){ matchtime=t; }
1087 
1091  FXTime getHiliteMatchTime() const { return matchtime; }
1092 
1100  void setHiliteStyles(FXHiliteStyle* styles);
1101 
1105  FXHiliteStyle* getHiliteStyles() const { return hilitestyles; }
1106 
1108  virtual void save(FXStream& store) const;
1109 
1111  virtual void load(FXStream& store);
1112 
1114  virtual ~FXText();
1115  };
1116 
1117 }
1118 
1119 #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:1047
void setHelpText(const FXString &text)
Set help text.
Definition: FXText.h:719
FXbool isModified() const
Return true if text was modified.
Definition: FXText.h:629
FXColor selectBackColor
Selected text foreground color.
Definition: FXText.h:49
FXint getSelEndColumn() const
Return selection end column.
Definition: FXText.h:1050
FXint getVisibleRows() const
Return number of visible rows.
Definition: FXText.h:1066
FXint getSelEndPos() const
Return selection end position.
Definition: FXText.h:1044
FXint getTabColumns() const
Return tab columns.
Definition: FXText.h:617
FXColor normalBackColor
Normal text foreground color.
Definition: FXText.h:47
FXint getLength() const
Return length of buffer.
Definition: FXText.h:743
FXColor getBarColor() const
Return bar color.
Definition: FXText.h:716
FXbool isStyled() const
Return true if style buffer.
Definition: FXText.h:650
FXString getHelpText() const
Return help text.
Definition: FXText.h:722
FXint getSelStartPos() const
Return selection start position.
Definition: FXText.h:1041
FXint getCursorRow() const
Return cursor row.
Definition: FXText.h:1005
FXint getMarginBottom() const
Return bottom margin.
Definition: FXText.h:596
void setTipText(const FXString &text)
Set the tool tip message for this text widget.
Definition: FXText.h:725
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:611
FXchar * ins
Number characters inserted at position.
Definition: FXText.h:67
FXColor getSelBackColor() const
Return selected background color.
Definition: FXText.h:674
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:656
FXColor getTextColor() const
Return text color.
Definition: FXText.h:668
Select characters.
Definition: FXText.h:433
FXColor getCursorColor() const
Return cursor color.
Definition: FXText.h:704
FXint getMarginTop() const
Return top margin.
Definition: FXText.h:590
FXColor hiliteForeColor
Selected text background color.
Definition: FXText.h:50
Definition: FX4Splitter.h:28
FXColor getSelTextColor() const
Return selected text color.
Definition: FXText.h:680
FXHiliteStyle * getHiliteStyles() const
Return current value of the style table.
Definition: FXText.h:1105
FXint getMarginLeft() const
Return left margin.
Definition: FXText.h:602
Select words.
Definition: FXText.h:434
FXColor getHiliteTextColor() const
Return highlighted text color.
Definition: FXText.h:686
void setModified(FXbool mod=true)
Set modified flag.
Definition: FXText.h:632
FXint getAnchorColumn() const
Return anchor row.
Definition: FXText.h:1026
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:662
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:653
FXint endcol
Start column, if block-select (actually, indent)
Definition: FXText.h:81
FXint getVisibleColumns() const
Return number of visible columns.
Definition: FXText.h:1076
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:698
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:996
Select nothing.
Definition: FXText.h:432
FXint getAnchorRow() const
Return anchor row.
Definition: FXText.h:1023
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:1011
FXTime getHiliteMatchTime() const
Return brace and parenthesis match highlighting time, in nanoseconds.
Definition: FXText.h:1091
FXint getNumRows() const
Return number of rows in buffer.
Definition: FXText.h:746
FXString getTipText() const
Get the tool tip message for this text widget.
Definition: FXText.h:728
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:1017
void setHiliteMatchTime(FXTime t)
Change brace and parenthesis match highlighting time, in nanoseconds.
Definition: FXText.h:1086
FXint getMarginRight() const
Return right margin.
Definition: FXText.h:608
FXColor getNumberColor() const
Return line number color.
Definition: FXText.h:710
Font class.
Definition: FXFont.h:137
FXint getBarColumns() const
Return number of columns used for line numbers.
Definition: FXText.h:623
FXuint style
Active text background color.
Definition: FXText.h:53
FXColor getHiliteBackColor() const
Return highlighted background color.
Definition: FXText.h:692
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