本文整理汇总了C++中RelativePositionedRectangle类的典型用法代码示例。如果您正苦于以下问题:C++ RelativePositionedRectangle类的具体用法?C++ RelativePositionedRectangle怎么用?C++ RelativePositionedRectangle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RelativePositionedRectangle类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XmlElement
XmlElement* ComponentTypeHandler::createXmlFor (Component* comp, const ComponentLayout* layout)
{
XmlElement* e = new XmlElement (getXmlTagName());
e->setAttribute ("name", comp->getName());
e->setAttribute ("id", String::toHexString (getComponentId (comp)));
e->setAttribute ("memberName", comp->getProperties() ["memberName"].toString());
e->setAttribute ("virtualName", comp->getProperties() ["virtualName"].toString());
e->setAttribute ("explicitFocusOrder", comp->getExplicitFocusOrder());
RelativePositionedRectangle pos (getComponentPosition (comp));
pos.updateFromComponent (*comp, layout);
pos.applyToXml (*e);
if (SettableTooltipClient* const ttc = dynamic_cast <SettableTooltipClient*> (comp))
if (ttc->getTooltip().isNotEmpty())
e->setAttribute ("tooltip", ttc->getTooltip());
for (int i = 0; i < colours.size(); ++i)
{
if (comp->isColourSpecified (colours[i]->colourId))
{
e->setAttribute (colours[i]->xmlTagName,
comp->findColour (colours[i]->colourId).toString());
}
}
return e;
}
示例2: rescalePoint
void PaintElementPath::rescalePoint (RelativePositionedRectangle& pos, int dx, int dy,
double scaleX, double scaleY,
double scaleStartX, double scaleStartY,
const Rectangle<int>& parentArea) const
{
double x, y, w, h;
pos.getRectangleDouble (x, y, w, h, parentArea, getDocument()->getComponentLayout());
x = (x - scaleStartX) * scaleX + scaleStartX + dx;
y = (y - scaleStartY) * scaleY + scaleStartY + dy;
pos.updateFrom (x, y, w, h, parentArea, getDocument()->getComponentLayout());
}
示例3: pr
void PaintElement::setCurrentBounds (const Rectangle<int>& newBounds,
const Rectangle<int>& parentArea,
const bool undoable)
{
RelativePositionedRectangle pr (position);
pr.updateFrom (newBounds.getX() - parentArea.getX(),
newBounds.getY() - parentArea.getY(),
jmax (1, newBounds.getWidth()),
jmax (1, newBounds.getHeight()),
Rectangle<int> (0, 0, parentArea.getWidth(), parentArea.getHeight()),
getDocument()->getComponentLayout());
setPosition (pr, undoable);
updateBounds (parentArea);
}
示例4: positionToXY
void positionToXY (const RelativePositionedRectangle& position,
double& x, double& y,
const Rectangle<int>& parentArea,
const ComponentLayout* layout)
{
double w, h;
position.getRectangleDouble (x, y, w, h, parentArea, layout);
}
示例5: jassert
bool ComponentTypeHandler::restoreFromXml (const XmlElement& xml,
Component* comp,
const ComponentLayout* layout)
{
jassert (xml.hasTagName (getXmlTagName()));
if (! xml.hasTagName (getXmlTagName()))
return false;
comp->setName (xml.getStringAttribute ("name", comp->getName()));
setComponentId (comp, xml.getStringAttribute ("id").getHexValue64());
comp->getProperties().set ("memberName", xml.getStringAttribute ("memberName"));
comp->getProperties().set ("virtualName", xml.getStringAttribute ("virtualName"));
comp->setExplicitFocusOrder (xml.getIntAttribute ("explicitFocusOrder"));
RelativePositionedRectangle currentPos (getComponentPosition (comp));
currentPos.updateFromComponent (*comp, layout);
RelativePositionedRectangle rpr;
rpr.restoreFromXml (xml, currentPos);
jassert (layout != 0);
setComponentPosition (comp, rpr, layout);
SettableTooltipClient* const ttc = dynamic_cast <SettableTooltipClient*> (comp);
if (ttc != 0)
ttc->setTooltip (xml.getStringAttribute ("tooltip"));
for (int i = 0; i < colours.size(); ++i)
{
const String col (xml.getStringAttribute (colours[i]->xmlTagName, String::empty));
if (col.isNotEmpty())
{
comp->setColour (colours[i]->colourId,
Colour (col.getHexValue32()));
}
}
return true;
}
示例6: setComponentPosition
void ComponentTypeHandler::setComponentPosition (Component* comp,
const RelativePositionedRectangle& newPos,
const ComponentLayout* layout)
{
comp->getProperties().set ("pos", newPos.rect.toString());
comp->getProperties().set ("relativeToX", String::toHexString (newPos.relativeToX));
comp->getProperties().set ("relativeToY", String::toHexString (newPos.relativeToY));
comp->getProperties().set ("relativeToW", String::toHexString (newPos.relativeToW));
comp->getProperties().set ("relativeToH", String::toHexString (newPos.relativeToH));
comp->setBounds (newPos.getRectangle (Rectangle<int> (0, 0, comp->getParentWidth(), comp->getParentHeight()),
layout));
}
示例7: r
void ColouredElement::setCurrentBounds (const Rectangle<int>& newBounds,
const Rectangle<int>& parentArea,
const bool undoable)
{
Rectangle<int> r (newBounds);
if (isStrokePresent)
{
r = r.expanded (-((int) strokeType.stroke.getStrokeThickness() / 2 + 1));
r.setSize (jmax (1, r.getWidth()), jmax (1, r.getHeight()));
}
RelativePositionedRectangle pr (position);
pr.updateFrom (r.getX() - parentArea.getX(),
r.getY() - parentArea.getY(),
r.getWidth(), r.getHeight(),
Rectangle<int> (0, 0, parentArea.getWidth(), parentArea.getHeight()),
getDocument()->getComponentLayout());
setPosition (pr, undoable);
updateBounds (parentArea);
}