00001
00011 #ifndef SCRIBBLE_DOC_H
00012 #define SCRIBBLE_DOC_H
00013
00014 #include <basic.h>
00015 #include <list>
00016 #include "Stroke.h"
00017
00019
00022 class ScribbleDoc {
00023
00024 private:
00025
00026
00027 typedef std::list<DrawingStroke> DrawingStrokeList;
00028 typedef DrawingStrokeList::iterator DrawingStrokeIterator;
00029 typedef DrawingStrokeList::const_iterator DrawingStrokeConstIterator;
00030
00031 public:
00032
00033
00034 typedef std::list<DrawingStroke*> DrawingStrokePtrList;
00035 typedef DrawingStrokePtrList::iterator DrawingStrokePtrIterator;
00036 typedef DrawingStrokePtrList::const_iterator DrawingStrokeConstPtrIterator;
00037
00038 private:
00039
00041 DrawingStrokeList stroke;
00042
00044 mutable bool modified;
00045
00047
00051 void calcBounds(RECT *bound) const;
00052
00053 public:
00054
00056 ScribbleDoc() : modified(false) {}
00057
00059
00063 bool isModified() const {
00064 return modified;
00065 }
00066
00068
00072 void addStroke(const DrawingStroke& s){
00073 modified = true;
00074 stroke.push_back(s);
00075 }
00076
00078
00084 W draw(W gid, int lb, int ub) const;
00085
00087
00093 bool load(const LINK* src);
00094
00096
00100 void save(const LINK* dest) const;
00101
00103
00106 void clear(){
00107 modified = false;
00108 stroke.clear();
00109 }
00110
00112
00121 bool select(DrawingStrokePtrList* selection, const SelectionStroke& selstroke, int lb, int ub);
00122
00124
00127 void unselectAll();
00128
00130
00133 void removeSelected();
00134
00136
00141 void moveSelected(int dh, int dv);
00142
00143 };
00144
00145 #endif // SCRIBBLE_DOC_H