• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

Fl_Scroll.H

00001 //
00002 // "$Id$"
00003 //
00004 // Scroll header file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2015 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 #if FLTK_ABI_VERSION >= 10303
00098 protected:      // NEW (STR#1895)
00099 #else
00100 private:        // OLD
00101 #endif
00102 
00108   typedef struct {
00110     typedef struct { int x,y,w,h; } Fl_Region_XYWH;
00112     typedef struct {
00113       int l;                    
00114       int r;                    
00115       int t;                    
00116       int b;                    
00117     } Fl_Region_LRTB;
00119     typedef struct {
00120       int x,y,w,h;
00121       int pos;                  
00122       int size;                 
00123       int first;                
00124       int total;                
00125     } Fl_Scrollbar_Data;
00126     int scrollsize;             
00127     Fl_Region_XYWH innerbox;    
00128     Fl_Region_XYWH innerchild;  
00129     Fl_Region_LRTB child;       
00130     int hneeded;                
00131     int vneeded;                
00132     Fl_Scrollbar_Data hscroll;  
00133     Fl_Scrollbar_Data vscroll;  
00134   } ScrollInfo;
00135   void recalc_scrollbars(ScrollInfo &si);
00136 
00137 protected:
00138 
00139   void bbox(int&,int&,int&,int&);
00140   void draw();
00141 
00142 public:
00143 
00144   Fl_Scrollbar scrollbar;
00145   Fl_Scrollbar hscrollbar;
00146 
00147   void resize(int X, int Y, int W, int H);
00148   int handle(int);
00149 
00150   Fl_Scroll(int X,int Y,int W,int H,const char*l=0);
00151 
00152   enum { // values for type()
00153     HORIZONTAL = 1,
00154     VERTICAL = 2,
00155     BOTH = 3,
00156     ALWAYS_ON = 4,
00157     HORIZONTAL_ALWAYS = 5,
00158     VERTICAL_ALWAYS = 6,
00159     BOTH_ALWAYS = 7
00160   };
00161 
00163   int xposition() const {return xposition_;}
00165   int yposition() const {return yposition_;}
00166   void scroll_to(int, int);
00167   void clear();
00177   int scrollbar_size() const {
00178       return(scrollbar_size_);
00179   }
00199   void scrollbar_size(int newSize) {
00200       if ( newSize != scrollbar_size_ ) redraw();
00201       scrollbar_size_ = newSize;
00202   }
00203 };
00204 
00205 #endif
00206 
00207 //
00208 // End of "$Id$".
00209 //
  • © 1998-2016 by Bill Spitzak and others.     FLTK

  • © 1998-2016 by Bill Spitzak and others.     FLTK

    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.