libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
scrollbar.h
1 /* Copyright (C) 2011-2013 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef T3_WIDGET_SCROLLBAR_H
15 #define T3_WIDGET_SCROLLBAR_H
16 
17 #include <t3widget/widgets/widget.h>
18 
19 namespace t3_widget {
20 
21 class T3_WIDGET_API scrollbar_t : public widget_t {
22  private:
23  struct T3_WIDGET_LOCAL implementation_t {
24  int length;
25  int range, start, used;
26  int before, slider_size;
27  int button_down_pos;
28  bool vertical;
29  bool dragging;
30  implementation_t(bool _vertical) : length(3), range(1), start(0), used(1),
31  before(0), slider_size(length - 2), vertical(_vertical), dragging(false) {}
32  };
33  pimpl_ptr<implementation_t>::t impl;
34 
35  public:
36  scrollbar_t(bool _vertical);
37  virtual bool process_key(key_t key);
38  virtual bool set_size(optint height, optint width);
39  virtual void update_contents(void);
40  virtual bool accepts_focus(void);
41  virtual void set_focus(focus_t focus);
42  virtual bool process_mouse_event(mouse_event_t event);
43 
44  void set_parameters(int _range, int _start, int _used);
45 
46  enum step_t {
52  BACK_PAGE
53  };
54 
55  T3_WIDGET_SIGNAL(clicked, void, step_t);
56  T3_WIDGET_SIGNAL(dragged, void, int);
57 };
58 
59 }; // namespace
60 #endif