fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Text_Editor Class Reference

#include <Fl_Text_Editor.H>

Inheritance diagram for Fl_Text_Editor:
Collaboration diagram for Fl_Text_Editor:

List of all members.

Classes

struct  Key_Binding

Public Types

typedef int(* Key_Func )(int key, Fl_Text_Editor *editor)

Public Member Functions

 Fl_Text_Editor (int X, int Y, int W, int H, const char *l=0)
 ~Fl_Text_Editor ()
virtual int handle (int e)
 Event handling.
void insert_mode (int b)
int insert_mode ()
void add_key_binding (int key, int state, Key_Func f, Key_Binding **list)
void add_key_binding (int key, int state, Key_Func f)
void remove_key_binding (int key, int state, Key_Binding **list)
void remove_key_binding (int key, int state)
void remove_all_key_bindings (Key_Binding **list)
void remove_all_key_bindings ()
void add_default_key_bindings (Key_Binding **list)
Key_Func bound_key_function (int key, int state, Key_Binding *list)
Key_Func bound_key_function (int key, int state)
void default_key_function (Key_Func f)

Static Public Member Functions

static int kf_default (int c, Fl_Text_Editor *e)
static int kf_ignore (int c, Fl_Text_Editor *e)
static int kf_backspace (int c, Fl_Text_Editor *e)
static int kf_enter (int c, Fl_Text_Editor *e)
static int kf_move (int c, Fl_Text_Editor *e)
static int kf_shift_move (int c, Fl_Text_Editor *e)
static int kf_ctrl_move (int c, Fl_Text_Editor *e)
static int kf_c_s_move (int c, Fl_Text_Editor *e)
static int kf_meta_move (int c, Fl_Text_Editor *e)
static int kf_m_s_move (int c, Fl_Text_Editor *e)
static int kf_home (int, Fl_Text_Editor *e)
static int kf_end (int c, Fl_Text_Editor *e)
static int kf_left (int c, Fl_Text_Editor *e)
static int kf_up (int c, Fl_Text_Editor *e)
static int kf_right (int c, Fl_Text_Editor *e)
static int kf_down (int c, Fl_Text_Editor *e)
static int kf_page_up (int c, Fl_Text_Editor *e)
static int kf_page_down (int c, Fl_Text_Editor *e)
static int kf_insert (int c, Fl_Text_Editor *e)
static int kf_delete (int c, Fl_Text_Editor *e)
static int kf_copy (int c, Fl_Text_Editor *e)
static int kf_cut (int c, Fl_Text_Editor *e)
static int kf_paste (int c, Fl_Text_Editor *e)
static int kf_select_all (int c, Fl_Text_Editor *e)
static int kf_undo (int c, Fl_Text_Editor *e)

Protected Member Functions

int handle_key ()
void maybe_do_callback ()

Protected Attributes

int insert_mode_
Key_Bindingkey_bindings
Key_Func default_key_function_

Static Protected Attributes

static Key_Bindingglobal_key_bindings = 0

Detailed Description

This is the FLTK text editor widget. It allows the user to edit multiple lines of text and supports highlighting and scrolling. The buffer that is displayed in the widget is managed by the Fl_Text_Buffer class.

Definition at line 49 of file Fl_Text_Editor.H.


Member Typedef Documentation

typedef int(* Fl_Text_Editor::Key_Func)(int key, Fl_Text_Editor *editor)

Key function binding callback type

Definition at line 52 of file Fl_Text_Editor.H.


Constructor & Destructor Documentation

Fl_Text_Editor::Fl_Text_Editor ( int  X,
int  Y,
int  W,
int  H,
const char *  l = 0 
)

The constructor creates a new text editor widget.

Definition at line 80 of file Fl_Text_Editor.cxx.

References add_default_key_bindings(), default_key_function(), insert_mode_, key_bindings, kf_default(), and Fl_Text_Display::mCursorOn.

Fl_Text_Editor::~Fl_Text_Editor ( ) [inline]

Definition at line 63 of file Fl_Text_Editor.H.


Member Function Documentation

void Fl_Text_Editor::add_default_key_bindings ( Key_Binding **  list)

Adds all of the default editor key bindings to the specified key binding list.

Definition at line 173 of file Fl_Text_Editor.cxx.

References add_key_binding(), func, i, key, and state.

Referenced by Fl_Text_Editor().

void Fl_Text_Editor::add_key_binding ( int  key,
int  state,
Key_Func  function,
Key_Binding **  list 
)
void Fl_Text_Editor::add_key_binding ( int  key,
int  state,
Key_Func  f 
) [inline]

