]> Shamusworld >> Repos - architektonas/blobdiff - src/container.cpp
Add Dimension sizing.
[architektonas] / src / container.cpp
index 47295f40f043576fdcd24b9d37ef803af439918d..e909c04ae14b1ba8f9a7e6c0af4b2464cf76aff0 100644 (file)
@@ -191,6 +191,26 @@ class so that we can leverage that stuff here as well.
 // 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");
 
@@ -230,6 +250,13 @@ about keeping track of old states...
 
 /*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++)
@@ -394,6 +421,25 @@ void Container::MoveSelectedContentsTo(Container * newContainer)
 }
 
 
+void Container::ResizeAllDimensions(double newSize)
+{
+       for(std::vector<Object *>::iterator i=objects.begin(); i!=objects.end(); i++)
+       {
+//             Object * object = *i;
+
+               if ((*i)->type == OTDimension)
+//             if (object->type == OTDimension)
+               {
+                       ((Dimension *)(*i))->size = newSize;
+               }
+               if ((*i)->type == OTContainer)
+               {
+                       ((Container *)(*i))->ResizeAllDimensions(newSize);
+               }
+       }
+}
+
+
 /*virtual*/ void Container::Enumerate(FILE * file)
 {
        // Only put "CONTAINER" markers if *not* the top level container