]> Shamusworld >> Repos - architektonas/blob - src/base/patternlist.h
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[architektonas] / src / base / patternlist.h
1 #ifndef __PATTERNLIST_H__
2 #define __PATTERNLIST_H__
3
4 #include <QtCore>
5 #include "pattern.h"
6 #include "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 James Hammons
15  * @author Andrew Mustun
16  */
17 class RS_PatternList
18 {
19         protected:
20                 RS_PatternList();
21
22         public:
23                 virtual ~RS_PatternList();
24
25                 static RS_PatternList * instance();
26                 void init();
27                 void clearPatterns();
28                 int countPatterns();
29                 virtual void removePattern(RS_Pattern * pattern);
30                 RS_Pattern * requestPattern(const QString & name);
31                 RS_Pattern * firstPattern();
32                 RS_Pattern * nextPattern();
33                 bool contains(const QString & name);
34
35                 friend std::ostream & operator<<(std::ostream & os, RS_PatternList & l);
36
37         protected:
38                 static RS_PatternList * uniqueInstance;
39
40         private:
41                 //! patterns in the graphic
42                 QList<RS_Pattern *> patterns;
43                 QListIterator<RS_Pattern *> patternIterator;
44 };
45
46 #endif  // __PATTERNLIST_H__