00001 #ifndef MYTHUI_STATETYPE_H_
00002 #define MYTHUI_STATETYPE_H_
00003
00004 #include <QString>
00005 #include <QMap>
00006
00007 #include "mythuitype.h"
00008 #include "mythimage.h"
00009
00021 class MUI_PUBLIC MythUIStateType : public MythUIType
00022 {
00023 public:
00024 enum StateType { None = 0, Off, Half, Full };
00025
00026 MythUIStateType(MythUIType *parent, const QString &name);
00027 ~MythUIStateType();
00028
00029 void SetShowEmpty(bool showempty) { m_ShowEmpty = showempty; }
00030
00031 bool AddImage(const QString &name, MythImage *image);
00032 bool AddImage(StateType type, MythImage *image);
00033
00034 bool AddObject(const QString &name, MythUIType *object);
00035 bool AddObject(StateType type, MythUIType *object);
00036
00037 bool DisplayState(const QString &name);
00038 bool DisplayState(StateType type);
00039
00040 MythUIType* GetCurrentState() { return m_CurrentState; }
00041 MythUIType* GetState(const QString &name);
00042 MythUIType* GetState(StateType state);
00043
00044 void Reset(void);
00045 void Clear(void);
00046
00047 void EnsureStateLoaded(const QString &name);
00048 void EnsureStateLoaded(StateType type);
00049
00050 virtual void LoadNow(void);
00051 virtual void RecalculateArea(bool recurse = true);
00052
00053 protected:
00054 virtual bool ParseElement(
00055 const QString &filename, QDomElement &element, bool showWarnings);
00056 virtual void CopyFrom(MythUIType *base);
00057 virtual void CreateCopy(MythUIType *parent);
00058 virtual void Finalize(void);
00059
00060 QMap<QString, MythUIType *> m_ObjectsByName;
00061 QMap<int, MythUIType *> m_ObjectsByState;
00062
00063 MythUIType *m_CurrentState;
00064 MythRect m_ParentArea;
00065
00066 bool m_ShowEmpty;
00067
00068 friend class MythUIButtonList;
00069 };
00070
00071 #endif