treeitem.h
author insilmaril
Wed, 04 Feb 2009 16:33:16 +0000
changeset 740 6dc0a20031f7
parent 738 716a777c1c98
child 741 1b4d1ea6ea8c
permissions -rw-r--r--
started to rewrite first(), next()
     1 #ifndef TREEITEM_H
     2 #define TREEITEM_H
     3 
     4 #include <QList>
     5 #include <QVariant>
     6 
     7 class LinkableMapObj;
     8 
     9 class TreeItem
    10 {
    11 public:
    12 	enum Type {Undefined,MapCenter,Branch,Image};
    13     TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
    14     ~TreeItem();
    15 
    16 	// General housekeeping
    17     void appendChild (TreeItem *child);
    18 	void removeChild (int row);
    19 
    20     TreeItem *child(int row);
    21     int childCount() const;
    22     int columnCount() const;
    23 
    24     int row() const;
    25 	int column() const;
    26 	int depth() ;
    27     TreeItem *parent();
    28 
    29 	// Accessing data
    30     QVariant data(int column) const;
    31 	void setHeading (const QString s);
    32 	QString getHeading();
    33 	void setType (const Type t);
    34 	Type getType ();
    35 	QString getTypeName ();
    36 
    37 	// Navigation and selection
    38 	TreeItem* getChildNum(const int &n);
    39 	TreeItem* getFirstBranch();
    40 	TreeItem* getLastBranch();
    41 	TreeItem* getBranchNum(const int &n);
    42 	void setLastSelectedBranch();
    43 	TreeItem* getLastSelectedBranch();
    44 
    45 	
    46 	// Relation to map objects in graphicsscene
    47 	LinkableMapObj* getLMO();
    48 	void setLMO (LinkableMapObj*);
    49 
    50 private:
    51     QList<TreeItem*> childItems;
    52     QList<QVariant> itemData;
    53     TreeItem *parentItem;
    54  
    55 	Type type;
    56 	LinkableMapObj *lmo;
    57 
    58 	int branchOffset;
    59 	int branchCount;
    60 	int lastSelectedBranchNum;
    61 };
    62 
    63 #endif