24#ifndef FL_TEXT_DISPLAY_H
25#define FL_TEXT_DISPLAY_H
30#include "Fl_Scrollbar.H"
31#include "Fl_Text_Buffer.H"
133 typedef void (*Unfinished_Style_Cb)(int,
void *);
158 virtual int handle(
int e);
176 void redisplay_range(
int start,
int end);
177 void scroll(
int topLineNum,
int horizOffset);
178 void insert(
const char* text);
179 void overstrike(
const char* text);
180 void insert_position(
int newPos);
187 int position_to_xy(
int pos,
int* x,
int* y)
const;
189 int in_selection(
int x,
int y)
const;
190 void show_insert_position();
196 int count_lines(
int start,
int end,
bool start_pos_is_line_start)
const;
197 int line_start(
int pos)
const;
198 int line_end(
int startPos,
bool startPosIsLineStart)
const;
199 int skip_lines(
int startPos,
int nLines,
bool startPosIsLineStart);
200 int rewind_lines(
int startPos,
int nLines);
201 void next_word(
void);
202 void previous_word(
void);
204 void show_cursor(
int b = 1);
211 void cursor_style(
int style);
254 int word_start(
int pos)
const {
return buffer()->word_start(pos); }
261 int word_end(
int pos)
const {
return buffer()->word_end(pos); }
265 const Style_Table_Entry *styleTable,
266 int nStyles,
char unfinishedStyle,
267 Unfinished_Style_Cb unfinishedHighlightCB,
270 int position_style(
int lineStartPos,
int lineLen,
int lineIndex)
const;
322 int wrapped_column(
int row,
int column)
const;
323 int wrapped_row(
int row)
const;
324 void wrap_mode(
int wrap,
int wrap_margin);
326 virtual void resize(
int X,
int Y,
int W,
int H);
333 double x_to_col(
double x)
const;
341 double col_to_x(
double col)
const;
343 void linenumber_width(
int width);
344 int linenumber_width()
const;
345 void linenumber_font(
Fl_Font val);
346 Fl_Font linenumber_font()
const;
349 void linenumber_fgcolor(
Fl_Color val);
350 Fl_Color linenumber_fgcolor()
const;
351 void linenumber_bgcolor(
Fl_Color val);
352 Fl_Color linenumber_bgcolor()
const;
353 void linenumber_align(
Fl_Align val);
355 void linenumber_format(
const char* val);
356 const char* linenumber_format()
const;
365 void draw_text(
int X,
int Y,
int W,
int H);
366 void draw_range(
int start,
int end);
367 void draw_cursor(
int,
int);
369 void draw_string(
int style,
int x,
int y,
int toX,
const char *
string,
372 void draw_vline(
int visLineNum,
int leftClip,
int rightClip,
373 int leftCharIndex,
int rightCharIndex);
375 int find_x(
const char *s,
int len,
int style,
int x)
const;
380 FIND_INDEX_FROM_ZERO,
384 int handle_vline(
int mode,
385 int lineStart,
int lineLen,
int leftChar,
int rightChar,
386 int topClip,
int bottomClip,
387 int leftClip,
int rightClip)
const;
389 void draw_line_numbers(
bool clearAll);
391 void clear_rect(
int style,
int x,
int y,
int width,
int height)
const;
392 void display_insert();
394 void offset_line_starts(
int newTopLineNum);
396 void calc_line_starts(
int startLine,
int endLine);
398 void update_line_starts(
int pos,
int charsInserted,
int charsDeleted,
399 int linesInserted,
int linesDeleted,
int *scrolled);
401 void calc_last_char();
403 int position_to_line(
int pos,
int* lineNum )
const;
404 double string_width(
const char*
string,
int length,
int style)
const;
406 static void scroll_timer_cb(
void*);
408 static void buffer_predelete_cb(
int pos,
int nDeleted,
void* cbArg);
409 static void buffer_modified_cb(
int pos,
int nInserted,
int nDeleted,
410 int nRestyled,
const char* deletedText,
415 void update_v_scrollbar();
416 void update_h_scrollbar();
417 int measure_vline(
int visLineNum)
const;
418 int longest_vline()
const;
419 int empty_vlines()
const;
420 int vline_length(
int visLineNum)
const;
421 int xy_to_position(
int x,
int y,
int PosType = CHARACTER_POS)
const;
423 void xy_to_rowcol(
int x,
int y,
int* row,
int* column,
424 int PosType = CHARACTER_POS)
const;
425 void maintain_absolute_top_line_number(
int state);
426 int get_absolute_top_line_number()
const;
427 void absolute_top_line_number(
int oldFirstChar);
428 int maintaining_absolute_top_line_number()
const;
429 void reset_absolute_top_line_number();
430 int position_to_linecol(
int pos,
int* lineNum,
int* column)
const;
431 int scroll_(
int topLineNum,
int horizOffset);
433 void extend_range_for_styles(
int* start,
int* end);
435 void find_wrap_range(
const char *deletedText,
int pos,
int nInserted,
436 int nDeleted,
int *modRangeStart,
int *modRangeEnd,
437 int *linesInserted,
int *linesDeleted);
438 void measure_deleted_lines(
int pos,
int nDeleted);
439 void wrapped_line_counter(
Fl_Text_Buffer *buf,
int startPos,
int maxPos,
440 int maxLines,
bool startPosIsLineStart,
441 int styleBufOffset,
int *retPos,
int *retLines,
442 int *retLineStart,
int *retLineEnd,
443 bool countLastLineMissingNewLine =
true)
const;
444 void find_line_end(
int pos,
bool start_pos_is_line_start,
int *lineEnd,
445 int *nextLineStart)
const;
446 double measure_proportional_character(
const char *s,
int colNum,
int pos)
const;
447 int wrap_uses_character(
int lineEndPos)
const;
449 int damage_range1_start, damage_range1_end;
450 int damage_range2_start, damage_range2_end;
458 int mCursorPreferredXPos;
464 int mFirstChar, mLastChar;
478 int mNeedAbsTopLineNum;
484 int mHorizOffsetHint;
486 const Style_Table_Entry *mStyleTable;
488 char mUnfinishedStyle;
490 Unfinished_Style_Cb mUnfinishedHighlightCB;
492 void* mHighlightCBArg;
501 int mModifyingTabDistance;
504 mutable double mColumnScale;
513 int scrollbar_width_;
515 int dragPos, dragType, dragging;
516 int display_insert_position_hint;
517 struct {
int x,
y,
w,
h; } text_area;
526 int mLineNumLeft, mLineNumWidth;
529#if FLTK_ABI_VERSION >= 10303
535 const char* linenumber_format_;
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:875
unsigned Fl_Align
FLTK type for alignment control.
Definition: Enumerations.H:826
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition: Enumerations.H:932
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:904
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:41
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:147
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:458
void draw()
Draws the widget.
Definition: Fl_Group.cxx:738
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:634
This class manages Unicode text displayed in one or more Fl_Text_Display widgets.
Definition: Fl_Text_Buffer.H:158
Rich text display widget.
Definition: Fl_Text_Display.H:82
int scrollbar_width() const
Gets the width/height of the scrollbars.
Definition: Fl_Text_Display.H:229
void textsize(Fl_Fontsize s)
Sets the default size of text in the widget.
Definition: Fl_Text_Display.H:308
void hide_cursor()
Hides the text cursor.
Definition: Fl_Text_Display.H:209
void cursor_color(Fl_Color n)
Sets the text cursor color.
Definition: Fl_Text_Display.H:223
void textcolor(Fl_Color n)
Sets the default color of text in the widget.
Definition: Fl_Text_Display.H:320
Fl_Align scrollbar_align() const
Gets the scrollbar alignment type.
Definition: Fl_Text_Display.H:241
@ BLOCK_CURSOR
unfille box under the current character
Definition: Fl_Text_Display.H:93
@ DIM_CURSOR
dim I-beam
Definition: Fl_Text_Display.H:92
@ CARET_CURSOR
caret under the text
Definition: Fl_Text_Display.H:91
@ NORMAL_CURSOR
I-beam.
Definition: Fl_Text_Display.H:90
@ HEAVY_CURSOR
thick I-beam
Definition: Fl_Text_Display.H:94
void scrollbar_width(int W)
Sets the width/height of the scrollbars.
Definition: Fl_Text_Display.H:235
void shortcut(int s)
Definition: Fl_Text_Display.H:284
Fl_Text_Buffer * buffer() const
Gets the current text buffer associated with the text widget.
Definition: Fl_Text_Display.H:174
void scrollbar_align(Fl_Align a)
Sets the scrollbar alignment type.
Definition: Fl_Text_Display.H:247
int word_start(int pos) const
Moves the insert position to the beginning of the current word.
Definition: Fl_Text_Display.H:254
int word_end(int pos) const
Moves the insert position to the end of the current word.
Definition: Fl_Text_Display.H:261
Fl_Color cursor_color() const
Gets the text cursor color.
Definition: Fl_Text_Display.H:217
Fl_Color textcolor() const
Gets the default color of text in the widget.
Definition: Fl_Text_Display.H:314
void textfont(Fl_Font s)
Sets the default font used when drawing text in the widget.
Definition: Fl_Text_Display.H:296
int insert_position() const
Gets the position of the text insertion cursor for text display.
Definition: Fl_Text_Display.H:186
int shortcut() const
Definition: Fl_Text_Display.H:277
@ WRAP_AT_COLUMN
wrap text at the given text column
Definition: Fl_Text_Display.H:126
@ WRAP_NONE
don't wrap text at all
Definition: Fl_Text_Display.H:125
@ WRAP_AT_PIXEL
wrap text at a pixel position
Definition: Fl_Text_Display.H:127
Fl_Fontsize textsize() const
Gets the default size of text in the widget.
Definition: Fl_Text_Display.H:302
void buffer(Fl_Text_Buffer &buf)
Sets the current text buffer associated with the text widget.
Definition: Fl_Text_Display.H:167
Fl_Font textfont() const
Gets the default font used when drawing text in the widget.
Definition: Fl_Text_Display.H:290
utility header to pull drawing functions together
This structure associates the color, font, and font size of a string to draw with an attribute mask m...
Definition: Fl_Text_Display.H:148
Fl_Color color
text color
Definition: Fl_Text_Display.H:149
Fl_Fontsize size
text font size
Definition: Fl_Text_Display.H:151
Fl_Font font
text font
Definition: Fl_Text_Display.H:150
unsigned attr
currently unused (this may be change in the future)
Definition: Fl_Text_Display.H:152