1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 03:54:40 +00:00
OpenMW/apps/openmw/mwgui/itemselection.cpp
2012-08-27 20:44:14 +02:00

46 lines
1.4 KiB
C++

#include "itemselection.hpp"
namespace MWGui
{
ItemSelectionDialog::ItemSelectionDialog(const std::string &label, ContainerBase::Filter filter, MWBase::WindowManager& parWindowManager)
: ContainerBase(NULL)
, WindowModal("openmw_itemselection_dialog.layout", parWindowManager)
{
mFilter = filter;
MyGUI::ScrollView* itemView;
MyGUI::Widget* containerWidget;
getWidget(containerWidget, "Items");
getWidget(itemView, "ItemView");
setWidgets(containerWidget, itemView);
MyGUI::TextBox* l;
getWidget(l, "Label");
l->setCaptionWithReplacing (label);
MyGUI::Button* cancelButton;
getWidget(cancelButton, "CancelButton");
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemSelectionDialog::onCancelButtonClicked);
int dx = (cancelButton->getTextSize().width + 24) - cancelButton->getWidth();
cancelButton->setCoord(cancelButton->getLeft() - dx,
cancelButton->getTop(),
cancelButton->getTextSize ().width + 24,
cancelButton->getHeight());
center();
}
void ItemSelectionDialog::onSelectedItemImpl(MWWorld::Ptr item)
{
eventItemSelected(item);
}
void ItemSelectionDialog::onCancelButtonClicked(MyGUI::Widget* sender)
{
eventDialogCanceled();
}
}