Simplify and fix the code of Fl_Scroll::bbox()

Declare Fl_Scroll::bbox() and Fl_Scroll::recalc_scrollbars() 'const'.
These methods don't change the Fl_Scroll widget.

Use Fl_Scroll::recalc_scrollbars() in Fl_Scroll::bbox() to simplify
the code and to avoid code duplication.

bbox() can now be called at any time and returns the correct values,
no matter if draw() has been called before.
This commit is contained in:
Albrecht Schlosser
2021-10-06 18:35:00 +02:00
parent cf20474d7c
commit 3ee8864bfc
2 changed files with 33 additions and 27 deletions
+2 -2
View File
@@ -130,11 +130,11 @@ protected: // (STR#1895)
Fl_Scrollbar_Data hscroll; ///< horizontal scrollbar region + values
Fl_Scrollbar_Data vscroll; ///< vertical scrollbar region + values
} ScrollInfo;
void recalc_scrollbars(ScrollInfo &si);
void recalc_scrollbars(ScrollInfo &si) const;
protected:
void bbox(int&,int&,int&,int&);
void bbox(int&,int&,int&,int&) const;
void draw();
public: