2 #ifndef _F_SCROLLBAR_H_
3 #define _F_SCROLLBAR_H_
5 #include <F_Text_Display.H>
11 class F_Scrollbar : public F_Widget {
13 unsigned int size_; // visible scrollbar size [ 1 <-> (h() - 1) ]
14 unsigned int value_; // current virtual value
15 unsigned int bounds_; // virtual value bounds
20 if (type_ == F_VERTICAL) {
34 F_Scrollbar(F_Box_Type_t btype, char type, coord_t x, coord_t y, dim_t w, dim_t h,
35 const char *label = 0) : F_Widget(x, y, w, h, label) {
42 bool handle(F_Event_t &ev);
43 unsigned int value() { return value_; }
47 if (val > (int)bounds_)
52 void bounds(unsigned int b) {
54 if (type_ == F_VERTICAL) {
55 if (int(bounds_) < (h() - 2))
56 size((int)floorf(((float)bounds_/((float)(h() - 2))) * (float(h() - 2))));
58 size((int)floorf(((float)(h() - 2)/((float)bounds_)) * (float(h() - 2))));
60 if (int(bounds_) < (w() - 2))
61 size((int)floorf(((float)bounds_/((float)(w() - 2))) * (float(w() - 2))));
63 size((int)floorf(((float)(w() - 2)/((float)bounds_)) * (float(w() - 2))));