]> Shamusworld >> Repos - architektonas/blob - src/base/blocklist.h
Bugfixes related to removing Snapper class.
[architektonas] / src / base / blocklist.h
1 #ifndef __BLOCKLIST_H__
2 #define __BLOCKLIST_H__
3
4 #include <QtCore>
5 #include "block.h"
6 //#include "blocklistlistener.h"
7 #include "entity.h"
8
9 /**
10  * List of blocks.
11  *
12  * @see Block
13  *
14  * @author Andrew Mustun
15  */
16 class BlockList
17 {
18         public:
19                 BlockList(bool owner = false);
20                 virtual ~BlockList();
21
22                 void clear();
23                 uint count();
24                 Block * at(uint i);
25                 void activate(const QString & name);
26                 void activate(Block * block);
27                 Block * getActive();
28                 virtual bool add(Block * block, bool notify = true);
29                 virtual void addNotification();
30                 virtual void remove(Block * block);
31                 virtual bool rename(Block * block, const QString & name);
32                 //virtual void editBlock(Block* block, const Block& source);
33                 Block * find(const QString & name);
34                 QString newName(const QString & suggestion = "");
35                 void toggle(const QString & name);
36                 void toggle(Block * block);
37                 void freezeAll(bool freeze);
38 //              void addListener(BlockListListener * listener);
39 //              void removeListener(BlockListListener * listener);
40                 void setModified(bool m);
41                 virtual bool isModified() const;
42
43                 friend std::ostream & operator<<(std::ostream & os, BlockList & b);
44
45         private:
46                 //! Is the list owning the blocks?
47                 bool owner;
48                 //! Blocks in the graphic
49                 QList<Block *> blocks;
50                 //! List of registered BlockListListeners
51 //              QList<BlockListListener *> blockListListeners;
52                 //! Currently active block
53                 Block * activeBlock;
54                 /** Flag set if the layer list was modified and not yet saved. */
55                 bool modified;
56 };
57
58 #endif