FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Scroll.H

    00001 //
    00002 // "$Id: Fl_Scroll.H 9126 2011-10-04 13:10:55Z manolo $"
    00003 //
    00004 // Scroll header file for the Fast Light Tool Kit (FLTK).
    00005 //
    00006 // Copyright 1998-2010 by Bill Spitzak and others.
    00007 //
    00008 // This library is free software. Distribution and use rights are outlined in
    00009 // the file "COPYING" which should have been included with this file.  If this
    00010 // file is missing or damaged, see the license at:
    00011 //
    00012 //     http://www.fltk.org/COPYING.php
    00013 //
    00014 // Please report all bugs and problems on the following page:
    00015 //
    00016 //     http://www.fltk.org/str.php
    00017 //
    00018
    00019 /* \file
    00020    Fl_Scroll widget . */
    00021
    00022 #ifndef Fl_Scroll_H
    00023 #define Fl_Scroll_H
    00024
    00025 #include "Fl_Group.H"
    00026 #include "Fl_Scrollbar.H"
    00027
    00087 class FL_EXPORT Fl_Scroll : public Fl_Group {
    00088
    00089   int xposition_, yposition_;
    00090   int oldx, oldy;
    00091   int scrollbar_size_;
    00092   static void hscrollbar_cb(Fl_Widget*, void*);
    00093   static void scrollbar_cb(Fl_Widget*, void*);
    00094   void fix_scrollbar_order();
    00095   static void draw_clip(void*,int,int,int,int);
    00096
    00097 private:
    00098
    00099   //
    00100   //  Structure to manage scrollbar and widget interior sizes.
    00101   //
    00102   //  Private for now -- we'd like to expose some of this at
    00103   //  some point to solve STR#1895.)
    00104   //
    00105   typedef struct {
    00106       int scrollsize;                                                   // the scrollsize (global|local)
    00107       int innerbox_x, innerbox_y, innerbox_w, innerbox_h;               // widget's inner box (excludes scrollbars)
    00108       int innerchild_x, innerchild_y, innerchild_w, innerchild_h;       // widget's inner box including scrollbars
    00109       int child_l, child_r, child_b, child_t;                           // child bounding box: left/right/bottom/top
    00110       int hneeded, vneeded;                                             // hor + ver scrollbar visibility
    00111       int hscroll_x, hscroll_y, hscroll_w, hscroll_h;                   // hor scrollbar size/position
    00112       int vscroll_x, vscroll_y, vscroll_w, vscroll_h;                   // ver scrollbar size/position
    00113       int hpos, hsize, hfirst, htotal;                                  // hor scrollbar values (pos/size/first/total)
    00114       int vpos, vsize, vfirst, vtotal;                                  // ver scrollbar values (pos/size/first/total)
    00115   } ScrollInfo;
    00116   void recalc_scrollbars(ScrollInfo &si);
    00117
    00118 protected:
    00119
    00120   void bbox(int&,int&,int&,int&);
    00121   void draw();
    00122
    00123 public:
    00124
    00125   Fl_Scrollbar scrollbar;
    00126   Fl_Scrollbar hscrollbar;
    00127
    00128   void resize(int,int,int,int);
    00129   int handle(int);
    00130
    00131   Fl_Scroll(int X,int Y,int W,int H,const char*l=0);
    00132
    00133   enum { // values for type()
    00134     HORIZONTAL = 1,
    00135     VERTICAL = 2,
    00136     BOTH = 3,
    00137     ALWAYS_ON = 4,
    00138     HORIZONTAL_ALWAYS = 5,
    00139     VERTICAL_ALWAYS = 6,
    00140     BOTH_ALWAYS = 7
    00141   };
    00142
    00144   int xposition() const {return xposition_;}
    00146   int yposition() const {return yposition_;}
    00147   void scroll_to(int, int);
    00148   void clear();
    00158   int scrollbar_size() const {
    00159       return(scrollbar_size_);
    00160   }
    00180   void scrollbar_size(int newSize) {
    00181       if ( newSize != scrollbar_size_ ) redraw();
    00182       scrollbar_size_ = newSize;
    00183   }
    00184 };
    00185
    00186 #endif
    00187
    00188 //
    00189 // End of "$Id: Fl_Scroll.H 9126 2011-10-04 13:10:55Z manolo $".
    00190 //