24 #ifndef FL_TEXT_DISPLAY_H
25 #define FL_TEXT_DISPLAY_H
30 #include "Fl_Scrollbar.H"
31 #include "Fl_Text_Buffer.H"
92 typedef void (*Unfinished_Style_Cb)(int,
void *);
108 virtual int handle(
int e);
126 void redisplay_range(
int start,
int end);
127 void scroll(
int topLineNum,
int horizOffset);
128 void insert(
const char* text);
129 void overstrike(
const char* text);
130 void insert_position(
int newPos);
137 int position_to_xy(
int pos,
int* x,
int* y)
const;
139 int in_selection(
int x,
int y)
const;
140 void show_insert_position();
146 int count_lines(
int start,
int end,
bool start_pos_is_line_start)
const;
147 int line_start(
int pos)
const;
148 int line_end(
int startPos,
bool startPosIsLineStart)
const;
149 int skip_lines(
int startPos,
int nLines,
bool startPosIsLineStart);
150 int rewind_lines(
int startPos,
int nLines);
151 void next_word(
void);
152 void previous_word(
void);
154 void show_cursor(
int b = 1);
161 void cursor_style(
int style);
204 int word_start(
int pos)
const {
return buffer()->word_start(pos); }
211 int word_end(
int pos)
const {
return buffer()->word_end(pos); }
215 const Style_Table_Entry *styleTable,
216 int nStyles,
char unfinishedStyle,
217 Unfinished_Style_Cb unfinishedHighlightCB,
220 int position_style(
int lineStartPos,
int lineLen,
int lineIndex)
const;
272 int wrapped_column(
int row,
int column)
const;
273 int wrapped_row(
int row)
const;
274 void wrap_mode(
int wrap,
int wrap_margin);
276 virtual void resize(
int X,
int Y,
int W,
int H);
283 double x_to_col(
double x)
const;
291 double col_to_x(
double col)
const;
300 void draw_text(
int X,
int Y,
int W,
int H);
301 void draw_range(
int start,
int end);
302 void draw_cursor(
int,
int);
304 void draw_string(
int style,
int x,
int y,
int toX,
const char *
string,
307 void draw_vline(
int visLineNum,
int leftClip,
int rightClip,
308 int leftCharIndex,
int rightCharIndex);
310 int find_x(
const char *s,
int len,
int style,
int x)
const;
315 FIND_INDEX_FROM_ZERO,
319 int handle_vline(
int mode,
320 int lineStart,
int lineLen,
int leftChar,
int rightChar,
321 int topClip,
int bottomClip,
322 int leftClip,
int rightClip)
const;
324 void draw_line_numbers(
bool clearAll);
326 void clear_rect(
int style,
int x,
int y,
int width,
int height)
const;
327 void display_insert();
329 void offset_line_starts(
int newTopLineNum);
331 void calc_line_starts(
int startLine,
int endLine);
333 void update_line_starts(
int pos,
int charsInserted,
int charsDeleted,
334 int linesInserted,
int linesDeleted,
int *scrolled);
336 void calc_last_char();
338 int position_to_line(
int pos,
int* lineNum )
const;
339 double string_width(
const char*
string,
int length,
int style)
const;
341 static void scroll_timer_cb(
void*);
343 static void buffer_predelete_cb(
int pos,
int nDeleted,
void* cbArg);
344 static void buffer_modified_cb(
int pos,
int nInserted,
int nDeleted,
345 int nRestyled,
const char* deletedText,
350 void update_v_scrollbar();
351 void update_h_scrollbar();
352 int measure_vline(
int visLineNum)
const;
353 int longest_vline()
const;
354 int empty_vlines()
const;
355 int vline_length(
int visLineNum)
const;
356 int xy_to_position(
int x,
int y,
int PosType = CHARACTER_POS)
const;
358 void xy_to_rowcol(
int x,
int y,
int* row,
int* column,
359 int PosType = CHARACTER_POS)
const;
360 void maintain_absolute_top_line_number(
int state);
361 int get_absolute_top_line_number()
const;
362 void absolute_top_line_number(
int oldFirstChar);
363 int maintaining_absolute_top_line_number()
const;
364 void reset_absolute_top_line_number();
365 int position_to_linecol(
int pos,
int* lineNum,
int* column)
const;
366 int scroll_(
int topLineNum,
int horizOffset);
368 void extend_range_for_styles(
int* start,
int* end);
370 void find_wrap_range(
const char *deletedText,
int pos,
int nInserted,
371 int nDeleted,
int *modRangeStart,
int *modRangeEnd,
372 int *linesInserted,
int *linesDeleted);
373 void measure_deleted_lines(
int pos,
int nDeleted);
374 void wrapped_line_counter(
Fl_Text_Buffer *buf,
int startPos,
int maxPos,
375 int maxLines,
bool startPosIsLineStart,
376 int styleBufOffset,
int *retPos,
int *retLines,
377 int *retLineStart,
int *retLineEnd,
378 bool countLastLineMissingNewLine =
true)
const;
379 void find_line_end(
int pos,
bool start_pos_is_line_start,
int *lineEnd,
380 int *nextLineStart)
const;
381 double measure_proportional_character(
const char *s,
int colNum,
int pos)
const;
382 int wrap_uses_character(
int lineEndPos)
const;
384 int damage_range1_start, damage_range1_end;
385 int damage_range2_start, damage_range2_end;
393 int mCursorPreferredXPos;
399 int mFirstChar, mLastChar;
413 int mNeedAbsTopLineNum;
419 int mHorizOffsetHint;
421 const Style_Table_Entry *mStyleTable;
423 char mUnfinishedStyle;
425 Unfinished_Style_Cb mUnfinishedHighlightCB;
427 void* mHighlightCBArg;
436 int mModifyingTabDistance;
439 mutable double mColumnScale;
448 int scrollbar_width_;
450 int dragPos, dragType, dragging;
451 int display_insert_position_hint;
452 struct {
int x,
y,
w,
h; } text_area;
465 int mLineNumLeft, mLineNumWidth;
void hide_cursor()
Hides the text cursor.
Definition: Fl_Text_Display.H:159
Fl_Font textfont() const
Gets the default font used when drawing text in the widget.
Definition: Fl_Text_Display.H:240
wrap text at a pixel position
Definition: Fl_Text_Display.H:86
int scrollbar_width() const
Gets the width/height of the scrollbars.
Definition: Fl_Text_Display.H:179
Fl_Align scrollbar_align() const
Gets the scrollbar alignment type.
Definition: Fl_Text_Display.H:191
This structure associates the color, font, andsize of a string to draw with an attribute mask matchin...
Definition: Fl_Text_Display.H:98
caret under the text
Definition: Fl_Text_Display.H:50
unfille box under the current character
Definition: Fl_Text_Display.H:52
int insert_position() const
Gets the position of the text insertion cursor for text display.
Definition: Fl_Text_Display.H:136
void scrollbar_align(Fl_Align a)
Sets the scrollbar alignment type.
Definition: Fl_Text_Display.H:197
int word_end(int pos) const
Moves the insert position to the end of the current word.
Definition: Fl_Text_Display.H:211
This class manages unicode displayed in one or more Fl_Text_Display widgets.
Definition: Fl_Text_Buffer.H:157
dim I-beam
Definition: Fl_Text_Display.H:51
Fl_Color cursor_color() const
Gets the text cursor color.
Definition: Fl_Text_Display.H:167
don't wrap text at all
Definition: Fl_Text_Display.H:84
void draw()
Draws the widget.
Definition: Fl_Group.cxx:736
void textfont(Fl_Font s)
Sets the default font used when drawing text in the widget.
Definition: Fl_Text_Display.H:246
wrap text at the given text column
Definition: Fl_Text_Display.H:85
void insert(Fl_Widget &, int i)
The widget is removed from its current group (if any) and then inserted into this group...
Definition: Fl_Group.cxx:456
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:36
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:145
I-beam.
Definition: Fl_Text_Display.H:49
void textsize(Fl_Fontsize s)
Sets the default size of text in the widget.
Definition: Fl_Text_Display.H:258
void buffer(Fl_Text_Buffer &buf)
Sets the current text buffer associated with the text widget.
Definition: Fl_Text_Display.H:117
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:746
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:632
int shortcut() const
Definition: Fl_Text_Display.H:227
Fl_Fontsize textsize() const
Gets the default size of text in the widget.
Definition: Fl_Text_Display.H:252
void textcolor(Fl_Color n)
Sets the default color of text in the widget.
Definition: Fl_Text_Display.H:270
utility header to pull drawing functions together
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:774
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:717
void cursor_color(Fl_Color n)
Sets the text cursor color.
Definition: Fl_Text_Display.H:173
unsigned Fl_Align
FLTK type for alignment control.
Definition: Enumerations.H:668
int word_start(int pos) const
Moves the insert position to the beginning of the current word.
Definition: Fl_Text_Display.H:204
thick I-beam
Definition: Fl_Text_Display.H:53
Fl_Text_Buffer * buffer() const
Gets the current text buffer associated with the text widget.
Definition: Fl_Text_Display.H:124
Fl_Color textcolor() const
Gets the default color of text in the widget.
Definition: Fl_Text_Display.H:264
Rich text display widget.
Definition: Fl_Text_Display.H:41
void shortcut(int s)
Definition: Fl_Text_Display.H:234
void scrollbar_width(int W)
Sets the width/height of the scrollbars.
Definition: Fl_Text_Display.H:185