1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/*!
@file
@author Albert Semenov
@date 08/2008
*/
#include "Precompiled.h"
#include "Dialog.h"
#include "DialogManager.h"
namespace tools
{
Dialog::Dialog() :
mModal(false),
mRootWidget(nullptr)
{
}
Dialog::~Dialog()
{
}
void Dialog::doModal()
{
MYGUI_ASSERT(mModal != true, "Already modal mode");
mModal = true;
MyGUI::InputManager::getInstance().addWidgetModal(mRootWidget);
MyGUI::LayerManager::getInstance().upLayerItem(mRootWidget);
onDoModal();
mRootWidget->setVisible(true);
DialogManager::getInstance()._addDialog(this);
}
void Dialog::endModal()
{
MYGUI_ASSERT(mModal != false, "Already modal mode");
mModal = false;
mRootWidget->setVisible(false);
MyGUI::InputManager::getInstance().removeWidgetModal(mRootWidget);
DialogManager::getInstance()._removeDialog(this);
onEndModal();
}
void Dialog::setDialogRoot(MyGUI::Widget* _root)
{
mRootWidget = _root;
}
bool Dialog::isDialogModal()
{
return mModal;
}
}
|