selection.h
author insilmaril
Wed, 16 Jul 2008 10:46:14 +0000
changeset 721 12958f987bcf
parent 642 d35bd2241fd1
child 726 7f43b93242aa
permissions -rw-r--r--
Started to restructure for later use of Model/View
     1 #ifndef SELECTION_H
     2 #define SELECTION_H
     3 
     4 #include <QString>
     5 #include <QList>
     6 #include <QGraphicsScene>
     7 
     8 
     9 class BranchObj;
    10 class FloatImageObj;
    11 class MapCenterObj;
    12 class LinkableMapObj;
    13 class VymModel;
    14 
    15 
    16 class Selection 
    17 {
    18 public:
    19 	enum Type {Undefined,Branch,MapCenter,FloatImage};
    20 	Selection ();
    21 	~Selection();
    22 	void copy(const Selection&);
    23 	void clear();
    24 	void setModel (VymModel *);
    25 	void update();
    26 	void setColor (QColor c);
    27 	QColor getColor ();
    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 	FloatImageObj* getFloatImage();
    42 
    43 	QString getSelectString();
    44 
    45 private:
    46 	void init();
    47 	QList <LinkableMapObj*> selectList;
    48 	QList <LinkableMapObj*> lastSelectList;
    49 	QList <QGraphicsRectItem*> selboxList;
    50 	VymModel *model;
    51 	QGraphicsScene *scene;
    52 
    53 	QColor color;
    54 	bool blocked;					//!< if true, no new selection possible
    55 };
    56 
    57 #endif
    58