@@ -572,7 +572,7 @@ void ComponentTypeHandler::fillInResizeCode (GeneratedCode& code, Component* com | |||||
r << memberVariableName << "->setBounds (" | r << memberVariableName << "->setBounds (" | ||||
<< x << ", " << y << ", " << w << ", " << h << ");\n"; | << x << ", " << y << ", " << w << ", " << h << ");\n"; | ||||
if (pos.rect.isPositionAbsolute()) | |||||
if (pos.rect.isPositionAbsolute() && ! code.document->getComponentLayout()->isComponentPositionRelative (component)) | |||||
code.constructorCode += r + "\n"; | code.constructorCode += r + "\n"; | ||||
else | else | ||||
code.getCallbackCode (String(), "void", "resized()", false) += r; | code.getCallbackCode (String(), "void", "resized()", false) += r; | ||||
@@ -554,6 +554,15 @@ bool ComponentLayout::dependsOnComponentForRelativePos (Component* comp, Compone | |||||
return false; | return false; | ||||
} | } | ||||
bool ComponentLayout::isComponentPositionRelative (Component* comp) const | |||||
{ | |||||
for (int i = 0; i < getNumComponents(); ++i) | |||||
if (dependsOnComponentForRelativePos (comp, getComponent (i))) | |||||
return true; | |||||
return false; | |||||
} | |||||
const int menuIdBase = 0x63240000; | const int menuIdBase = 0x63240000; | ||||
PopupMenu ComponentLayout::getRelativeTargetMenu (Component* comp, int whichDimension) const | PopupMenu ComponentLayout::getRelativeTargetMenu (Component* comp, int whichDimension) const | ||||
@@ -71,6 +71,7 @@ public: | |||||
void setComponentRelativeTarget (Component* comp, int whichDimension, Component* compToBeRelativeTo); | void setComponentRelativeTarget (Component* comp, int whichDimension, Component* compToBeRelativeTo); | ||||
// checks recursively whether the comp depends on the given comp for its position | // checks recursively whether the comp depends on the given comp for its position | ||||
bool dependsOnComponentForRelativePos (Component* comp, Component* possibleDependee) const; | bool dependsOnComponentForRelativePos (Component* comp, Component* possibleDependee) const; | ||||
bool isComponentPositionRelative (Component* comp) const; | |||||
PopupMenu getRelativeTargetMenu (Component* comp, int whichDimension) const; | PopupMenu getRelativeTargetMenu (Component* comp, int whichDimension) const; | ||||
void processRelativeTargetMenuResult (Component* comp, int whichDimension, int menuResultID); | void processRelativeTargetMenuResult (Component* comp, int whichDimension, int menuResultID); | ||||