summaryrefslogtreecommitdiff
path: root/src/Fl_Scroll.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-05-25 17:41:00 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-05-25 17:41:00 +0200
commit0f3619ba0e725a6a9d57b9da328f3b1e2a0cd150 (patch)
tree037b2784c1863bf5c3b928feb64e9da7eedceed3 /src/Fl_Scroll.cxx
parent9abbff2078e2a092ecc252f6b147c24fe567f616 (diff)
Reimplement Fl_Group::delete_child(int) for Fl_Scroll
Diffstat (limited to 'src/Fl_Scroll.cxx')
-rw-r--r--src/Fl_Scroll.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Fl_Scroll.cxx b/src/Fl_Scroll.cxx
index 6d754d134..f0dab47fa 100644
--- a/src/Fl_Scroll.cxx
+++ b/src/Fl_Scroll.cxx
@@ -44,6 +44,33 @@ void Fl_Scroll::fix_scrollbar_order() {
}
}
+
+/**
+ Removes the widget at \p index from the group and deletes it.
+
+ This method does nothing if \p index is out of bounds or
+ if Fl_Group::child(index) is one of the scrollbars.
+
+ \param[in] index index of child to be removed
+
+ \returns success (0) or error code
+ \retval 0 success
+ \retval 1 index out of range
+ \retval 2 widget not allowed to be removed (see note)
+
+ \see Fl_Group::delete_child()
+
+ \since FLTK 1.4.0
+*/
+int Fl_Scroll::delete_child(int index) {
+ if (index < 0 || index >= children())
+ return 1;
+ Fl_Widget *w = child(index);
+ if (w == &scrollbar || w == &hscrollbar)
+ return 2; // can't delete scrollbars
+ return Fl_Group::delete_child(index);
+}
+
// Draw widget's background and children within a specific clip region
// So widget can just redraw damaged parts.
//