MythTV  master
mythuicheckbox.h
Go to the documentation of this file.
1 #ifndef MYTHUI_CHECKBOX_H_
2 #define MYTHUI_CHECKBOX_H_
3 
4 // MythUI headers
5 #include "mythuitype.h"
6 #include "mythuistatetype.h"
7 
16 {
17  Q_OBJECT
18 
19  public:
20  MythUICheckBox(MythUIType *parent, const QString &name);
21  ~MythUICheckBox() override = default;
22 
23  enum StateType : std::uint8_t
24  { None = 0, Normal, Disabled, Active, Selected,
25  SelectedInactive };
26 
27  bool gestureEvent(MythGestureEvent *event) override; // MythUIType
28  bool keyPressEvent(QKeyEvent *event) override; // MythUIType
29 
30  void toggleCheckState(void);
31 
32  void SetCheckState(MythUIStateType::StateType state);
33  void SetCheckState(bool onoff);
34 
35  MythUIStateType::StateType GetCheckState() const;
36  bool GetBooleanCheckState(void) const;
37 
38  protected slots:
39  void Select();
40  void Deselect();
41  void Enable();
42  void Disable();
43 
44  signals:
45  void valueChanged();
46  void toggled(bool);
47 
48  protected:
49  void CopyFrom(MythUIType *base) override; // MythUIType
50  void CreateCopy(MythUIType *parent) override; // MythUIType
51  void Finalize(void) override; // MythUIType
52 
53  void SetInitialStates(void);
54 
55  MythUIStateType *m_backgroundState {nullptr};
56  MythUIStateType *m_checkState {nullptr};
57 
59  QString m_state {"active"};
60 };
61 
62 #endif
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:989
MythUICheckBox::Selected
@ Selected
Definition: mythuicheckbox.h:24
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
mythuistatetype.h
MythUIType::CreateCopy
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
Definition: mythuitype.cpp:1228
AutoExtendType::None
@ None
MythUIStateType::Off
@ Off
Definition: mythuistatetype.h:27
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1171
MythUICheckBox
A checkbox widget supporting three check states - on,off,half and two conditions - selected and unsel...
Definition: mythuicheckbox.h:15
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUICheckBox::StateType
StateType
Definition: mythuicheckbox.h:23
MythUIType::gestureEvent
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:1013
MythUIStateType::StateType
StateType
Definition: mythuistatetype.h:26
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
MythUIType::Finalize
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
Definition: mythuitype.cpp:1312
mythuitype.h