MythTV  master
mythuibuttontree.h
Go to the documentation of this file.
1 #ifndef MYTHUI_BUTTONTREE_H_
2 #define MYTHUI_BUTTONTREE_H_
3 
4 #include "mythuitype.h"
5 #include "mythgenerictree.h"
6 #include "mythuibuttonlist.h"
7 
9 
17 {
18  Q_OBJECT
19  public:
20  MythUIButtonTree(MythUIType *parent, const QString &name);
21  ~MythUIButtonTree() override = default;
22 
23  bool keyPressEvent(QKeyEvent *event) override; // MythUIType
24  bool gestureEvent(MythGestureEvent *event) override; // MythUIType
25 
26  bool AssignTree(MythGenericTree *tree);
27  void Reset(void) override; // MythUIType
28  bool SetNodeByString(QStringList route);
29  bool SetNodeById(QList<int> route);
30  bool SetCurrentNode(MythGenericTree *node);
31  void ShowSearchDialog(void);
32  MythGenericTree* GetCurrentNode(void) const { return m_currentNode; }
33 
34  void SetActive(bool active);
35 
36  MythUIButtonListItem* GetItemCurrent(void) const;
37  void RemoveItem(MythUIButtonListItem *item, bool deleteNode = false);
38  void RemoveCurrentItem(bool deleteNode = false);
39 
40  public slots:
41  void handleSelect(MythUIButtonListItem* item);
42  void handleClick(MythUIButtonListItem* item);
43  void handleVisible(MythUIButtonListItem* item);
44  void Select();
45  void Deselect();
46 
47  signals:
48  void itemSelected(MythUIButtonListItem* item);
49  void itemClicked(MythUIButtonListItem* item);
50  void itemVisible(MythUIButtonListItem* item);
51  void nodeChanged(MythGenericTree* node);
52  void rootChanged(MythGenericTree* node);
53 
54  protected:
55  bool ParseElement(const QString &filename, QDomElement &element,
56  bool showWarnings) override; // MythUIType
57  void CopyFrom(MythUIType *base) override; // MythUIType
58  void CreateCopy(MythUIType *parent) override; // MythUIType
59 
60  private:
61  void Init(void);
62  void SetTreeState(bool refreshAll = false);
63  bool UpdateList(MythUIButtonList *list, MythGenericTree *node) const;
64  bool DoSetCurrentNode(MythGenericTree *node);
65 
66  void SwitchList(bool right);
67 
68  bool m_active {true};
69  bool m_initialized {false};
70  uint m_numLists {1};
71  uint m_visibleLists {0};
72  uint m_currentDepth {0};
73  int m_depthOffset {0};
74  uint m_oldDepth {0};
75  QList<MythUIButtonList*> m_buttonlists;
76  MythUIButtonList *m_listTemplate {nullptr};
77  MythUIButtonList *m_activeList {nullptr};
78  uint m_activeListID {0};
79  MythGenericTree *m_rootNode {nullptr};
80  MythGenericTree *m_currentNode {nullptr};
81  uint m_listSpacing {0};
82 };
83 
84 #endif
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:989
MythUIButtonTree::m_buttonlists
QList< MythUIButtonList * > m_buttonlists
Definition: mythuibuttontree.h:75
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
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
mythuibuttonlist.h
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
MythUIButtonTree
A tree widget for displaying and navigating a MythGenericTree()
Definition: mythuibuttontree.h:16
mythgenerictree.h
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1171
MythUIButtonTree::GetCurrentNode
MythGenericTree * GetCurrentNode(void) const
Definition: mythuibuttontree.h:32
uint
unsigned int uint
Definition: compat.h:81
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
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUIType::gestureEvent
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:1013
MythGenericTree
Definition: mythgenerictree.h:27
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
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
mythuitype.h