Ejemplo n.º 1
0
SpaceShipDesignerGUI::SpaceShipDesignerGUI(ENGINE *engine, SpaceShipDesigner *parent)
{
    mParent = parent;
    mEngine = engine;
    mGUI = engine->loadGUI("Designer.layout");
    for(MyGUI::VectorWidgetPtr::iterator i=mGUI.begin(); i!=mGUI.end(); ++i)
    {
        MyGUI::WidgetPtr w = *i;
        if(w->getName() == "Root")
        {
            mRoot = w;
            mRoot->setSize(mEngine->getWindow()->getWidth(), mEngine->getWindow()->getHeight());
            for(size_t j=0; j<mRoot->getChildCount(); j++)
            {
                if(w->getChildAt(j)->getTypeName() == "Button")
                    w->getChildAt(j)->eventMouseButtonClick = MyGUI::newDelegate(SpaceShipDesignerGUI::buttonClicked);
                else if(w->getChildAt(j)->getTypeName() == "EditBox")
                    ((MyGUI::EditBox *)w->getChildAt(j))->eventEditTextChange = MyGUI::newDelegate(SpaceShipDesignerGUI::editBoxUpdated);
            }
        }
    }
}
Ejemplo n.º 2
0
void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
{
    size_t count = widget->getChildCount();
    int pos = 0;
    pos += margin;
    int width = 0;
    for (unsigned i = 0; i < count; ++i)
    {
        MyGUI::WidgetPtr child = widget->getChildAt(i);
        if (!child->getVisible())
            continue;

        child->setPosition(child->getLeft(), pos);
        width = std::max(width, child->getWidth());
        pos += child->getHeight() + margin;
    }
    width += margin*2;
    widget->setSize(width, pos);
}