Fl_Scroll.H
//
// "$Id: Fl_Scroll.H 9126 2011-10-04 13:10:55Z manolo $"
//
// Scroll header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
/* \file
Fl_Scroll widget . */
#ifndef Fl_Scroll_H
#define Fl_Scroll_H
#include "Fl_Group.H"
#include "Fl_Scrollbar.H"
class FL_EXPORT Fl_Scroll : public Fl_Group {
int xposition_, yposition_;
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&);
void draw();
public:
Fl_Scrollbar scrollbar;
Fl_Scrollbar hscrollbar;
void resize(int,int,int,int);
int handle(int);
Fl_Scroll(int X,int Y,int W,int H,const char*l=0);
enum { // values for type()
HORIZONTAL = 1,
VERTICAL = 2,
BOTH = 3,
ALWAYS_ON = 4,
HORIZONTAL_ALWAYS = 5,
VERTICAL_ALWAYS = 6,
BOTH_ALWAYS = 7
};
int xposition() const {return xposition_;}
int yposition() const {return yposition_;}
void scroll_to(int, int);
void clear();
int scrollbar_size() const {
return(scrollbar_size_);
}
void scrollbar_size(int newSize) {
if ( newSize != scrollbar_size_ ) redraw();
scrollbar_size_ = newSize;
}
};
#endif
//
// End of "$Id: Fl_Scroll.H 9126 2011-10-04 13:10:55Z manolo $".
//
- © 1998-2012 by Bill Spitzak and others.