diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 2c09d6b29..9071c9b35 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -35,7 +35,7 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro //center(); adjustWindowCaption(); - getWidget(containerWidget, "Items"); + getWidget(mContainerWidget, "Items"); getWidget(takeButton, "TakeButton"); getWidget(closeButton, "CloseButton"); @@ -43,6 +43,7 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro setText("CloseButton","Close"); setText("TakeButton","Take All"); + mContainerWidget->eventMouseItemActivate += MyGUI::newDelegate(this,&ContainerWindow::onSelectedItem); } ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Environment& environment,std::string guiFile) @@ -52,8 +53,7 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro setText("_Main", "Name of Container"); //center(); adjustWindowCaption(); - - getWidget(containerWidget, "Items"); + getWidget(mContainerWidget, "Items"); //getWidget(takeButton, "TakeButton"); //getWidget(closeButton, "CloseButton"); @@ -61,6 +61,7 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro //setText("CloseButton","Close"); //setText("TakeButton","Take All"); + mContainerWidget->eventMouseItemActivate += MyGUI::newDelegate(this,&ContainerWindow::onSelectedItem); } ContainerWindow::~ContainerWindow() { @@ -126,8 +127,8 @@ void ContainerWindow::open(MWWorld::Ptr& container) path+=MWWorld::Class::get(*iter).getInventoryIcon(*iter); count++; - MyGUI::ImageBox* image = containerWidget->createWidget("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default); - MyGUI::TextBox* text = containerWidget->createWidget("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label")); + MyGUI::ImageBox* image = mContainerWidget->createWidget("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default); + MyGUI::TextBox* text = mContainerWidget->createWidget("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label")); x += 36; if(count % 20 == 0) @@ -140,7 +141,7 @@ void ContainerWindow::open(MWWorld::Ptr& container) if(iter->getRefData().getCount() > 1) text->setCaption(boost::lexical_cast(iter->getRefData().getCount())); - containerWidgets.push_back(image); + mContainerWidgets.push_back(image); int pos = path.rfind("."); path.erase(pos); @@ -167,3 +168,7 @@ void ContainerWindow::onByeClicked(MyGUI::Widget* _sender) setVisible(false); } +void ContainerWindow::onSelectedItem(MyGUI::ItemBox* _sender, size_t _index) +{ + std::cout << "selected!"; +} \ No newline at end of file diff --git a/apps/openmw/mwgui/container.hpp b/apps/openmw/mwgui/container.hpp index 5bb019233..0e68baf02 100644 --- a/apps/openmw/mwgui/container.hpp +++ b/apps/openmw/mwgui/container.hpp @@ -47,15 +47,15 @@ namespace MWGui protected: MWWorld::Environment& mEnvironment; - std::vector containerWidgets; - MyGUI::WidgetPtr containerWidget; + std::vector mContainerWidgets; + MyGUI::ItemBoxPtr mContainerWidget; MyGUI::ButtonPtr takeButton; MyGUI::ButtonPtr closeButton; void onByeClicked(MyGUI::Widget* _sender); - + void onSelectedItem(MyGUI::ItemBox* _sender, size_t _index); //MWWorld::Ptr& mContainer; }; diff --git a/files/mygui/openmw_container_window_layout.xml b/files/mygui/openmw_container_window_layout.xml index 7fce9e187..31b036468 100644 --- a/files/mygui/openmw_container_window_layout.xml +++ b/files/mygui/openmw_container_window_layout.xml @@ -1,19 +1,19 @@ - + - + - + diff --git a/files/mygui/openmw_inventory_window_layout.xml b/files/mygui/openmw_inventory_window_layout.xml index c69b6d8fe..766cacdb1 100644 --- a/files/mygui/openmw_inventory_window_layout.xml +++ b/files/mygui/openmw_inventory_window_layout.xml @@ -14,7 +14,7 @@ - +