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() = default;
22 
23  bool keyPressEvent(QKeyEvent *) 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);
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
MythGenericTree * GetCurrentNode(void) const
unsigned int slots[4]
Definition: element.c:38
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:971
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:986
unsigned int uint
Definition: compat.h:140
The base class on which all widgets and screens are based.
Definition: mythuitype.h:63
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
QList< MythUIButtonList * > m_buttonlists
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
const char * name
Definition: ParseText.cpp:328
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:69
#define MUI_PUBLIC
Definition: mythuiexp.h:9
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
A tree widget for displaying and navigating a MythGenericTree()