diff options
| author | Greg Ercolano <erco@seriss.com> | 2017-11-02 21:14:40 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2017-11-02 21:14:40 +0000 |
| commit | 127147ca976a3151f8a6e307d0d7e482e987d29f (patch) | |
| tree | 93715f9eb43c62cfe1bb32f63d14b74759eec4c6 /FL/Fl_Text_Display.H | |
| parent | 3256932e2a6933ec8d88322b38fc049026ad4b07 (diff) | |
Addresses STR# 3423; adds missing scrollbar_size() methods and honors global Fl::scrollbar_size().
Includes mods to unittest's scrollbar size test.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12538 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Text_Display.H')
| -rw-r--r-- | FL/Fl_Text_Display.H | 70 |
1 files changed, 59 insertions, 11 deletions
diff --git a/FL/Fl_Text_Display.H b/FL/Fl_Text_Display.H index 2ea96dd17..22853bb46 100644 --- a/FL/Fl_Text_Display.H +++ b/FL/Fl_Text_Display.H @@ -24,6 +24,7 @@ #ifndef FL_TEXT_DISPLAY_H #define FL_TEXT_DISPLAY_H +#include <FL/Fl.H> // Fl::scrollbar_size() #include "fl_draw.H" #include "Fl_Group.H" #include "Fl_Widget.H" @@ -222,19 +223,66 @@ public: */ void cursor_color(Fl_Color n) {mCursor_color = n;} - /** - Gets the width/height of the scrollbars. - \return width of scrollbars - */ - int scrollbar_width() const { return scrollbar_width_; } - /** - Sets the width/height of the scrollbars. - \param W width of scrollbars - */ - void scrollbar_width(int W) { scrollbar_width_ = W; } + This method has been deprecated, existing for backwards compatibility only. + Use scrollbar_size() instead. + This method returns the global value Fl::scrollbar_size() unless + a specific scrollbar_width_ has been set. + \todo This method should eventually be removed. + */ + int scrollbar_width() const { + return scrollbar_width_ ? scrollbar_width_ : Fl::scrollbar_size(); + } + + /** + This method has been deprecated, existing for backwards compatibility only. + Use scrollbar_size(int) instead. + This method sets the global Fl::scrollbar_size(), and forces this + instance of the widget to use it. + \todo This method should eventually be removed + */ + void scrollbar_width(int width) { + Fl::scrollbar_size(width); + scrollbar_width_ = 0; + } /** + Gets the current size of the scrollbars' troughs, in pixels. + + If this value is zero (default), this widget will use the + Fl::scrollbar_size() value as the scrollbar's width. + + \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used. + \see Fl::scrollbar_size(int) + */ + int scrollbar_size() const { + return(scrollbar_width_); + } + + /** + Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels. + + Normally you should not need this method, and should use + Fl::scrollbar_size(int) instead to manage the size of ALL + your widgets' scrollbars. This ensures your application + has a consistent UI, is the default behavior, and is normally + what you want. + + Only use THIS method if you really need to override the global + scrollbar size. The need for this should be rare. + + Setting \p newSize to the special value of 0 causes the widget to + track the global Fl::scrollbar_size(), which is the default. + + \param[in] newSize Sets the scrollbar size in pixels.\n + If 0 (default), scrollbar size tracks the global Fl::scrollbar_size() + \see Fl::scrollbar_size() + */ + void scrollbar_size(int newSize) { + scrollbar_width_ = newSize; + } + + /** Gets the scrollbar alignment type. \return scrollbar alignment */ @@ -522,7 +570,7 @@ protected: Fl_Scrollbar* mHScrollBar; Fl_Scrollbar* mVScrollBar; - int scrollbar_width_; + int scrollbar_width_; // size of scrollbar trough (behavior changed in 1.4) Fl_Align scrollbar_align_; int dragPos, dragType, dragging; int display_insert_position_hint; |
