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  // Can be used for tri-state checks, two state toggles, etc.
26  enum StateType : std::uint8_t
27  { None = 0, Off, Half, Full };
28 
29  MythUIStateType(MythUIType *parent, const QString &name);
30  ~MythUIStateType() override = default;
31 
32  void SetShowEmpty(bool showempty) { m_showEmpty = showempty; }
33 
34  bool AddImage(const QString &name, MythImage *image);
35  bool AddImage(StateType type, MythImage *image);
36 
37  bool AddObject(const QString &name, MythUIType *object);
38  bool AddObject(StateType type, MythUIType *object);
39 
40  bool DisplayState(const QString &name);
41  bool DisplayState(StateType type);
42 
43  MythUIType* GetCurrentState() { return m_currentState; }
44  MythUIType* GetState(const QString &name);
45  MythUIType* GetState(StateType state);
46 
47  void Reset(void) override; // MythUIType
48  void Clear(void);
49 
50  void EnsureStateLoaded(const QString &name);
51  void EnsureStateLoaded(StateType type);
52 
53  void LoadNow(void) override; // MythUIType
54  void RecalculateArea(bool recurse = true) override; // MythUIType
55 
56  void SetTextFromMap(const InfoMap &infoMap) override; // MythUIComposite
57 
58  protected:
59  bool ParseElement(const QString &filename, QDomElement &element,
60  bool showWarnings) override; // MythUIType
61  void CopyFrom(MythUIType *base) override; // MythUIType
62  void CreateCopy(MythUIType *parent) override; // MythUIType
63  void Finalize(void) override; // MythUIType
64  virtual void AdjustDependence(void);
65 
66  QMap<QString, MythUIType *> m_objectsByName;
67  QMap<int, MythUIType *> m_objectsByState;
68 
69  MythUIType *m_currentState {nullptr};
71 
72  bool m_showEmpty {true};
73 
74  friend class MythUIButtonList;
75 };
76 
77 #endif
MythUIStateType::m_objectsByName
QMap< QString, MythUIType * > m_objectsByName
Definition: mythuistatetype.h:66
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
mythuicomposite.h
MythUIStateType::GetCurrentState
MythUIType * GetCurrentState()
Definition: mythuistatetype.h:43
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:1228
AutoExtendType::None
@ None
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythUIComposite::SetTextFromMap
virtual void SetTextFromMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:9
MythUIStateType::Off
@ Off
Definition: mythuistatetype.h:27
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1171
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:73
MythUIType::RecalculateArea
virtual void RecalculateArea(bool recurse=true)
Definition: mythuitype.cpp:1331
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:67
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:1399
MythImage
Definition: mythimage.h:36
MythUIStateType::SetShowEmpty
void SetShowEmpty(bool showempty)
Definition: mythuistatetype.h:32
MythUIStateType::StateType
StateType
Definition: mythuistatetype.h:26
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:1237
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:70
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:1312
MythUIComposite
Definition: mythuicomposite.h:7