]> Shamusworld >> Repos - architektonas/blob - src/base/rs_patternlist.h
f5c1061460d934c9a2bebc34db8e63fe0e2e71a4
[architektonas] / src / base / rs_patternlist.h
1 #ifndef RS_PATTERNLIST_H
2 #define RS_PATTERNLIST_H
3
4 #include <QtCore>
5 #include "rs_pattern.h"
6 #include "rs_entity.h"
7
8 #define RS_PATTERNLIST RS_PatternList::instance()
9
10 /**
11  * The global list of patterns. This is implemented as a singleton.
12  * Use RS_PatternList::instance() to get a pointer to the object.
13  *
14  * @author Andrew Mustun
15  */
16 class RS_PatternList
17 {
18         protected:
19                 RS_PatternList();
20
21         public:
22                 virtual ~RS_PatternList();
23
24                 static RS_PatternList * instance();
25                 void init();
26                 void clearPatterns();
27                 int countPatterns();
28                 virtual void removePattern(RS_Pattern * pattern);
29                 RS_Pattern * requestPattern(const QString & name);
30                 RS_Pattern * firstPattern();
31                 RS_Pattern * nextPattern();
32                 bool contains(const QString & name);
33
34                 friend std::ostream & operator<<(std::ostream & os, RS_PatternList & l);
35
36         protected:
37                 static RS_PatternList * uniqueInstance;
38
39         private:
40                 //! patterns in the graphic
41         //    Q3PtrList<RS_Pattern> patterns;
42                 QList<RS_Pattern *> patterns;
43                 QListIterator<RS_Pattern *> patternIterator;
44                 //! List of registered PatternListListeners
45                 //Q3PtrList<RS_PatternListListener> patternListListeners;
46 };
47
48 #endif