This widget has not been used in any real software and is thus experimental. There are likely to be bugs or defects in implementation that may need to be fixed. Please tell me what you discover if you use this.
This container widget lets you maneuver around a set of widgets much larger than your window. If the child widgets are larger than the size of this object then scrollbars will appear so that you can scroll over to them:
Fl_Scroll works best if it's box() is FL_NO_BOX. You should then completely fill a rectangular area with child widgets so that no area is left undrawn. Use Fl_Box to make flat empty areas.
If desired because of a sparse arrangment of children or for outside labels, you can set the box() to FL_FLAT_BOX. This may produce some blinking in the scrolling area. This can be solved by using an Fl_Double_Window.
You can use this to pan around a "canvas" with arbitrary graphics by making a single large child widget. This child widget should be of your own class, with a draw() method that draws the contents. The scrolling is done by changing the x() and y() of the children widgets, so this child must use the x() and y() to position it's drawing.
Child Fl_Windows do not work, unfortunately, as the clipping is not conveyed to them when they draw, and they will draw over the scrollbars and neighboring objects.
Fl_Scroll::Fl_Scroll(int x,int y,int w,int h, const char * = 0);
void type(int);
Fl_Scroll::HORIZONTAL
- Only horizontal scrolling is
done.
Fl_Scroll::VERTICAL
- Only vertical scrolling is
done.
Fl_Scroll::BOTH
- The default is to scroll both
directions.
int Fl_Scroll::width() const;
int Fl_Scroll::height() const;
void Fl_Scroll::area(int w, int h);
void Fl_Scroll::init_area();
int Fl_Scroll::xposition() const;
int Fl_Scroll::yposition() const;
void Fl_Scroll::position(int w, int h);
Fl_Slider& Fl_Scroll::xslider();
Fl_Slider& Fl_Scroll::yslider();