#include <Fl_Text_Editor.H>
Public Types | |
typedef int(* | Key_Func )(int key, Fl_Text_Editor *editor) |
Key function binding callback type. | |
Public Member Functions | |
void | add_default_key_bindings (Key_Binding **list) |
Adds all of the default editor key bindings to the specified key binding list. | |
void | add_key_binding (int key, int state, Key_Func f) |
Adds a key of state "state" with the function "function". | |
void | add_key_binding (int key, int state, Key_Func f, Key_Binding **list) |
Adds a key of state "state" with the function "function". | |
Key_Func | bound_key_function (int key, int state) |
Returns the function associated with a key binding. | |
Key_Func | bound_key_function (int key, int state, Key_Binding *list) |
Returns the function associated with a key binding. | |
void | default_key_function (Key_Func f) |
Sets the default key function for unassigned keys. | |
Fl_Text_Editor (int X, int Y, int W, int H, const char *l=0) | |
The constructor creates a new text editor widget. | |
virtual int | handle (int e) |
Event handling. | |
int | insert_mode () |
Gets the current insert mode; if non-zero, new text is inserted before the current cursor position. | |
void | insert_mode (int b) |
Sets the current insert mode; if non-zero, new text is inserted before the current cursor position. | |
void | remove_all_key_bindings () |
Removes all of the key bindings associated with the text editor or list. | |
void | remove_all_key_bindings (Key_Binding **list) |
Removes all of the key bindings associated with the text editor or list. | |
void | remove_key_binding (int key, int state) |
Removes the key binding associated with the key "key" of state "state". | |
void | remove_key_binding (int key, int state, Key_Binding **list) |
Removes the key binding associated with the key "key" of state "state". | |
Static Public Member Functions | |
static int | kf_backspace (int c, Fl_Text_Editor *e) |
Does a backspace in the current buffer. | |
static int | kf_c_s_move (int c, Fl_Text_Editor *e) |
Extends the current selection in the direction indicated by control key c. | |
static int | kf_copy (int c, Fl_Text_Editor *e) |
Does a copy of selected text or the current character in the current buffer. | |
static int | kf_ctrl_move (int c, Fl_Text_Editor *e) |
Moves the current text cursor in the direction indicated by control key. | |
static int | kf_cut (int c, Fl_Text_Editor *e) |
Does a cut of selected text in the current buffer. | |
static int | kf_default (int c, Fl_Text_Editor *e) |
Inserts the text associated with the key. | |
static int | kf_delete (int c, Fl_Text_Editor *e) |
Does a delete of selected text or the current character in the current buffer. | |
static int | kf_down (int c, Fl_Text_Editor *e) |
Moves the text cursor one line down. | |
static int | kf_end (int c, Fl_Text_Editor *e) |
Moves the text cursor to the end of the current line. | |
static int | kf_enter (int c, Fl_Text_Editor *e) |
Inserts a newline at the current cursor position. | |
static int | kf_home (int, Fl_Text_Editor *e) |
Moves the text cursor to the beginning of the current line. | |
static int | kf_ignore (int c, Fl_Text_Editor *e) |
Ignores the keypress. | |
static int | kf_insert (int c, Fl_Text_Editor *e) |
Toggles the insert mode in the text editor. | |
static int | kf_left (int c, Fl_Text_Editor *e) |
Moves the text cursor one character to the left. | |
static int | kf_m_s_move (int c, Fl_Text_Editor *e) |
Extends the current selection in the direction indicated by meta key c. | |
static int | kf_meta_move (int c, Fl_Text_Editor *e) |
Moves the current text cursor in the direction indicated by meta key. | |
static int | kf_move (int c, Fl_Text_Editor *e) |
Moves the text cursor in the direction indicated by key c. | |
static int | kf_page_down (int c, Fl_Text_Editor *e) |
Moves the text cursor down one page. | |
static int | kf_page_up (int c, Fl_Text_Editor *e) |
Moves the text cursor up one page. | |
static int | kf_paste (int c, Fl_Text_Editor *e) |
Does a paste of selected text in the current buffer. | |
static int | kf_right (int c, Fl_Text_Editor *e) |
Moves the text cursor one character to the right. | |
static int | kf_select_all (int c, Fl_Text_Editor *e) |
Selects all text in the current buffer. | |
static int | kf_shift_move (int c, Fl_Text_Editor *e) |
Extends the current selection in the direction of key c. | |
static int | kf_undo (int c, Fl_Text_Editor *e) |
Undo last edit in the current buffer. | |
static int | kf_up (int c, Fl_Text_Editor *e) |
Moves the text cursor one line up. | |
Protected Member Functions | |
int | handle_key () |
Handles a key press in the editor. | |
void | maybe_do_callback () |
does or does not a callback according to changed() and when() settings | |
Classes | |
struct | Key_Binding |
Simple linked list associating a key/state to a function. More... |
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.
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.
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.
Key_Func Fl_Text_Editor::bound_key_function | ( | int | key, | |
int | state | |||
) | [inline] |
Returns the function associated with a key binding.
Fl_Text_Editor::Key_Func Fl_Text_Editor::bound_key_function | ( | int | key, | |
int | state, | |||
Key_Binding * | list | |||
) |
Returns the function associated with a key binding.
void Fl_Text_Editor::default_key_function | ( | Key_Func | f | ) | [inline] |
Sets the default key function for unassigned keys.
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.
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.
int Fl_Text_Editor::kf_backspace | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Does a backspace in the current buffer.
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.
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.
int Fl_Text_Editor::kf_cut | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Does a cut of selected text in the current buffer.
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.
int Fl_Text_Editor::kf_down | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor one line down.
int Fl_Text_Editor::kf_end | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor to the end of the current line.
int Fl_Text_Editor::kf_home | ( | int | , | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor to the beginning of the current line.
int Fl_Text_Editor::kf_insert | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Toggles the insert mode in the text editor.
int Fl_Text_Editor::kf_left | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor one character to the left.
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.
int Fl_Text_Editor::kf_move | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor in the direction indicated by key c.
int Fl_Text_Editor::kf_page_down | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor down one page.
int Fl_Text_Editor::kf_page_up | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor up one page.
int Fl_Text_Editor::kf_paste | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Does a paste of selected text in the current buffer.
int Fl_Text_Editor::kf_right | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor one character to the right.
int Fl_Text_Editor::kf_select_all | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Selects all text in the current buffer.
int Fl_Text_Editor::kf_shift_move | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Extends the current selection in the direction of key c.
int Fl_Text_Editor::kf_undo | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Undo last edit in the current buffer.
Also deselect previous selection.
int Fl_Text_Editor::kf_up | ( | int | c, | |
Fl_Text_Editor * | e | |||
) | [static] |
Moves the text cursor one line up.
void Fl_Text_Editor::remove_all_key_bindings | ( | ) | [inline] |
Removes all of the key bindings associated with the text editor or list.
void Fl_Text_Editor::remove_all_key_bindings | ( | Key_Binding ** | list | ) |
Removes all of the key bindings associated with the text editor or list.
void Fl_Text_Editor::remove_key_binding | ( | int | key, | |
int | state | |||
) | [inline] |
Removes the key binding associated with the key "key" of state "state".