00001 #ifndef MYTHDIALOGBOX_H_ 00002 #define MYTHDIALOGBOX_H_ 00003 00004 #include "qevent.h" 00005 00006 #include "mythscreentype.h" 00007 #include "mythlistbutton.h" 00008 00009 class MythListButtonItem; 00010 class MythListButton; 00011 00012 const int kMythDialogBoxCompletionEventType = 34111; 00013 00014 class DialogCompletionEvent : public QCustomEvent 00015 { 00016 public: 00017 DialogCompletionEvent(const QString &id, int result) 00018 : QCustomEvent(kMythDialogBoxCompletionEventType), 00019 m_id(id), m_result(result) { } 00020 00021 QString GetId() { return m_id; } 00022 int GetResult() { return m_result; } 00023 00024 private: 00025 QString m_id; 00026 int m_result; 00027 }; 00028 00029 // Sends out an event with 'resultid' as the id when done. 00030 class MythDialogBox : public MythScreenType 00031 { 00032 Q_OBJECT 00033 public: 00034 MythDialogBox(const QString &text, 00035 MythScreenStack *parent, const char *name); 00036 00037 virtual bool Create(void); 00038 00039 void SetReturnEvent(MythScreenType *retscreen, const QString &resultid); 00040 00041 void AddButton(const QString &title); 00042 00043 virtual bool keyPressEvent(QKeyEvent *event); 00044 00045 public slots: 00046 void Select(MythListButtonItem* item); 00047 00048 signals: 00049 void Selected(int selection); 00050 00051 private: 00052 void SendEvent(int res); 00053 00054 MythListButton *buttonList; 00055 MythScreenType *m_retScreen; 00056 QString m_id; 00057 00058 QString m_text; 00059 }; 00060 00061 #endif
1.5.5