1 //////////////////////////////////////////////////////////////////////////
2 //
3 // pgAdmin III - PostgreSQL Tools
4 //
5 // Copyright (C) 2002 - 2016, The pgAdmin Development Team
6 // This software is released under the PostgreSQL Licence
7 //
8 // hdDrawing.h - Main storage class for all objects of the model
9 //
10 //////////////////////////////////////////////////////////////////////////
11 
12 #ifndef HDDRAWING_H
13 #define HDDRAWING_H
14 
15 #include "hotdraw/figures/hdIFigure.h"
16 #include "hotdraw/utilities/hdRect.h"
17 
18 
19 // Main model of drawing
20 class hdDrawing : public wxObject
21 {
22 public:
23 	hdDrawing(hdDrawingEditor *owner);
24 	virtual ~hdDrawing();
25 	virtual void add(hdIFigure *figure);
26 	virtual void remove(hdIFigure *figure);
27 	virtual bool includes(hdIFigure *figure);
28 	virtual hdIFigure *findFigure(int posIdx, int x, int y);
29 	virtual void recalculateDisplayBox(int posIdx);
30 	virtual void bringToFront(hdIFigure *figure);
31 	virtual void sendToBack(hdIFigure *figure);
32 	virtual hdRect &DisplayBox();
33 	virtual hdIteratorBase *figuresEnumerator();
34 	virtual hdIteratorBase *figuresInverseEnumerator();
35 	virtual void removeAllFigures();
36 	virtual void deleteAllFigures();
registerView(hdDrawingView * view)37 	virtual void registerView(hdDrawingView *view)
38 	{
39 		usedView = view;
40 	};
getView()41 	virtual hdDrawingView *getView()
42 	{
43 		return usedView;
44 	};
45 	virtual void addToSelection(hdIFigure *figure);
46 	virtual void addToSelection(hdCollection *figures);
47 	virtual void removeFromSelection(hdIFigure *figure);
48 	virtual void deleteSelectedFigures();
49 	virtual void toggleSelection(hdIFigure *figure);
50 	virtual void clearSelection();
51 	virtual bool isFigureSelected(hdIFigure *figure);
52 	virtual hdIteratorBase *selectionFigures();
53 	virtual int countSelectedFigures();
selectedFigures()54 	hdCollection *selectedFigures()
55 	{
56 		return selection;
57 	};
getFiguresCollection()58 	hdCollection *getFiguresCollection()
59 	{
60 		return figures;
61 	};
getOwnerEditor()62 	hdDrawingEditor *getOwnerEditor()
63 	{
64 		return ownerEditor;
65 	};
setName(wxString name)66 	void setName(wxString name)
67 	{
68 		drawingName = name;
69 	};
getName()70 	wxString getName()
71 	{
72 		return drawingName;
73 	};
74 protected:
75 
76 private:
77 	hdDrawingEditor *ownerEditor;
78 	hdDrawingView *usedView;
79 	hdCollection *selection;
80 	hdCollection *figures;
81 	hdCollection *handles;
82 	hdRect displayBox;
83 	wxString drawingName;
84 };
85 #endif
86