MythTV  master
mythuistatetype.h
Go to the documentation of this file.
1 #ifndef MYTHUI_STATETYPE_H_
2 #define MYTHUI_STATETYPE_H_
3 
4 #include <QString>
5 #include <QMap>
6 
7 #include "mythuicomposite.h"
8 
9 class MythImage;
10 
23 {
24  public:
25  enum StateType { None = 0, Off, Half, Full }; // Can be used for tri-state checks, two state toggles, etc.
26 
27  MythUIStateType(MythUIType *parent, const QString &name);
28  ~MythUIStateType() override = default;
29 
30  void SetShowEmpty(bool showempty) { m_showEmpty = showempty; }
31 
32  bool AddImage(const QString &name, MythImage *image);
33  bool AddImage(StateType type, MythImage *image);
34 
35  bool AddObject(const QString &name, MythUIType *object);
36  bool AddObject(StateType type, MythUIType *object);
37 
38  bool DisplayState(const QString &name);
39  bool DisplayState(StateType type);
40 
41  MythUIType* GetCurrentState() { return m_currentState; }
42  MythUIType* GetState(const QString &name);
43  MythUIType* GetState(StateType state);
44 
45  void Reset(void) override; // MythUIType
46  void Clear(void);
47 
48  void EnsureStateLoaded(const QString &name);
49  void EnsureStateLoaded(StateType type);
50 
51  void LoadNow(void) override; // MythUIType
52  void RecalculateArea(bool recurse = true) override; // MythUIType
53 
54  void SetTextFromMap(const InfoMap &infoMap) override; // MythUIComposite
55 
56  protected:
57  bool ParseElement(const QString &filename, QDomElement &element,
58  bool showWarnings) override; // MythUIType
59  void CopyFrom(MythUIType *base) override; // MythUIType
60  void CreateCopy(MythUIType *parent) override; // MythUIType
61  void Finalize(void) override; // MythUIType
62  virtual void AdjustDependence(void);
63 
64  QMap<QString, MythUIType *> m_objectsByName;
65  QMap<int, MythUIType *> m_objectsByState;
66 
67  MythUIType *m_currentState {nullptr};
69 
70  bool m_showEmpty {true};
71 
72  friend class MythUIButtonList;
73 };
74 
75 #endif
MythUIStateType::m_objectsByName
QMap< QString, MythUIType * > m_objectsByName
Definition: mythuistatetype.h:64
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
mythuicomposite.h
MythUIStateType::GetCurrentState
MythUIType * GetCurrentState()
Definition: mythuistatetype.h:41
MythRect
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:17
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
AutoExtendType::None
@ None
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythUIComposite::SetTextFromMap
virtual void SetTextFromMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:9
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1174
GetState
#define GetState(a, b)
Definition: audiooutputopensles.cpp:55
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
MythUIType::RecalculateArea
virtual void RecalculateArea(bool recurse=true)
Definition: mythuitype.cpp:1335
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUIStateType::m_objectsByState
QMap< int, MythUIType * > m_objectsByState
Definition: mythuistatetype.h:65
MythUIStateType::StateType
StateType
Definition: mythuistatetype.h:25
Clear
#define Clear(a)
Definition: audiooutputopensles.cpp:54
MythUIType::LoadNow
virtual void LoadNow(void)
Cause images in this and child widgets to be loaded.
Definition: mythuitype.cpp:1403
MythImage
Definition: mythimage.h:36
MythUIStateType::SetShowEmpty
void SetShowEmpty(bool showempty)
Definition: mythuistatetype.h:30
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
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
build_compdb.filename
filename
Definition: build_compdb.py:21
MythUIStateType::m_parentArea
MythRect m_parentArea
Definition: mythuistatetype.h:68
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
MythUIComposite
Definition: mythuicomposite.h:7