diff options
| author | Greg Ercolano <erco@seriss.com> | 2016-07-19 20:18:18 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2016-07-19 20:18:18 +0000 |
| commit | dfd97e46397868e302c659dba71ade45e69468ed (patch) | |
| tree | 68f6a1b3f4a17b6fc3ef064c1f681bb1036377b3 /src | |
| parent | dc8a00fbba213c9ea8632c046230ecc677b996f9 (diff) | |
Bringing over this fix from 1.3 current to the porting branch.
Fixes STR #3305; adds tab_nav() method allowing Fl_Text_Editor
to honor tab key focus navigation.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11820 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Text_Editor.cxx | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx index b2ec38456..04c9c68e7 100644 --- a/src/Fl_Text_Editor.cxx +++ b/src/Fl_Text_Editor.cxx @@ -660,6 +660,57 @@ int Fl_Text_Editor::handle(int event) { return Fl_Text_Display::handle(event); } +#if FLTK_ABI_VERSION >= 10304 +/** +Enables or disables Tab key focus navigation. + +When disabled (default), tab characters are inserted into +Fl_Text_Editor. Only the mouse can change focus. This behavior is +desireable when Fl_Text_Editor is used, e.g. in a source code editor. + +When enabled, Tab navigates focus to the next widget, and Shift-Tab +navigates focus to the previous widget. This behavior is desireable +when Fl_Text_Editor is used e.g. in a database input form. + +Currently, this method is implemented as a convenience method +that adjusts the key bindings for the Tab key. This implementation +detail may change in the future. Know that changing the editor's +key bindings for Tab and Shift-Tab may affect tab navigation. + +\param [in] val If \p val is 0, Tab inserts a tab character (default).<br> + If \p val is 1, Tab navigates widget focus. + +\see tab_nav(), Fl::OPTION_ARROW_FOCUS. +\version 1.3.4 ABI feature +*/ +void Fl_Text_Editor::tab_nav(int val) { + if ( val ) + add_key_binding(FL_Tab, 0, kf_ignore); + else + remove_key_binding(FL_Tab, 0); +} + +/** +Check if Tab focus navigation is enabled. + +If disabled (default), hitting Tab inserts a tab character into the +editor buffer. + +If enabled, hitting Tab navigates focus to the next widget, +and Shift-Tab navigates focus to the previous widget. + +\returns if Tab inserts tab characters or moves the focus +\retval 0 Tab inserts tab characters (default) +\retval 1 Tab navigation is enabled. + +\see tab_nav(int), Fl::OPTION_ARROW_FOCUS. +\version 1.3.4 ABI feature +*/ +int Fl_Text_Editor::tab_nav() const { + return (bound_key_function(FL_Tab,0)==kf_ignore) ? 1 : 0; +} +#endif + // // End of "$Id$". // |
