00001 #ifndef MYTHUI_BUTTON_H_
00002 #define MYTHUI_BUTTON_H_
00003
00004 #include <QString>
00005
00006 #include "mythuitype.h"
00007 #include "mythuistatetype.h"
00008 #include "mythuitext.h"
00009
00010 #include "mythgesture.h"
00011
00021 class MUI_PUBLIC MythUIButton : public MythUIType
00022 {
00023 Q_OBJECT
00024 public:
00025 MythUIButton(MythUIType *parent, const QString &name);
00026 ~MythUIButton();
00027
00028 virtual void Reset(void);
00029
00030 virtual bool gestureEvent(MythGestureEvent *event);
00031 virtual bool keyPressEvent(QKeyEvent *);
00032
00033 void SetText(const QString &msg);
00034 QString GetText(void) const;
00035 QString GetDefaultText(void) const;
00036
00037 void Push(bool lock=false);
00038
00039 void SetLockable(bool lockable) { m_Lockable = lockable; };
00040 void SetLocked(bool locked);
00041
00042 protected slots:
00043 void Select();
00044 void Deselect();
00045 void Enable();
00046 void Disable();
00047 void UnPush();
00048
00049 signals:
00050 void Clicked();
00051
00052 protected:
00053 virtual bool ParseElement(
00054 const QString &filename, QDomElement &element, bool showWarnings);
00055 virtual void CopyFrom(MythUIType *base);
00056 virtual void CreateCopy(MythUIType *parent);
00057 virtual void Finalize(void);
00058
00059 void SetInitialStates(void);
00060 void SetState(QString state);
00061
00062 QString m_Message;
00063 QString m_ValueText;
00064
00065 MythUIStateType *m_BackgroundState;
00066 MythUIText *m_Text;
00067
00068 QString m_state;
00069
00070 bool m_Pushed;
00071 bool m_Lockable;
00072 class QTimer *m_clickTimer;
00073 };
00074
00075 #endif