fltk::TextDisplay Class Reference

#include <TextDisplay.h>

Inherits fltk::Group.

Inherited by fltk::TextEditor.

List of all members.

Public Member Functions

void append (const char *text)
void buffer (TextBuffer *buf)
TextBufferbuffer ()
void buffer (TextBuffer &buf)
const TextBufferbuffer () const
Color cursor_color () const
void cursor_color (Color n)
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)
void insert_position (int newPos)
int insert_position () const
virtual void layout ()
int line_end (int pos, bool start_pos_is_line_start=false)
int line_start (int pos)
void linenumber_width (int width)
int linenumber_width () const
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 top_line () const
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)

Detailed Description

Member Function Documentation

void fltk::TextDisplay::append ( const char *  text) [inline]

Append text to the end of the buffer

void TextDisplay::buffer ( TextBuffer buf)

Associate 'buf' with display

void fltk::TextDisplay::buffer ( TextBuffer buf) [inline]

Associate 'buf' with display

TextBuffer* fltk::TextDisplay::buffer ( ) [inline]

Return attached buffer

const TextBuffer* fltk::TextDisplay::buffer ( ) const [inline]

Return attached buffer

Color fltk::TextDisplay::cursor_color ( ) const [inline]

Return cursor color

void fltk::TextDisplay::cursor_color ( Color  n) [inline]

Set cursor color

bool fltk::TextDisplay::cursor_on ( ) const [inline]

Return cursor visibility state

void TextDisplay::cursor_style ( int  style)

Set cursor style

void TextDisplay::draw ( void  ) [virtual]

Fltk calls this virtual function to draw the widget, after setting up the graphics (current window, xy translation, etc) so that any drawing functions will go into this widget.

User code should not call this! You probably want to call redraw().

The default version calls draw_box() and draw_label(), thus drawing the box() to fill the widget and putting the label() and image() inside it to fill it, unless the align() flags are set to put it outside.

Information on how to write your own version is here.

Reimplemented from fltk::Group.

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

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

int TextDisplay::handle ( int  event) [virtual]

Calls send() on some or all of the children widgets.

Reimplemented from fltk::Group.

Reimplemented in fltk::TextEditor.

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

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

void TextDisplay::insert ( const char *  text)

Insert text to current cursor position

void TextDisplay::insert_position ( int  newPos)

Set new cursor position

int fltk::TextDisplay::insert_position ( ) const [inline]

Return current cursor position

void TextDisplay::layout ( ) [virtual]

Virtual function to respond to layout_damage(), it should calculate the correct size of this widget and all it's children. This function is called by fltk or by the layout() method in other widgets. User programs should not call it.

A widget is allowed to alter it's own size in a layout() method, to indicate a size that the data will fit in. A parent widget is then expected to rearrange itself to accomodate the new size. This may mean it will move the widget and thus layout() will be called again.

You can look at layout_damage() to find out why this is being called.

The base class redraws the widget.

Reimplemented from fltk::Group.

int TextDisplay::line_end ( int  pos,
bool  start_pos_is_line_start = false 

Returns end of the line where 'pos' is located

int TextDisplay::line_start ( int  pos)

Returns begining of the line where 'pos' is located

void TextDisplay::linenumber_width ( int  width)

Set line number area width

int fltk::TextDisplay::linenumber_width ( ) const [inline]

Return line number area width

bool TextDisplay::move_down ( )

Move cursor down

bool TextDisplay::move_left ( )

Move cursor left

bool TextDisplay::move_right ( )

Move cursor right

bool TextDisplay::move_up ( )

Move cursor down

void TextDisplay::next_word ( void  )

Go to next word

void TextDisplay::overstrike ( const char *  text)

Overstrike text from current cursor position

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.

void TextDisplay::previous_word ( void  )

Go to previous word

void TextDisplay::redisplay_range ( int  start,
int  end 

Redisplay text

void TextDisplay::scroll ( int  topLineNum,
int  horizOffset 

Scroll to new position

void TextDisplay::show_cursor ( bool  b = true)

Show cursor

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()

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).

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.

The documentation for this class was generated from the following files: