summaryrefslogtreecommitdiff
path: root/FL/Fl_Scroll.H
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2009-07-12 00:15:06 +0000
committerGreg Ercolano <erco@seriss.com>2009-07-12 00:15:06 +0000
commitfe687baefd32a8b962a05085c01a17cd6c7d4a97 (patch)
tree61e91912bed60fcc558d1ecfa4aeea7c39455ec9 /FL/Fl_Scroll.H
parent9eaf693d4ac56849ffcf05e4c3f3027f4fc06be8 (diff)
Fl_Scroll mods for global scrollbar size control.
Also, unittest added (scrollbar size) to test these changes. Thanks to Albrecht for testing/peer review. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6828 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Scroll.H')
-rw-r--r--FL/Fl_Scroll.H57
1 files changed, 57 insertions, 0 deletions
diff --git a/FL/Fl_Scroll.H b/FL/Fl_Scroll.H
index de713dd0f..5e256f41a 100644
--- a/FL/Fl_Scroll.H
+++ b/FL/Fl_Scroll.H
@@ -95,11 +95,33 @@ class FL_EXPORT Fl_Scroll : public Fl_Group {
int xposition_, yposition_;
int width_, height_;
int oldx, oldy;
+ int scrollbar_size_;
static void hscrollbar_cb(Fl_Widget*, void*);
static void scrollbar_cb(Fl_Widget*, void*);
void fix_scrollbar_order();
static void draw_clip(void*,int,int,int,int);
+private:
+
+ //
+ // Structure to manage scrollbar and widget interior sizes.
+ //
+ // Private for now -- we'd like to expose some of this at
+ // some point to solve STR#1895.)
+ //
+ typedef struct {
+ int scrollsize; // the scrollsize (global|local)
+ int innerbox_x, innerbox_y, innerbox_w, innerbox_h; // widget's inner box (excludes scrollbars)
+ int innerchild_x, innerchild_y, innerchild_w, innerchild_h; // widget's inner box including scrollbars
+ int child_l, child_r, child_b, child_t; // child bounding box: left/right/bottom/top
+ int hneeded, vneeded; // hor + ver scrollbar visibility
+ int hscroll_x, hscroll_y, hscroll_w, hscroll_h; // hor scrollbar size/position
+ int vscroll_x, vscroll_y, vscroll_w, vscroll_h; // ver scrollbar size/position
+ int hpos, hsize, hfirst, htotal; // hor scrollbar values (pos/size/first/total)
+ int vpos, vsize, vfirst, vtotal; // ver scrollbar values (pos/size/first/total)
+ } ScrollInfo;
+ void recalc_scrollbars(ScrollInfo &si);
+
protected:
void bbox(int&,int&,int&,int&);
@@ -131,6 +153,41 @@ public:
int yposition() const {return yposition_;}
void scroll_to(int, int);
void clear();
+ /**
+ 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::scrollsize() is being used.
+ \see Fl::scrollbar_size(int)
+ */
+ int scrollbar_size() const {
+ return(scrollbar_size_);
+ }
+ /**
+ Sets the pixel size of the scrollbars' troughs to the \p size, 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 size to the special value of 0 causes the widget to
+ track the global Fl::scrollbar_size(), which is the default.
+
+ \param[in] size 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 size) {
+ if ( size != scrollbar_size_ ) redraw();
+ scrollbar_size_ = size;
+ }
};
#endif