Simple display preferences and song database code copied from playlist (will template...
[kworship.git] / kworship / songdb / KwSongDatabaseNode.h
blobdc5de1506a9c7ef211e3372b1fe3d56d6fac2fcb
1 #ifndef _KwSongDatabaseNode_h_
2 #define _KwSongDatabaseNode_h_
4 /**
5 * @file KwSongDatabaseNode.h
6 * @brief A node on a song database tree.
7 * @author James Hogan <james@albanarts.com>
8 */
10 #include <QVariant>
11 #include <QVector>
13 class KwDisplayManager;
15 /// A node on a playlist tree.
16 /**
17 * Inherit from this class for each playlist node type.
19 class KwSongDatabaseNode
21 public:
24 * Constructors + destructor.
27 /// Primary constructor.
28 KwSongDatabaseNode(KwSongDatabaseNode* parent);
30 /// Destructor.
31 virtual ~KwSongDatabaseNode();
34 * Main interface
37 /// Get the parent.
38 KwSongDatabaseNode* getParent();
40 /// Get a child node by index.
41 KwSongDatabaseNode* getChild(int index);
43 /// Get the index of a certain child.
44 int getChildIndex(KwSongDatabaseNode* node) const;
46 /// Get data associated with the node.
47 virtual QVariant getData(int role, int column);
49 /// Get the number of children.
50 virtual int getChildCount() const;
52 /// Activate the node using a display manager.
53 virtual void activate(KwDisplayManager* manager);
55 protected:
57 /// Get a child node by index.
58 virtual KwSongDatabaseNode* _getChild(int index);
60 private:
63 * Variables
66 /// Parent node.
67 KwSongDatabaseNode* m_parent;
69 /// Child nodes.
70 QVector<KwSongDatabaseNode*> m_children;
73 #endif // _KwSongDatabaseNode_h_