FDOSTUI
FreeDOS Text User Interface
slider.hpp
Go to the documentation of this file.
1 /*
2  SLIDER.HPP
3 
4  Derived from FLTK Slider class
5 
6  Copyright 1998-2006 by Bill Spitzak and others.
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  USA.
22 
23 */
24 #ifndef __slider_hpp__
25 
26 #include "valuator.hpp"
27 
28 class slider : public widget, public valuator
29 {
30 public:
31 
33  {
36  };
37 
38  slider(
39  int const i_pos_x,
40  int const i_pos_y,
41  unsigned int const i_len_x,
42  unsigned int const i_len_y);
43 
44  virtual
45  ~slider();
46 
47  virtual void
48  draw() const;
49 
50  virtual enum event_response
51  event_key(
52  struct event_key const& i_event);
53 
54  virtual enum event_response
56  struct event_mouse const& i_event);
57 
58  void
60  enum orientation const i_orientation);
61 
62 protected:
63 
65 
66  double
67  value2pct(
68  double const i_value) const;
69 
70  int
72  double const i_value,
73  int const i_len) const;
74 
75  double
77  int const i_pos,
78  int const i_len) const;
79 
80  // _mjo this should be removed and use get_bbox instead
81  void
82  draw(
83  struct box const& i_box) const;
84 
85  // _mjo this should be removed and replaced with get_bbox
86  enum event_response
88  struct event_mouse const& i_event,
89  struct box const& i_box);
90 
91 private:
92 
93  slider();
94 
95  slider(
96  const slider&);
97 
98  slider&
99  operator=(slider const&);
100 
101  enum event_response
103  struct event_key const& i_event);
104 
105  enum event_response
107  struct event_key const& i_event);
108 
109 };
110 
111 inline void
113  enum orientation const i_orientation)
114 {
115  m_orientation= i_orientation;
116  return;
117 }
118 
119 #define __slider_hpp__
120 #endif
double screen2value(int const i_pos, int const i_len) const
convert position to value
Definition: slider.cpp:146
double value2pct(double const i_value) const
converts value to percentage
Definition: slider.cpp:52
enum event_response event_key_vertical(struct event_key const &i_event)
handle key even for vertical slider
Definition: slider.cpp:350
int value2screen(double const i_value, int const i_len) const
converts value to screen units
Definition: slider.cpp:124
virtual ~slider()
destructor
Definition: slider.cpp:47
virtual enum event_response event_key(struct event_key const &i_event)
handle key event
Definition: slider.cpp:384
base class for all derived widgets
Definition: widget.hpp:19
Allows user to select a value by moving a thumb within a defined range of the slider.
Definition: slider.hpp:28
virtual void draw() const
draws the widget
Definition: slider.cpp:311
virtual enum event_response event_mouse(struct event_mouse const &i_event)
handle mouse event
Definition: slider.cpp:444
contains valuator class
event_response
response
Definition: event.h:14
orientation
indicator of the orientation of the widget. The defualt orientation is HORIZONTAL.
Definition: slider.hpp:32
Definition: slider.hpp:35
interface to control a floating point value
Definition: valuator.hpp:28
enum event_response event_key_horizontal(struct event_key const &i_event)
handle event for horizontal slider
Definition: slider.cpp:317
void set_orientation(enum orientation const i_orientation)
sets the orientation
Definition: slider.hpp:112
Definition: slider.hpp:34
enum orientation m_orientation
Definition: slider.hpp:64
container for a mouse event
Definition: event.h:37
defines a rectangular region
Definition: box.h:12
container for a keyboard event
Definition: event.h:23