Widget minimizing

Towelie

07-04-2011 21:54:25

HI, i've got a question about minimizing widgets as it's made in layouteditor (in a "propreties -- main and other" tab), i've looked through the .layout file and sources, but i still can't understand how did they realize that.

Altren

07-04-2011 21:58:42

You can look into Demo_PanelView. Smooth widgets resizing is done with PositionController
Here's piece of code:
void updateMinimized()
{
const float POSITION_CONTROLLER_TIME = 0.5f;
if (!m_minimized)
{
MyGUI::IntSize size(mMainWidget->getWidth(), m_maxHeight);
MyGUI::ControllerPosition* controller = createControllerPosition(size, POSITION_CONTROLLER_TIME, MyGUI::newDelegate(MyGUI::action::inertionalMoveFunction));
controller->eventUpdateAction += newDelegate(this, &BasePanelViewCell::notifyUpdateAction);
MyGUI::ControllerManager::getInstance().addItem(mMainWidget, controller);
}
else
{
MyGUI::IntSize size(mMainWidget->getWidth(), m_minHeight);
MyGUI::ControllerPosition* controller = createControllerPosition(size, POSITION_CONTROLLER_TIME, MyGUI::newDelegate(MyGUI::action::inertionalMoveFunction));
controller->eventUpdateAction += newDelegate(this, &BasePanelViewCell::notifyUpdateAction);
MyGUI::ControllerManager::getInstance().addItem(mMainWidget, controller);
}
}
Also widgets below active are moved with same controller.