1 // Copyright (c) 2012 Dennco Project
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // Created by tkawata on Sep-30, 2012.
19 #ifndef DCVCOMPONENT_H
20 #define DCVCOMPONENT_H
23 #include <QDomElement>
31 enum DCVVisibility {DCV_VISIBLE_FULL, DCV_VISIBLE_WIREFRAME, DCV_VISIBLE_NONE };
34 double d_modelview[16];
35 DCVVisibility d_isVisible;
41 virtual ~DCVComponent() {}
43 virtual DCVCPage * getPageBelonging() const = 0;
44 virtual DCCell* getOwnerCell() const = 0;
45 virtual bool isResizingArea(float x, float y, float z) const = 0;
46 virtual DCVVisibility getIsVisible() const { return d_isVisible; }
47 virtual bool getIsSelectable() const { return d_isSelectable; }
48 virtual bool getIsSelected() const { return d_isSelected; }
49 virtual const double * getModelViewMatrix() const { return d_modelview; }
51 virtual void prepareChildrenForDraw(bool isAnimationInterval) = 0;
52 virtual void drawChildren(bool isAnimationInterval) = 0;
53 virtual void drawChildrenForSelection(QList<DCVComponent*> *itemList) = 0;
54 virtual void translate() = 0;
55 virtual void setVisible(DCVVisibility visibleSelf, DCVVisibility childrenAreVisible) { d_isVisible = visibleSelf; }
56 virtual void setSelectable(bool selectable) { d_isSelectable = selectable; }
57 virtual void setSelected(bool selectedSelf, bool updateChildren) { d_isSelected = selectedSelf; }
58 virtual void renderOwnShape(bool isAnimationInterval, bool renderAsWireframe) = 0;
60 virtual bool startDrag(float x, float y, float z, bool isResizingDrag) = 0;
61 virtual bool dragging(float x, float y, float z, bool isResizingDrag) = 0;
62 virtual bool endDrag(float x, float y, float z, bool isResizingDrag) = 0;
64 virtual void prepareForDraw(bool isAnimationInterval);
65 virtual void draw(bool isAnimationInterval);
66 virtual void drawForSelection(QList<DCVComponent*> *itemList);
67 virtual void renderOwnShapeForSelection();
68 virtual void updateShape() = 0;
70 virtual void saveAttributesToXML(QDomDocument *document, QDomElement* element) = 0;
71 virtual void loadAttributesFromXML(QDomElement element) = 0;
75 #endif // DCVCOMPONENT_H