X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcontainer.cpp;fp=src%2Fcontainer.cpp;h=47295f40f043576fdcd24b9d37ef803af439918d;hb=14fee18e7a8ebfccfc1ebe203fe049f268efb40a;hp=bd37b7738610a1e4c54586699b2932cf57cec417;hpb=59e5af9d8606aa091fa979e19f78e9325a1c0825;p=architektonas diff --git a/src/container.cpp b/src/container.cpp index bd37b77..47295f4 100644 --- a/src/container.cpp +++ b/src/container.cpp @@ -169,6 +169,18 @@ printf("Container::Collided: Deleting object ($%X)\n", *i); 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. @@ -237,6 +249,17 @@ printf("Container: Added object (=$%X). size = %li\n", object, objects.size()); } +/*virtual*/ QRectF Container::Extents(void) +{ + QRectF bounds; + + for(std::vector::iterator i=objects.begin(); i!=objects.end(); i++) + bounds = bounds.united((*i)->Extents()); + + return bounds; +} + + void Container::Delete(Object * objectToDelete) { std::vector::iterator i = objects.begin(); @@ -337,8 +360,12 @@ void Container::MoveContentsTo(Container * newContainer) return; // Shuffle the contents of this container to the new one - for(unsigned int i=0; iAdd(objects[i]); +// for(unsigned int i=0; i::iterator i=objects.begin(); i!=objects.end(); i++) + { + newContainer->Add(*i); + (*i)->Reparent(newContainer); + } // & clear our vector objects.clear(); @@ -361,6 +388,7 @@ void Container::MoveSelectedContentsTo(Container * newContainer) } newContainer->Add(*i); + (*i)->Reparent(newContainer); objects.erase(i); } }