3 * Copyright (C) 2007, Harbour, All rights reserved.
6 #ifndef _F_SCROLLBAR_H_
7 #define _F_SCROLLBAR_H_
9 #include <F_Text_Display.H>
15 class F_Scrollbar : public F_Widget {
17 unsigned int size_; // visible scrollbar size [ 1 <-> (h() - 1) ]
18 unsigned int value_; // current virtual value
19 unsigned int bounds_; // virtual value bounds
24 if (type_ == F_VERTICAL) {
38 F_Scrollbar(F_Box_Type_t btype, char type, coord_t x, coord_t y, dim_t w, dim_t h,
39 const char *label = 0) : F_Widget(x, y, w, h, label) {
46 bool handle(F_Event_t &ev);
47 unsigned int value() { return value_; }
51 if (val > (int)bounds_)
56 void bounds(unsigned int b) {
58 if (type_ == F_VERTICAL) {
59 if (int(bounds_) < (h() - 2))
60 size((int)floorf(((float)bounds_/((float)(h() - 2))) * (float(h() - 2))));
62 size((int)floorf(((float)(h() - 2)/((float)bounds_)) * (float(h() - 2))));
64 if (int(bounds_) < (w() - 2))
65 size((int)floorf(((float)bounds_/((float)(w() - 2))) * (float(w() - 2))));
67 size((int)floorf(((float)(w() - 2)/((float)bounds_)) * (float(w() - 2))));