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();
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
This widget is used for grouping other widgets for display when a particular named state is called.
unsigned int slots[4]
Definition: element.c:38
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:971
QString m_state
Definition: mythuibutton.h:68
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:986
The base class on which all widgets and screens are based.
Definition: mythuitype.h:63
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
const char * name
Definition: ParseText.cpp:328
A single button widget.
Definition: mythuibutton.h:21
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:69
QString m_ValueText
Definition: mythuibutton.h:63
#define MUI_PUBLIC
Definition: mythuiexp.h:9
void SetLockable(bool lockable)
Definition: mythuibutton.h:39
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
QString m_Message
Definition: mythuibutton.h:62
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.