selection.h
author insilmaril
Mon, 08 Dec 2008 16:57:33 +0000
changeset 729 7ddbe3fa34a1
parent 728 a8a98a94899a
child 732 b77b56f707f1
permissions -rw-r--r--
More fixes for selections
     1 #ifndef SELECTION_H
     2 #define SELECTION_H
     3 
     4 #include <QString>
     5 #include <QList>
     6 #include <QGraphicsScene>
     7 #include <QItemSelectionModel>
     8 
     9 #include "treeitem.h"
    10 
    11 class BranchObj;
    12 class FloatImageObj;
    13 class MapCenterObj;
    14 class LinkableMapObj;
    15 class VymModel;
    16 
    17 
    18 class Selection 
    19 {
    20 public:
    21 	enum Type {Undefined,Branch,MapCenter,FloatImage};
    22 	Selection ();
    23 	~Selection();
    24 	void copy(const Selection&);
    25 	void clear();
    26 	void setModel (VymModel *);
    27 	void update();      
    28 	bool select (LinkableMapObj*);
    29 	bool select (const QString &);
    30 	bool reselect ();
    31 	void unselect ();
    32 	bool isBlocked ();
    33 	void block();
    34 	void unblock();
    35 	bool isEmpty();
    36 	uint count();
    37 	Type type();
    38 	LinkableMapObj * first();		// first in selection list
    39 	LinkableMapObj * single();		// NULL, if multiple selected
    40 	BranchObj* getBranch();
    41 	TreeItem* getBranchItem();		
    42 	QModelIndex getBranchIndex();	//!< Returns index of first selected branch or mapcenter
    43 	FloatImageObj* getFloatImage();
    44 
    45 	QString getSelectString();
    46 
    47 private:
    48 	QList <LinkableMapObj*> selectList;
    49 	QList <LinkableMapObj*> lastSelectList;
    50 
    51 	VymModel *model;
    52 
    53 	QItemSelectionModel *selModel;	//!< QSelectionModel is shared across views and initialized in setModel
    54 
    55 	QColor color;
    56 	bool blocked;					//!< if true, no new selection possible
    57 };
    58 
    59 #endif
    60