00001 #ifndef MYTHUI_BUTTONTREE_H_ 00002 #define MYTHUI_BUTTONTREE_H_ 00003 00004 #include "mythuitype.h" 00005 #include "mythgenerictree.h" 00006 #include "mythuibuttonlist.h" 00007 00008 class MythUIButtonListItem; 00009 00016 class MUI_PUBLIC MythUIButtonTree : public MythUIType 00017 { 00018 Q_OBJECT 00019 public: 00020 MythUIButtonTree(MythUIType *parent, const QString &name); 00021 ~MythUIButtonTree(); 00022 00023 virtual bool keyPressEvent(QKeyEvent *); 00024 //virtual void gestureEvent(MythUIType *uitype, MythGestureEvent *event); 00025 00026 bool AssignTree(MythGenericTree *tree); 00027 void Reset(void); 00028 bool SetNodeByString(QStringList route); 00029 bool SetNodeById(QList<int> route); 00030 bool SetCurrentNode(MythGenericTree *node); 00031 void ShowSearchDialog(void); 00032 MythGenericTree* GetCurrentNode(void) const { return m_currentNode; } 00033 00034 void SetActive(bool active); 00035 00036 MythUIButtonListItem* GetItemCurrent(void) const; 00037 void RemoveItem(MythUIButtonListItem *item, bool deleteNode = false); 00038 void RemoveCurrentItem(bool deleteNode = false); 00039 00040 public slots: 00041 void handleSelect(MythUIButtonListItem* item); 00042 void handleClick(MythUIButtonListItem* item); 00043 void handleVisible(MythUIButtonListItem* item); 00044 void Select(); 00045 void Deselect(); 00046 00047 signals: 00048 void itemSelected(MythUIButtonListItem* item); 00049 void itemClicked(MythUIButtonListItem* item); 00050 void itemVisible(MythUIButtonListItem* item); 00051 void nodeChanged(MythGenericTree* node); 00052 void rootChanged(MythGenericTree* node); 00053 00054 protected: 00055 virtual bool ParseElement( 00056 const QString &filename, QDomElement &element, bool showWarnings); 00057 virtual void CopyFrom(MythUIType *base); 00058 virtual void CreateCopy(MythUIType *parent); 00059 00060 private: 00061 void Init(void); 00062 void SetTreeState(bool refreshAll = false); 00063 bool UpdateList(MythUIButtonList *list, MythGenericTree *node); 00064 bool DoSetCurrentNode(MythGenericTree *node); 00065 00066 void SwitchList(bool right); 00067 00068 bool m_active; 00069 bool m_initialized; 00070 uint m_numLists; 00071 uint m_visibleLists; 00072 uint m_currentDepth; 00073 int m_depthOffset; 00074 uint m_oldDepth; 00075 QList<MythUIButtonList*> m_buttonlists; 00076 MythUIButtonList *m_listTemplate; 00077 MythUIButtonList *m_activeList; 00078 uint m_activeListID; 00079 MythGenericTree *m_rootNode; 00080 MythGenericTree *m_currentNode; 00081 uint m_listSpacing; 00082 }; 00083 00084 #endif
1.6.3