FDOSTUI
FreeDOS Text User Interface
include
spinner.hpp
Go to the documentation of this file.
1
/*
2
SPINNER.HPP
3
4
License CC0 PUBLIC DOMAIN
5
6
To the extent possible under law, Mark J. Olesen has waived all copyright
7
and related or neighboring rights to FDOSTUI Library. This work is published
8
from: United States.
9
*/
10
#ifndef __spinner_hpp__
11
12
#include "
valuator.hpp
"
13
#include "
entry.hpp
"
14
#include <stdlib.h>
15
16
class
spinner
:
public
entry
,
public
valuator
17
{
18
19
public
:
20
21
spinner
(
22
int
const
i_pos_x,
23
int
const
i_pos_y,
24
unsigned
int
const
i_len_x,
25
unsigned
int
const
i_len_y);
26
27
virtual
28
~spinner
();
29
30
virtual
void
31
draw
()
const
;
32
33
virtual
double
34
get_value
()
const
;
35
36
virtual
bool
37
set_value
(
38
double
const
i_value);
39
40
virtual
enum
event_response
41
event_key
(
42
struct
event_key
const
& i_event);
43
44
virtual
enum
event_response
45
event_mouse
(
46
struct
event_mouse
const
& i_event);
47
48
protected
:
49
50
virtual
void
51
get_bbox
(
52
struct
box
& o_bbox)
const
;
53
54
private
:
55
56
spinner
();
57
58
spinner
(
59
const
spinner
&);
60
61
spinner
&
62
operator=(
spinner
const
&);
63
64
};
65
66
inline
void
67
spinner::get_bbox
(
68
struct
box
& o_bbox)
const
69
{
70
o_bbox=
m_box
;
71
if
(3 <=
m_box
.
m_len_x
)
72
{
73
o_bbox.
m_len_x
--;
74
o_bbox.
m_len_x
--;
75
}
76
}
77
78
inline
double
79
spinner::get_value
()
const
80
{
81
double
l_value;
82
83
m_block
[
m_length
]= 0;
84
l_value= strtod(reinterpret_cast<char*>(
m_block
), 0);
85
86
return
l_value;
87
}
88
89
#define __spinner_hpp__
90
#endif
entry.hpp
contains entry class
spinner::set_value
virtual bool set_value(double const i_value)
sets the value
Definition:
spinner.cpp:149
spinner::~spinner
virtual ~spinner()
destructor
Definition:
spinner.cpp:28
widget::m_box
struct box m_box
Definition:
widget.hpp:171
spinner
Allows the user to enter a numeric value. The value can be adjusted through the use of repeat buttons...
Definition:
spinner.hpp:16
spinner::draw
virtual void draw() const
draws the widget
Definition:
spinner.cpp:34
spinner::event_mouse
virtual enum event_response event_mouse(struct event_mouse const &i_event)
handle mouse event
Definition:
spinner.cpp:109
entry::m_length
size_t m_length
Definition:
entry.hpp:86
valuator.hpp
contains valuator class
entry
Allows a user to enter text.
Definition:
entry.hpp:14
spinner::get_value
virtual double get_value() const
gets the value
Definition:
spinner.hpp:79
event_response
event_response
response
Definition:
event.h:14
spinner::event_key
virtual enum event_response event_key(struct event_key const &i_event)
handle key event
Definition:
spinner.cpp:72
spinner::get_bbox
virtual void get_bbox(struct box &o_bbox) const
get the inner bounding box
Definition:
spinner.hpp:67
box::m_len_x
unsigned int m_len_x
Definition:
box.h:16
valuator
interface to control a floating point value
Definition:
valuator.hpp:28
entry::m_block
unsigned char * m_block
Definition:
entry.hpp:88
event_mouse
container for a mouse event
Definition:
event.h:37
box
defines a rectangular region
Definition:
box.h:12
event_key
container for a keyboard event
Definition:
event.h:23
Generated by
1.8.14