Adds a key of state "state" with the function "function"

Definition at line 80 of file Fl_Text_Editor.H.

References add_key_binding().

Referenced by add_key_binding().

Fl_Text_Editor::Key_Func Fl_Text_Editor::bound_key_function ( int  key,
int  state,
Key_Binding list 
)
Key_Func Fl_Text_Editor::bound_key_function ( int  key,
int  state 
) [inline]

Returns the function associated with a key binding.

Definition at line 92 of file Fl_Text_Editor.H.

References bound_key_function().

Referenced by bound_key_function().

void Fl_Text_Editor::default_key_function ( Key_Func  f) [inline]

Sets the default key function for unassigned keys.

Definition at line 95 of file Fl_Text_Editor.H.

References f.

Referenced by CodeViewer::CodeViewer(), and Fl_Text_Editor().

void Fl_Text_Editor::insert_mode ( int  b) [inline]

Sets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position.

Definition at line 70 of file Fl_Text_Editor.H.

References b.

Referenced by kf_default(), and kf_insert().

int Fl_Text_Editor::insert_mode ( ) [inline]

Gets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position.

Definition at line 76 of file Fl_Text_Editor.H.

Referenced by handle(), and handle_key().

int Fl_Text_Editor::kf_backspace ( int  c,
Fl_Text_Editor e 
) [static]
int Fl_Text_Editor::kf_c_s_move ( int  c,
Fl_Text_Editor e 
) [static]

Extends the current selection in the direction indicated by control key c.

Definition at line 402 of file Fl_Text_Editor.cxx.

References Fl_Text_Display::fl_text_drag_me, Fl_Text_Display::insert_position(), and kf_ctrl_move().

int Fl_Text_Editor::kf_copy ( int  c,
Fl_Text_Editor e 
) [static]

Does a copy of selected text or the current character in the current buffer.

Definition at line 468 of file Fl_Text_Editor.cxx.

References Fl_Text_Display::buffer(), Fl::copy(), and Fl_Text_Display::show_insert_position().

Referenced by kf_cut().

int Fl_Text_Editor::kf_cut ( int  c,
Fl_Text_Editor e 
) [static]

Does a cut of selected text in the current buffer.

Definition at line 478 of file Fl_Text_Editor.cxx.

References Fl_Widget::do_callback(), FL_WHEN_CHANGED, kf_copy(), Fl_Widget::set_changed(), and Fl_Widget::when().

int Fl_Text_Editor::kf_default ( int  c,
Fl_Text_Editor e 
) [static]
int Fl_Text_Editor::kf_delete ( int  c,
Fl_Text_Editor e 
) [static]

Does a delete of selected text or the current character in the current buffer.

Definition at line 453 of file Fl_Text_Editor.cxx.

References Fl_Text_Display::buffer(), Fl_Widget::do_callback(), FL_WHEN_CHANGED, Fl_Text_Display::insert_position(), Fl_Widget::set_changed(), Fl_Text_Display::show_insert_position(), and Fl_Widget::when().

int Fl_Text_Editor::kf_down ( int  c,
Fl_Text_Editor e 
) [static]

Moves the text cursor one line down.

Definition at line 433 of file Fl_Text_Editor.cxx.

References FL_Down, and kf_move().

int Fl_Text_Editor::kf_end ( int  c,
Fl_Text_Editor e 
) [static]

Moves the text cursor to the end of the current line.

Definition at line 414 of file Fl_Text_Editor.cxx.

References FL_End, and kf_move().

int Fl_Text_Editor::kf_enter ( int  c,
Fl_Text_Editor e 
) [static]
int Fl_Text_Editor::kf_home ( int  ,
Fl_Text_Editor e 
) [static]

Moves the text cursor to the beginning of the current line.

Definition at line 409 of file Fl_Text_Editor.cxx.

References FL_Home, and kf_move().

int Fl_Text_Editor::kf_ignore ( int  c,
Fl_Text_Editor e 
) [static]

Ignores the keypress

Definition at line 249 of file Fl_Text_Editor.cxx.

Referenced by CodeViewer::CodeViewer().

int Fl_Text_Editor::kf_insert ( int  c,
Fl_Text_Editor e 
) [static]

Toggles the insert mode in the text editor.

Definition at line 447 of file Fl_Text_Editor.cxx.

References insert_mode().

int Fl_Text_Editor::kf_left ( int  c,
Fl_Text_Editor e 
) [static]

