return collision;
}
+/*
+What we need to do is check for whether or not we're a top level container,
+and override the passing of stuff into the objects held. So here, if we're *NOT*
+a top level container, instead of passing PointerMoved to our contained objects,
+we check to see if our bounds are met (for selection rectangle, e.g.).
+
+Also, for things like being able to split point's hot spots we need to be able
+to check for that crap in the top level container. Which means that objects can
+still know how to move themselves, but they can also defer to their container
+as well. Which also means that things like HitTest() need to be in the Object
+class so that we can leverage that stuff here as well.
+*/
// The TLC is passing all mouse movement here, so we're doing the same here.
// Need to adjust all other objects to handle things correctly.
// every object for collision.
/*virtual*/ void Container::PointerMoved(Vector point)
{
+ if (!isTopLevelContainer)
+ {
+ // check for selection rectangle too
+
+
+ needUpdate = true;
+
+ for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
+ {
+ if ((*i)->HitTest(point))
+ {
+ state = OSSelected;
+ return;
+ }
+ }
+
+ state = OSInactive;
+ return;
+ }
+
// objectWasDragged = true;
//printf("CONTAINER: PointerMoved()\n");
/*virtual*/ bool Container::NeedsUpdate(void)
{
+ // If this is *not* a top level container, then we treat it as an
+ // aggregate object.
+ if (!isTopLevelContainer)
+ {
+ return needUpdate;
+ }
+
// Search through objects for one that needs an update; if one is found,
// return immediately.
for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
}
+/*virtual*/ QRectF Container::Extents(void)
+{
+ QRectF bounds;
+
+ for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
+ bounds = bounds.united((*i)->Extents());
+
+ return bounds;
+}
+
+
void Container::Delete(Object * objectToDelete)
{
std::vector<Object *>::iterator i = objects.begin();
return;
// Shuffle the contents of this container to the new one
- for(unsigned int i=0; i<objects.size(); i++)
- newContainer->Add(objects[i]);
+// for(unsigned int i=0; i<objects.size(); i++)
+ for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
+ {
+ newContainer->Add(*i);
+ (*i)->Reparent(newContainer);
+ }
// & clear our vector
objects.clear();
}
newContainer->Add(*i);
+ (*i)->Reparent(newContainer);
objects.erase(i);
}
}