Inherited by fltk::TextEditor.
Public Types | |
| enum | { NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR, BLOCK_CURSOR, HEAVY_CURSOR } |
| enum | { CURSOR_POS, CHARACTER_POS } |
| enum | { DRAG_CHAR, DRAG_WORD, DRAG_LINE } |
| enum | { ATTR_NONE, ATTR_UNDERLINE, ATTR_HIDDEN } |
Public Member Functions | |
| void | append (const char *text) |
| char | at (int i) const |
| const TextBuffer * | buffer () const |
| TextBuffer * | buffer () |
| void | buffer (TextBuffer &buf) |
| void | buffer (TextBuffer *buf) |
| void | cursor_color (Color n) |
| Color | cursor_color () const |
| bool | cursor_on () const |
| void | cursor_style (int style) |
| virtual void | draw () |
| int | find_next_char (int pos) |
| int | find_prev_char (int pos) |
| virtual int | handle (int e) |
| void | hide_cursor () |
| void | highlight_data (TextBuffer *styleBuffer, StyleTableEntry *styleTable, int nStyles, char unfinishedStyle, UnfinishedStyleCb unfinishedHighlightCB, void *cbArg) |
| int | hor_offset () const |
| bool | in_selection (int x, int y) |
| void | insert (const char *text) |
| int | insert_position () const |
| void | insert_position (int newPos) |
| virtual void | layout () |
| int | line_end (int pos, bool start_pos_is_line_start=false) |
| int | line_start (int pos) |
| int | linenumber_width () const |
| void | linenumber_width (int width) |
| bool | move_down () |
| bool | move_left () |
| bool | move_right () |
| bool | move_up () |
| void | next_word (void) |
| void | overstrike (const char *text) |
| bool | position_to_xy (int pos, int *X, int *Y) |
| void | previous_word (void) |
| void | redisplay_range (int start, int end) |
| void | scroll (int topLineNum, int horizOffset) |
| void | show_cursor (bool b=true) |
| void | show_insert_position () |
| int | size () const |
| void | static_text (const char *v) |
| void | text (const char *v) |
| const char * | text () const |
| TextDisplay (int X, int Y, int W, int H, const char *l=0) | |
| int | top_line () const |
| int | total_lines () |
| int | visible_lines () const |
| int | word_end (int pos) |
| int | word_start (int pos) |
| void | wrap_mode (bool wrap, int wrap_margin=0) |
| int | xy_to_position (int X, int Y, int PosType=CHARACTER_POS) |
| void | xy_to_rowcol (int X, int Y, int *row, int *column, int PosType=CHARACTER_POS) |
Protected Member Functions | |
| void | absolute_top_line_number (int oldFirstChar) |
| void | blank_cursor_protrusions () |
| void | calc_last_char () |
| void | calc_line_starts (int startLine, int endLine) |
| void | clear_rect (int style, int x, int y, int width, int height) |
| int | count_lines (int start, int end, bool start_pos_is_line_start) |
| void | display_insert () |
| void | draw_cursor (int, int) |
| void | draw_line_numbers (bool clearAll) |
| void | draw_range (int start, int end) |
| void | draw_string (int style, int x, int y, int toX, const char *string, int nChars) |
| void | draw_text (int X, int Y, int W, int H) |
| void | draw_vline (int visLineNum, int leftClip, int rightClip, int leftCharIndex, int rightCharIndex) |
| int | empty_vlines () |
| void | extend_range_for_styles (int *start, int *end) |
| void | find_line_end (int pos, bool start_pos_is_line_start, int *lineEnd, int *nextLineStart) |
| void | find_wrap_range (const char *deletedText, int pos, int nInserted, int nDeleted, int *modRangeStart, int *modRangeEnd, int *linesInserted, int *linesDeleted) |
| int | get_absolute_top_line_number () |
| int | longest_vline () |
| void | maintain_absolute_top_line_number (bool state) |
| int | maintaining_absolute_top_line_number () |
| void | measure_deleted_lines (int pos, int nDeleted) |
| int | measure_proportional_character (TextBuffer *buf, int bufpos, int colNum, int pos) |
| int | measure_vline (int visLineNum) |
| void | offset_line_starts (int newTopLineNum) |
| int | position_style (int lineStartPos, int lineLen, int lineIndex, int dispIndex) |
| bool | position_to_line (int pos, int *lineNum) |
| bool | position_to_linecol (int pos, int *lineNum, int *column) |
| int | range_touches_selection (TextSelection *sel, int rangeStart, int rangeEnd) |
| void | reset_absolute_top_line_number () |
| int | rewind_lines (int startPos, int nLines) |
| void | scroll_ (int topLineNum, int horizOffset) |
| int | skip_lines (int startPos, int nLines, bool startPosIsLineStart) |
| int | string_width (const char *string, int length, int style) |
| void | text_drag_me (int pos) |
| void | update_h_scrollbar (int longestvline=0) |
| void | update_line_starts (int pos, int charsInserted, int charsDeleted, int linesInserted, int linesDeleted, bool *scrolled) |
| void | update_v_scrollbar () |
| int | vline_length (int visLineNum) |
| int | wrap_uses_character (int lineEndPos) |
| int | wrapped_column (int row, int column) |
| void | wrapped_line_counter (TextBuffer *buf, int startPos, int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset, int *retPos, int *retLines, int *retLineStart, int *retLineEnd, bool countLastLineMissingNewLine=true) |
| int | wrapped_row (int row) |
Static Protected Member Functions | |
| static void | buffer_modified_cb (int pos, int nInserted, int nDeleted, int nRestyled, const char *deletedText, void *cbArg) |
| static void | buffer_predelete_cb (int pos, int nDeleted, void *cbArg) |
| static void | h_scrollbar_cb (Scrollbar *w, TextDisplay *d) |
| static void | v_scrollbar_cb (Scrollbar *w, TextDisplay *d) |
Protected Attributes | |
| int | abs_topline_num_ |
| int | ascent_ |
| TextBuffer * | buffer_ |
| int | bufferlines_cnt_ |
| bool | continuous_wrap_ |
| Color | cursor_color_ |
| int | cursor_hint_ |
| int | cursor_oldx_ |
| int | cursor_oldy_ |
| bool | cursor_on_ |
| int | cursor_pos_ |
| int | cursor_preferred_col_ |
| int | cursor_style_ |
| int | damage_range1_end |
| int | damage_range1_start |
| int | damage_range2_end |
| int | damage_range2_start |
| int | descent_ |
| int | dragging_ |
| int | dragpos_ |
| int | dragtype_ |
| int | firstchar_ |
| int | fixed_fontwidth_ |
| void * | highlight_cbarg_ |
| int | horiz_offset_ |
| Scrollbar * | hscrollbar |
| int | lastchar_ |
| int | linenumleft_ |
| int | linenumwidth_ |
| int * | linestarts_ |
| int | maxsize_ |
| bool | need_abs_topline_num_ |
| int | nlinesdeleted_ |
| int | numstyles_ |
| bool | own_buffer |
| int | stdfontwidth_ |
| TextBuffer * | stylebuffer_ |
| const StyleTableEntry * | styletable_ |
| bool | suppressresync_ |
| Rectangle | text_area |
| int | topline_num_ |
| UnfinishedStyleCb | unfinished_highlight_cb_ |
| char | unfinished_style_ |
| int | visiblelines_cnt_ |
| Scrollbar * | vscrollbar |
| int | wrapmargin_ |
| void fltk::TextDisplay::append | ( | const char * | text | ) | [inline] |
Append text to the end of the buffer
| const TextBuffer* fltk::TextDisplay::buffer | ( | ) | const [inline] |
Return attached buffer
| TextBuffer* fltk::TextDisplay::buffer | ( | ) | [inline] |
Return attached buffer
Referenced by find_next_char(), find_prev_char(), line_end(), line_start(), move_up(), next_word(), previous_word(), and wrap_mode().
| void fltk::TextDisplay::buffer | ( | TextBuffer & | buf | ) | [inline] |
Associate 'buf' with display
| void TextDisplay::buffer | ( | TextBuffer * | buf | ) |
| void fltk::TextDisplay::cursor_color | ( | Color | n | ) | [inline] |
Set cursor color
| Color fltk::TextDisplay::cursor_color | ( | ) | const [inline] |
Return cursor color
| bool fltk::TextDisplay::cursor_on | ( | ) | const [inline] |
Return cursor visibility state
| void TextDisplay::cursor_style | ( | int | style | ) |
Set cursor style
References show_cursor().
| int TextDisplay::find_next_char | ( | int | pos | ) |
Find start of the next character, starting from 'pos' If 'pos' points to start of character already, it is returned. This is mainly used with UTF-8 strings
References buffer(), and fltk::TextBuffer::character().
Referenced by move_down(), move_right(), next_word(), overstrike(), previous_word(), and redisplay_range().
| int TextDisplay::find_prev_char | ( | int | pos | ) |
Find start of the previous character, starting from 'pos' If 'pos' points to start of character already, it is returned. This is mainly used with UTF-8 strings
References buffer(), and fltk::TextBuffer::character().
Referenced by move_left(), move_up(), previous_word(), and redisplay_range().
| void fltk::TextDisplay::hide_cursor | ( | ) | [inline] |
Hide cursor
| void TextDisplay::highlight_data | ( | TextBuffer * | styleBuffer, | |
| StyleTableEntry * | styleTable, | |||
| int | nStyles, | |||
| char | unfinishedStyle, | |||
| UnfinishedStyleCb | unfinishedHighlightCB, | |||
| void * | cbArg | |||
| ) |
Set new highlight data
References fltk::TextBuffer::canUndo(), fltk::Widget::redraw(), and fltk::Widget::relayout().
| int fltk::TextDisplay::hor_offset | ( | ) | const [inline] |
Return current horizontal offset
| bool TextDisplay::in_selection | ( | int | x, | |
| int | y | |||
| ) |
Returns true if position is inside selection
References fltk::TextBuffer::line_start(), fltk::TextBuffer::primary_selection(), xy_to_position(), and xy_to_rowcol().
| void TextDisplay::insert | ( | const char * | text | ) |
Insert text to current cursor position
References fltk::TextBuffer::insert().
| int fltk::TextDisplay::insert_position | ( | ) | const [inline] |
Return current cursor position
Referenced by move_down(), move_left(), move_right(), move_up(), next_word(), and previous_word().
| void TextDisplay::insert_position | ( | int | newPos | ) |
Set new cursor position
References fltk::TextBuffer::length(), and redisplay_range().
| int TextDisplay::line_end | ( | int | pos, | |
| bool | start_pos_is_line_start = false | |||
| ) |
Returns end of the line where 'pos' is located
References buffer(), and fltk::TextBuffer::line_end().
Referenced by move_down(), and move_up().
| int TextDisplay::line_start | ( | int | pos | ) |
Returns begining of the line where 'pos' is located
References buffer(), and fltk::TextBuffer::line_start().
Referenced by move_down(), and wrap_mode().
| int fltk::TextDisplay::linenumber_width | ( | ) | const [inline] |
Return line number area width
| void TextDisplay::linenumber_width | ( | int | width | ) |
Set line number area width
References fltk::Widget::redraw(), and fltk::Widget::relayout().
| bool TextDisplay::move_down | ( | ) |
Move cursor down
References fltk::TextBuffer::count_displayed_characters_utf(), find_next_char(), insert_position(), fltk::TextBuffer::length(), line_end(), line_start(), and fltk::TextBuffer::skip_displayed_characters_utf().
| bool TextDisplay::move_left | ( | ) |
Move cursor left
References find_prev_char(), and insert_position().
| bool TextDisplay::move_right | ( | ) |
Move cursor right
References find_next_char(), insert_position(), and fltk::TextBuffer::length().
| bool TextDisplay::move_up | ( | ) |
| void TextDisplay::next_word | ( | void | ) |
Go to next word
References buffer(), fltk::TextBuffer::character(), find_next_char(), and insert_position().
| void TextDisplay::overstrike | ( | const char * | text | ) |
Overstrike text from current cursor position
References fltk::TextBuffer::character(), fltk::TextBuffer::character_width(), fltk::TextBuffer::count_displayed_characters(), find_next_char(), fltk::TextBuffer::length(), fltk::TextBuffer::line_start(), fltk::TextBuffer::null_substitution_character(), fltk::TextBuffer::replace(), and fltk::TextBuffer::tab_distance().
| bool TextDisplay::position_to_xy | ( | int | pos, | |
| int * | X, | |||
| int * | Y | |||
| ) |
Translate a buffer text position to the XY location where the top left of the cursor would be positioned to point to that character. Returns 0 if the position is not displayed because it is VERTICALLY out of view. If the position is horizontally out of view, returns the X coordinate where the position would be if it were visible.
References fltk::TextBuffer::expand_character(), fltk::TextBuffer::null_substitution_character(), fltk::TextBuffer::tab_distance(), fltk::TextBuffer::text_range(), fltk::Rectangle::x(), and fltk::Rectangle::y().
| void TextDisplay::previous_word | ( | void | ) |
Go to previous word
References buffer(), fltk::TextBuffer::character(), find_next_char(), find_prev_char(), and insert_position().
| void TextDisplay::redisplay_range | ( | int | start, | |
| int | end | |||
| ) |
Redisplay text
References fltk::DAMAGE_SCROLL, find_next_char(), find_prev_char(), and fltk::Widget::redraw().
Referenced by insert_position(), and show_cursor().
| void TextDisplay::scroll | ( | int | topLineNum, | |
| int | horizOffset | |||
| ) |
Scroll to new position
| void TextDisplay::show_cursor | ( | bool | b = true |
) |
| void TextDisplay::show_insert_position | ( | ) |
Make cursor position visible in screen
| int fltk::TextDisplay::top_line | ( | ) | const [inline] |
Return current visible topline
| int fltk::TextDisplay::visible_lines | ( | ) | const [inline] |
Return number of visible lines
| int fltk::TextDisplay::word_end | ( | int | pos | ) | [inline] |
Return end of the word where 'pos' is located
| int fltk::TextDisplay::word_start | ( | int | pos | ) | [inline] |
Return begining of the word where 'pos' is located
| void TextDisplay::wrap_mode | ( | bool | wrap, | |
| int | wrap_margin = 0 | |||
| ) |
Set wrapping mode. wrap_margin is width to wrap at, zero means use w()
References buffer(), line_start(), fltk::Widget::redraw(), and fltk::Widget::relayout().
| int TextDisplay::xy_to_position | ( | int | X, | |
| int | Y, | |||
| int | posType = CHARACTER_POS | |||
| ) |
Translate window coordinates to the nearest (insert cursor or character cell) text position. The parameter posType specifies how to interpret the position: CURSOR_POS means translate the coordinates to the nearest cursor position, and CHARACTER_POS means return the position of the character closest to (X, Y).
References fltk::TextBuffer::expand_character(), fltk::TextBuffer::length(), fltk::TextBuffer::null_substitution_character(), fltk::TextBuffer::tab_distance(), fltk::TextBuffer::text_range(), fltk::Rectangle::x(), and fltk::Rectangle::y().
Referenced by in_selection().
| void TextDisplay::xy_to_rowcol | ( | int | X, | |
| int | Y, | |||
| int * | row, | |||
| int * | column, | |||
| int | posType = CHARACTER_POS | |||
| ) |
Translate window coordinates to the nearest row and column number for positioning the cursor. This, of course, makes no sense when the font is proportional, since there are no absolute columns. The parameter posType specifies how to interpret the position: CURSOR_POS means translate the coordinates to the nearest position between characters, and CHARACTER_POS means translate the position to the nearest character cell.
References fltk::Rectangle::x(), and fltk::Rectangle::y().
Referenced by in_selection().
©2007 Bill Spitzak and others.