|
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) ![]() |
#include <Fl_Text_Editor.H>


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_Binding * | key_bindings |
| Key_Func | default_key_function_ |
Static Protected Attributes | |
| static Key_Binding * | global_key_bindings = 0 |
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.
| 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.
| 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.
| 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 | ||
| ) |
Adds a key of state "state" with the function "function"
Definition at line 214 of file Fl_Text_Editor.cxx.
References Fl_Text_Editor::Key_Binding::function, key, Fl_Text_Editor::Key_Binding::key, Fl_Text_Editor::Key_Binding::next, state, and Fl_Text_Editor::Key_Binding::state.
Referenced by add_default_key_bindings(), and CodeEditor::CodeEditor().
| 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 | ||
| ) |
Returns the function associated with a key binding.
Definition at line 183 of file Fl_Text_Editor.cxx.
References FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::Key_Binding::function, Fl_Text_Editor::Key_Binding::key, Fl_Text_Editor::Key_Binding::next, and Fl_Text_Editor::Key_Binding::state.
Referenced by handle_key().
| 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().
| int Fl_Text_Editor::handle | ( | int | e | ) | [virtual] |
Event handling.
Reimplemented from Fl_Text_Display.
Reimplemented in CodeViewer.
Definition at line 558 of file Fl_Text_Editor.cxx.
References Fl_Widget::active_r(), Fl::belowmouse(), Fl_Text_Display::buffer(), Fl_Window::cursor(), Fl_Text_Display::CURSOR_POS, Fl_Widget::do_callback(), Fl_Text_Display::DRAG_NONE, Fl_Text_Display::dragType, Fl::event_button(), Fl::event_text(), Fl::event_x(), Fl::event_y(), fl_beep(), FL_CURSOR_NONE, FL_DND_DRAG, FL_DND_ENTER, FL_DND_LEAVE, FL_DND_RELEASE, FL_ENTER, FL_FOCUS, FL_HIDE, FL_KEYBOARD, FL_PASTE, FL_PUSH, FL_SHORTCUT, FL_UNFOCUS, FL_WHEN_CHANGED, FL_WHEN_RELEASE, Fl_Group::focus(), Fl_Group::handle(), handle_key(), Fl_Text_Display::insert(), insert_mode(), Fl_Text_Display::insert_position(), maybe_do_callback(), Fl_Text_Display::mCursorOn, Fl_Text_Display::overstrike(), Fl::paste(), Fl_Widget::redraw(), Fl_Text_Buffer::remove_selection(), Fl_Widget::set_changed(), Fl_Text_Display::shortcut(), Fl_Text_Display::show_cursor(), Fl_Text_Display::show_insert_position(), Fl_Widget::test_shortcut(), Fl::test_shortcut(), Fl_Text_Buffer::unselect(), Fl::visible_focus(), Fl_Widget::when(), Fl_Widget::window(), and Fl_Text_Display::xy_to_position().
| int Fl_Text_Editor::handle_key | ( | ) | [protected] |
Handles a key press in the editor
Definition at line 518 of file Fl_Text_Editor.cxx.
References bound_key_function(), Fl_Text_Display::buffer(), Fl::compose(), default_key_function_, Fl_Widget::do_callback(), Fl::event_key(), Fl::event_length(), Fl::event_state(), Fl::event_text(), f, FL_ALT, FL_CTRL, FL_META, FL_SHIFT, FL_WHEN_CHANGED, global_key_bindings, Fl_Text_Display::insert(), insert_mode(), Fl_Text_Display::insert_position(), key, key_bindings, Fl_Text_Display::overstrike(), Fl_Text_Buffer::prev_char_clipped(), Fl_Text_Buffer::select(), Fl_Widget::set_changed(), Fl_Text_Display::show_insert_position(), state, and Fl_Widget::when().
Referenced by handle().
| 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] |
Does a backspace in the current buffer.
Definition at line 253 of file Fl_Text_Editor.cxx.
References Fl_Text_Display::buffer(), Fl_Widget::do_callback(), FL_WHEN_CHANGED, Fl_Text_Display::insert_position(), Fl_Text_Display::move_left(), Fl_Widget::set_changed(), Fl_Text_Display::show_insert_position(), and Fl_Widget::when().
| 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_ctrl_move | ( | int | c, |
| Fl_Text_Editor * | e | ||
| ) | [static] |
Moves the current text cursor in the direction indicated by control key
Definition at line 327 of file Fl_Text_Editor.cxx.
References Fl_Text_Display::buffer(), Fl::copy(), Fl_Text_Display::count_lines(), Fl_Text_Display::dragPos, FL_Down, FL_End, FL_Home, FL_Left, FL_Page_Down, FL_Page_Up, FL_Right, FL_Up, Fl_Text_Display::insert_position(), Fl_Text_Display::mHorizOffset, Fl_Text_Display::mLineStarts, Fl_Text_Display::mNVisibleLines, Fl_Text_Display::mTopLineNum, Fl_Text_Display::next_word(), Fl_Text_Display::previous_word(), Fl_Text_Display::scroll(), and Fl_Text_Display::show_insert_position().
Referenced by kf_c_s_move().
| 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] |
Inserts the text associated with the key
Definition at line 234 of file Fl_Text_Editor.cxx.
References Fl_Widget::do_callback(), FL_WHEN_CHANGED, Fl_Text_Display::insert(), insert_mode(), Fl_Text_Display::overstrike(), Fl_Widget::set_changed(), Fl_Text_Display::show_insert_position(), and Fl_Widget::when().
Referenced by Fl_Text_Editor().
| 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.
| 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.
| int Fl_Text_Editor::kf_enter | ( | int | c, |
| Fl_Text_Editor * | e | ||
| ) | [static] |
Inserts a newline at the current cursor position
Definition at line 267 of file Fl_Text_Editor.cxx.
References Fl_Widget::do_callback(), FL_WHEN_CHANGED, Fl_Text_Display::insert(), Fl_Widget::set_changed(), Fl_Text_Display::show_insert_position(), and Fl_Widget::when().
| 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.
| 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.
| 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] |
Moves the current text cursor in the direction indicated by meta key
Definition at line 367 of file Fl_Text_Editor.cxx.
References Fl_Text_Display::buffer(), Fl::copy(), Fl_Text_Display::count_lines(), Fl_Text_Display::dragPos, FL_Down, FL_End, FL_Home, FL_Left, FL_Right, FL_Up, Fl_Text_Display::insert_position(), kf_move(), Fl_Text_Display::scroll(), and Fl_Text_Display::show_insert_position().
Referenced by kf_m_s_move().
| int Fl_Text_Editor::kf_move | ( | int | c, |
| Fl_Text_Editor * | e | ||
| ) | [static] |
Moves the text cursor in the direction indicated by key c.
Definition at line 278 of file Fl_Text_Editor.cxx.
References Fl_Text_Display::buffer(), Fl::copy(), Fl_Text_Display::dragPos, FL_Down, FL_End, FL_Home, FL_Left, FL_Page_Down, FL_Page_Up, FL_Right, FL_Up, i, Fl_Text_Display::insert_position(), Fl_Text_Display::mNVisibleLines, Fl_Text_Display::move_down(), Fl_Text_Display::move_left(), Fl_Text_Display::move_right(), Fl_Text_Display::move_up(), and Fl_Text_Display::show_insert_position().
Referenced by kf_down(), kf_end(), kf_home(), kf_left(), kf_meta_move(), kf_page_down(), kf_page_up(), kf_right(), kf_shift_move(), and kf_up().
| 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.
| 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] |
Undo last edit in the current buffer. Also deselect previous selection.
Definition at line 505 of file Fl_Text_Editor.cxx.
References Fl_Text_Display::buffer(), Fl::copy(), 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_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.
| 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.
Key_Func Fl_Text_Editor::default_key_function_ [protected] |
Definition at line 132 of file Fl_Text_Editor.H.
Referenced by handle_key().
Fl_Text_Editor::Key_Binding * Fl_Text_Editor::global_key_bindings = 0 [static, protected] |
Definition at line 131 of file Fl_Text_Editor.H.
Referenced by handle_key().
int Fl_Text_Editor::insert_mode_ [protected] |
Definition at line 129 of file Fl_Text_Editor.H.
Referenced by Fl_Text_Editor().
Key_Binding* Fl_Text_Editor::key_bindings [protected] |
Definition at line 130 of file Fl_Text_Editor.H.
Referenced by CodeViewer::CodeViewer(), Fl_Text_Editor(), and handle_key().