Moves the text cursor one character to the left.

Definition at line 419 of file Fl_Text_Editor.cxx.

References FL_Left, and kf_move().

int Fl_Text_Editor::kf_m_s_move ( int  c,
Fl_Text_Editor e 
) [static]

Extends the current selection in the direction indicated by meta key c.

Definition at line 395 of file Fl_Text_Editor.cxx.

References Fl_Text_Display::fl_text_drag_me, Fl_Text_Display::insert_position(), and kf_meta_move().

int Fl_Text_Editor::kf_meta_move ( int  c,
Fl_Text_Editor e 
) [static]
int Fl_Text_Editor::kf_page_down ( int  c,
Fl_Text_Editor e 
) [static]

Moves the text cursor down one page.

Definition at line 443 of file Fl_Text_Editor.cxx.

References FL_Page_Down, and kf_move().

int Fl_Text_Editor::kf_page_up ( int  c,
Fl_Text_Editor e 
) [static]

Moves the text cursor up one page.

Definition at line 438 of file Fl_Text_Editor.cxx.

References FL_Page_Up, and kf_move().

int Fl_Text_Editor::kf_paste ( int  c,
Fl_Text_Editor e 
) [static]

Does a paste of selected text in the current buffer.

Definition at line 487 of file Fl_Text_Editor.cxx.

References Fl_Widget::do_callback(), FL_WHEN_CHANGED, Fl::paste(), Fl_Widget::set_changed(), Fl_Text_Display::show_insert_position(), and Fl_Widget::when().

int Fl_Text_Editor::kf_right ( int  c,
Fl_Text_Editor e 
) [static]

Moves the text cursor one character to the right.

Definition at line 429 of file Fl_Text_Editor.cxx.

References FL_Right, and kf_move().

int Fl_Text_Editor::kf_select_all ( int  c,
Fl_Text_Editor e 
) [static]

Selects all text in the current buffer.

Definition at line 497 of file Fl_Text_Editor.cxx.

References Fl_Text_Display::buffer(), and Fl::copy().

int Fl_Text_Editor::kf_shift_move ( int  c,
Fl_Text_Editor e 
) [static]

Extends the current selection in the direction of key c.

Definition at line 316 of file Fl_Text_Editor.cxx.

References Fl_Text_Display::buffer(), Fl::copy(), Fl_Text_Display::fl_text_drag_me, Fl_Text_Display::insert_position(), and kf_move().

int Fl_Text_Editor::kf_undo ( int  c,
Fl_Text_Editor e 
) [static]
int Fl_Text_Editor::kf_up ( int  c,
Fl_Text_Editor e 
) [static]

Moves the text cursor one line up.

Definition at line 424 of file Fl_Text_Editor.cxx.

References FL_Up, and kf_move().

void Fl_Text_Editor::maybe_do_callback ( ) [protected]

does or does not a callback according to changed() and when() settings

Definition at line 552 of file Fl_Text_Editor.cxx.

References Fl_Widget::changed(), Fl_Widget::do_callback(), FL_WHEN_NOT_CHANGED, and Fl_Widget::when().

Referenced by handle().

void Fl_Text_Editor::remove_all_key_bindings ( ) [inline]

Removes all of the key bindings associated with the text editor or list.

Definition at line 88 of file Fl_Text_Editor.H.

References remove_all_key_bindings().

Referenced by CodeViewer::CodeViewer(), and remove_all_key_bindings().

void Fl_Text_Editor::remove_all_key_bindings ( Key_Binding **  list)

Removes all of the key bindings associated with the text editor or list.

Definition at line 194 of file Fl_Text_Editor.cxx.

References Fl_Text_Editor::Key_Binding::next.

void Fl_Text_Editor::remove_key_binding ( int  key,
int  state 
) [inline]

Removes the key binding associated with the key "key" of state "state".

Definition at line 84 of file Fl_Text_Editor.H.

References remove_key_binding().

Referenced by remove_key_binding().

void Fl_Text_Editor::remove_key_binding ( int  key,
int  state,
Key_Binding **  list 
)

Removes the key binding associated with the key "key" of state "state"

Definition at line 204 of file Fl_Text_Editor.cxx.

References Fl_Text_Editor::Key_Binding::next.


Member Data Documentation

Definition at line 132 of file Fl_Text_Editor.H.

Referenced by handle_key().

Definition at line 131 of file Fl_Text_Editor.H.

Referenced by handle_key().

Definition at line 129 of file Fl_Text_Editor.H.

Referenced by Fl_Text_Editor().


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