FDOSTUI
FreeDOS Text User Interface
checkbtn.hpp
Go to the documentation of this file.
1 /*
2  CHECKBTN.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 __checkbtn_hpp__
11 
12 #include "button.hpp"
13 #include "wm.hpp"
14 
15 class checkbutton : public button
16 {
17 
18 public:
19 
21  int const i_pos_x,
22  int const i_pos_y,
23  unsigned int const i_len_x,
24  unsigned int const i_len_y);
25 
26  virtual
27  ~checkbutton();
28 
29  void
30  clear_state();
31 
32  bool
33  get_state() const;
34 
35  void
36  set_state();
37 
38 protected:
39 
40 private:
41 
42  checkbutton();
43 
45  const checkbutton&);
46 
48  operator=(checkbutton const&);
49 
50 };
51 
52 inline void
54 {
55 
56  if (m_state)
57  {
58  m_state= false;
60  wm_draw_widget(this);
61  }
62 
63  return;
64 }
65 
66 inline bool
68 {
69  return m_state;
70 }
71 
72 inline void
74 {
75 
76  if (false == m_state)
77  {
78  m_state= true;
80  wm_draw_widget(this);
81  toggled();
82  }
83 
84  return;
85 }
86 
87 #define __checkbtn_hpp__
88 #endif
bool get_state() const
get current state
Definition: checkbtn.hpp:67
void wm_draw_widget(widget *const i_widget)
draw a widget
Definition: wm.cpp:199
virtual void toggled()
method called when button state changes
Definition: button.hpp:171
window management routines
contains button class
check button widget
Definition: checkbtn.hpp:15
void set_state()
sets the state to checked
Definition: checkbtn.hpp:73
Definition: widget.hpp:29
bool m_state
on/off state (for normal button ignored)
Definition: button.hpp:88
void clear_state()
sets the state to unchecked
Definition: checkbtn.hpp:53
virtual ~checkbutton()
destructor
Definition: checkbtn.cpp:23
virtual void set_damage(unsigned int const i_damage=DAMAGE_NONE)
set the damage bits
Definition: widget.hpp:401
Allows a user to click on a button.
Definition: button.hpp:21