summaryrefslogtreecommitdiff
path: root/src/Fl_Text_Editor.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-01-05 13:51:30 +0100
committerGitHub <noreply@github.com>2023-01-05 13:51:30 +0100
commit8826dca1066361b474139bcc5aeed2e3a5246ed0 (patch)
tree6819629ff3f9f014269c7cee090ab20a824af6ad /src/Fl_Text_Editor.cxx
parent4d1a508c7e4d28fd53129da79f068a275d7160bd (diff)
Add close buttons for individual tabs in Fl_Tabs (#628)
Add close buttons for Fl_Tabs Introducing callback reasons FLUID shows all FL_WHEN_... options Adding Fl_Tabs overflow types Improved test/tabs to show new features
Diffstat (limited to 'src/Fl_Text_Editor.cxx')
-rw-r--r--src/Fl_Text_Editor.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx
index 139350048..81dc2f441 100644
--- a/src/Fl_Text_Editor.cxx
+++ b/src/Fl_Text_Editor.cxx
@@ -239,7 +239,7 @@ int Fl_Text_Editor::kf_default(int c, Fl_Text_Editor* e) {
else e->overstrike(s);
e->show_insert_position();
e->set_changed();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED);
return 1;
}
@@ -268,7 +268,7 @@ int Fl_Text_Editor::kf_backspace(int, Fl_Text_Editor* e) {
kill_selection(e);
e->show_insert_position();
e->set_changed();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED);
return 1;
}
@@ -280,7 +280,7 @@ int Fl_Text_Editor::kf_enter(int, Fl_Text_Editor* e) {
e->insert("\n");
e->show_insert_position();
e->set_changed();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED);
return 1;
}
@@ -544,7 +544,7 @@ int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
kill_selection(e);
e->show_insert_position();
e->set_changed();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED);
return 1;
}
@@ -567,7 +567,7 @@ int Fl_Text_Editor::kf_cut(int c, Fl_Text_Editor* e) {
kf_copy(c, e);
kill_selection(e);
e->set_changed();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED);
return 1;
}
@@ -580,7 +580,7 @@ int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
Fl::paste(*e, 1);
e->show_insert_position();
e->set_changed();
- if (e->when()&FL_WHEN_CHANGED) e->do_callback();
+ if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED);
return 1;
}
@@ -636,7 +636,7 @@ int Fl_Text_Editor::handle_key() {
}
show_insert_position();
set_changed();
- if (when()&FL_WHEN_CHANGED) do_callback();
+ if (when()&FL_WHEN_CHANGED) do_callback(FL_REASON_CHANGED);
return 1;
}
@@ -651,10 +651,11 @@ int Fl_Text_Editor::handle_key() {
}
/** does or does not a callback according to changed() and when() settings */
-void Fl_Text_Editor::maybe_do_callback() {
+void Fl_Text_Editor::maybe_do_callback(Fl_Callback_Reason reason) {
// printf("Fl_Text_Editor::maybe_do_callback()\n");
// printf("changed()=%d, when()=%x\n", changed(), when());
- if (changed() || (when()&FL_WHEN_NOT_CHANGED)) do_callback();
+ if (changed() || (when()&FL_WHEN_NOT_CHANGED))
+ do_callback(reason);
}
int Fl_Text_Editor::handle(int event) {
@@ -679,7 +680,7 @@ int Fl_Text_Editor::handle(int event) {
if (buffer()->selected()) redraw(); // Redraw selections...
// FALLTHROUGH
case FL_HIDE:
- if (when() & FL_WHEN_RELEASE) maybe_do_callback();
+ if (when() & FL_WHEN_RELEASE) maybe_do_callback(FL_REASON_LOST_FOCUS);
return 1;
case FL_KEYBOARD:
@@ -697,7 +698,7 @@ int Fl_Text_Editor::handle(int event) {
else overstrike(Fl::event_text());
show_insert_position();
set_changed();
- if (when()&FL_WHEN_CHANGED) do_callback();
+ if (when()&FL_WHEN_CHANGED) do_callback(FL_REASON_CHANGED);
return 1;
case FL_ENTER:
@@ -719,7 +720,7 @@ int Fl_Text_Editor::handle(int event) {
Fl::paste(*this, 0);
Fl::focus(this);
set_changed();
- if (when()&FL_WHEN_CHANGED) do_callback();
+ if (when()&FL_WHEN_CHANGED) do_callback(FL_REASON_CHANGED);
return 1;
}
break;