2 // object.cpp: Base class for all CAD objects
4 // Part of the Architektonas Project
5 // (C) 2011 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
8 // JLH = James Hammons <jlhamm@acm.org>
11 // --- ---------- ------------------------------------------------------------
12 // JLH 03/22/2011 Created this file
13 // JLH 04/01/2011 Added constructor to allow derived objects to have empty
14 // constructor bodies, added state querying
15 // JLH 04/02/2001 Added static methods for global states (fixed angle, etc)
20 // Initialize static variables
21 bool Object::fixedAngle = false;
22 bool Object::fixedLength = false;
23 QFont * Object::font = 0;
24 int Object::viewportHeight = 0;
25 bool Object::deleteActive = false;
26 bool Object::dimensionActive = false;
29 Object::Object(): position(Vector(0, 0)), parent(0), state(OSInactive), oldState(OSInactive),
30 needUpdate(false), attachedDimension(0)
34 Object::Object(Vector v, Object * passedInParent/*= 0*/): position(v), parent(passedInParent),
35 state(OSInactive), oldState(OSInactive), needUpdate(false), attachedDimension(0)
43 /*virtual*/ void Object::Draw(Painter *)
47 /*virtual*/ Vector Object::Center(void)
52 /*virtual*/ bool Object::Collided(Vector)
57 /*virtual*/ void Object::PointerMoved(Vector)
61 /*virtual*/ void Object::PointerReleased(void)
65 /*virtual*/ bool Object::NeedsUpdate(void)
70 // This is intended to be overridden by the Container class, for object morphing
71 /*virtual*/ void Object::Transmute(Object *, Object *)
75 /*virtual*/ Object * Object::GetParent(void)
80 /*virtual*/ void Object::Add(Object *)
84 ObjectState Object::GetState(void)
89 void Object::Reparent(Object * newParent)
96 void Object::SetFixedAngle(bool state/*= true*/)
101 void Object::SetFixedLength(bool state/*= true*/)
106 void Object::SetFont(QFont * f)
111 void Object::SetViewportHeight(int height)
113 viewportHeight = height;
116 void Object::SetDeleteActive(bool state/*= true*/)
118 deleteActive = state;
121 void Object::SetDimensionActive(bool state/*= true*/)
123 dimensionActive = state;