MythTV  master
mythuibutton.h
Go to the documentation of this file.
1 #ifndef MYTHUI_BUTTON_H_
2 #define MYTHUI_BUTTON_H_
3 
4 #include <QString>
5 
6 #include "mythuitype.h"
7 
8 class MythUIStateType;
9 class MythUIText;
10 class MythGestureEvent;
11 
22 {
23  Q_OBJECT
24  public:
25  MythUIButton(MythUIType *parent, const QString &name);
26  ~MythUIButton() override;
27 
28  void Reset(void) override; // MythUIType
29 
30  bool gestureEvent(MythGestureEvent *event) override; // MythUIType
31  bool keyPressEvent(QKeyEvent *event) override; // MythUIType
32 
33  void SetText(const QString &msg);
34  QString GetText(void) const;
35  QString GetDefaultText(void) const;
36 
37  void Push(bool lock=false);
38 
39  void SetLockable(bool lockable) { m_lockable = lockable; };
40  void SetLocked(bool locked);
41 
42  protected slots:
43  void Select();
44  void Deselect();
45  void Enable();
46  void Disable();
47  void UnPush();
48 
49  signals:
50  void Clicked();
51 
52  protected:
53  bool ParseElement(const QString &filename, QDomElement &element,
54  bool showWarnings) override; // MythUIType
55  void CopyFrom(MythUIType *base) override; // MythUIType
56  void CreateCopy(MythUIType *parent) override; // MythUIType
57  void Finalize(void) override; // MythUIType
58 
59  void SetInitialStates(void);
60  void SetState(const QString& state);
61 
62  QString m_message;
63  QString m_valueText;
64 
65  MythUIStateType *m_backgroundState {nullptr};
66  MythUIText *m_text {nullptr};
67 
68  QString m_state;
69 
70  bool m_pushed {false};
71  bool m_lockable {false};
72  class QTimer *m_clickTimer {nullptr};
73 };
74 
75 #endif
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:992
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythUIButton::SetLockable
void SetLockable(bool lockable)
Definition: mythuibutton.h:39
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
MythUIButton::m_message
QString m_message
Definition: mythuibutton.h:62
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1174
MythUIType::Reset
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:72
MythUIButton::m_valueText
QString m_valueText
Definition: mythuibutton.h:63
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUIButton::m_state
QString m_state
Definition: mythuibutton.h:68
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
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
MythUIType::ParseElement
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
Definition: mythuitype.cpp:1240
build_compdb.filename
filename
Definition: build_compdb.py:21
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