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 { None = 0, Normal, Disabled, Active, Selected,
24  SelectedInactive };
25 
26  bool gestureEvent(MythGestureEvent *event) override; // MythUIType
27  bool keyPressEvent(QKeyEvent *event) override; // MythUIType
28 
29  void toggleCheckState(void);
30 
31  void SetCheckState(MythUIStateType::StateType state);
32  void SetCheckState(bool onoff);
33 
34  MythUIStateType::StateType GetCheckState() const;
35  bool GetBooleanCheckState(void) const;
36 
37  protected slots:
38  void Select();
39  void Deselect();
40  void Enable();
41  void Disable();
42 
43  signals:
44  void valueChanged();
45  void toggled(bool);
46 
47  protected:
48  void CopyFrom(MythUIType *base) override; // MythUIType
49  void CreateCopy(MythUIType *parent) override; // MythUIType
50  void Finalize(void) override; // MythUIType
51 
52  void SetInitialStates(void);
53 
54  MythUIStateType *m_backgroundState {nullptr};
55  MythUIStateType *m_checkState {nullptr};
56 
58  QString m_state {"active"};
59 };
60 
61 #endif
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:992
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:1231
AutoExtendType::None
@ None
MythUICheckBox::StateType
StateType
Definition: mythuicheckbox.h:23
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1174
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
MythUIStateType::Off
@ Off
Definition: mythuistatetype.h:25
MythUIStateType::StateType
StateType
Definition: mythuistatetype.h:25
MythUIType::gestureEvent
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:1016
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:1316
mythuitype.h