mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
trying to get selected item. Doesn't work.
This commit is contained in:
parent
d4e9b62436
commit
25432d97d2
4 changed files with 20 additions and 15 deletions
|
@ -35,7 +35,7 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro
|
||||||
//center();
|
//center();
|
||||||
adjustWindowCaption();
|
adjustWindowCaption();
|
||||||
|
|
||||||
getWidget(containerWidget, "Items");
|
getWidget(mContainerWidget, "Items");
|
||||||
getWidget(takeButton, "TakeButton");
|
getWidget(takeButton, "TakeButton");
|
||||||
getWidget(closeButton, "CloseButton");
|
getWidget(closeButton, "CloseButton");
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro
|
||||||
|
|
||||||
setText("CloseButton","Close");
|
setText("CloseButton","Close");
|
||||||
setText("TakeButton","Take All");
|
setText("TakeButton","Take All");
|
||||||
|
mContainerWidget->eventMouseItemActivate += MyGUI::newDelegate(this,&ContainerWindow::onSelectedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Environment& environment,std::string guiFile)
|
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");
|
setText("_Main", "Name of Container");
|
||||||
//center();
|
//center();
|
||||||
adjustWindowCaption();
|
adjustWindowCaption();
|
||||||
|
getWidget(mContainerWidget, "Items");
|
||||||
getWidget(containerWidget, "Items");
|
|
||||||
//getWidget(takeButton, "TakeButton");
|
//getWidget(takeButton, "TakeButton");
|
||||||
//getWidget(closeButton, "CloseButton");
|
//getWidget(closeButton, "CloseButton");
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro
|
||||||
|
|
||||||
//setText("CloseButton","Close");
|
//setText("CloseButton","Close");
|
||||||
//setText("TakeButton","Take All");
|
//setText("TakeButton","Take All");
|
||||||
|
mContainerWidget->eventMouseItemActivate += MyGUI::newDelegate(this,&ContainerWindow::onSelectedItem);
|
||||||
}
|
}
|
||||||
ContainerWindow::~ContainerWindow()
|
ContainerWindow::~ContainerWindow()
|
||||||
{
|
{
|
||||||
|
@ -126,8 +127,8 @@ void ContainerWindow::open(MWWorld::Ptr& container)
|
||||||
path+=MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
path+=MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
MyGUI::ImageBox* image = containerWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default);
|
MyGUI::ImageBox* image = mContainerWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default);
|
||||||
MyGUI::TextBox* text = containerWidget->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label"));
|
MyGUI::TextBox* text = mContainerWidget->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label"));
|
||||||
|
|
||||||
x += 36;
|
x += 36;
|
||||||
if(count % 20 == 0)
|
if(count % 20 == 0)
|
||||||
|
@ -140,7 +141,7 @@ void ContainerWindow::open(MWWorld::Ptr& container)
|
||||||
if(iter->getRefData().getCount() > 1)
|
if(iter->getRefData().getCount() > 1)
|
||||||
text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount()));
|
text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount()));
|
||||||
|
|
||||||
containerWidgets.push_back(image);
|
mContainerWidgets.push_back(image);
|
||||||
|
|
||||||
int pos = path.rfind(".");
|
int pos = path.rfind(".");
|
||||||
path.erase(pos);
|
path.erase(pos);
|
||||||
|
@ -167,3 +168,7 @@ void ContainerWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContainerWindow::onSelectedItem(MyGUI::ItemBox* _sender, size_t _index)
|
||||||
|
{
|
||||||
|
std::cout << "selected!";
|
||||||
|
}
|
|
@ -47,15 +47,15 @@ namespace MWGui
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MWWorld::Environment& mEnvironment;
|
MWWorld::Environment& mEnvironment;
|
||||||
std::vector<MyGUI::WidgetPtr> containerWidgets;
|
std::vector<MyGUI::WidgetPtr> mContainerWidgets;
|
||||||
MyGUI::WidgetPtr containerWidget;
|
MyGUI::ItemBoxPtr mContainerWidget;
|
||||||
|
|
||||||
MyGUI::ButtonPtr takeButton;
|
MyGUI::ButtonPtr takeButton;
|
||||||
MyGUI::ButtonPtr closeButton;
|
MyGUI::ButtonPtr closeButton;
|
||||||
|
|
||||||
|
|
||||||
void onByeClicked(MyGUI::Widget* _sender);
|
void onByeClicked(MyGUI::Widget* _sender);
|
||||||
|
void onSelectedItem(MyGUI::ItemBox* _sender, size_t _index);
|
||||||
|
|
||||||
//MWWorld::Ptr& mContainer;
|
//MWWorld::Ptr& mContainer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 600 300" align="Left Bottom" name="_Main">
|
<Widget type="Window" skin="MW_Window" layer="Windows" position="900 500 600 300" name="_Main">
|
||||||
|
|
||||||
<!-- HEADER -->
|
<!-- HEADER
|
||||||
<Widget type="TextBox" skin="HeaderText" position="0 0 588 18" name="ContainerName" align="ALIGN_LEFT ALIGN_TOP">
|
<Widget type="TextBox" skin="HeaderText" position="0 0 588 18" name="ContainerName" align="ALIGN_LEFT ALIGN_TOP">
|
||||||
<Property key="Caption" value=""/>
|
<Property key="Caption" value="Name"/>
|
||||||
<Property key="TextAlign" value="ALIGN_CENTER"/>
|
<Property key="TextAlign" value="ALIGN_CENTER"/>
|
||||||
</Widget>
|
</Widget>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Items in inventory -->
|
<!-- Items in inventory -->
|
||||||
<Widget type="Widget" skin="MW_Box" position="5 10 570 220" name="Items"/>
|
<Widget type="ItemBox" skin="MW_Box" position="5 10 570 220" name="Items"/>
|
||||||
|
|
||||||
<Widget type="Widget" position="300 235 300 24" align="ALIGN_TOP ALIGN_LEFT" name="Buttons">
|
<Widget type="Widget" position="300 235 300 24" align="ALIGN_TOP ALIGN_LEFT" name="Buttons">
|
||||||
<Widget type="Button" skin="MW_Button" position="100 0 75 24" name="TakeButton"/>
|
<Widget type="Button" skin="MW_Button" position="100 0 75 24" name="TakeButton"/>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<!-- Items in inventory -->
|
<!-- Items in inventory -->
|
||||||
<Widget type="Widget" skin="MW_Box" position="228 32 300 166" name="Items"/>
|
<Widget type="ItemBox" skin="MW_Box" position="228 32 300 166" name="Items"/>
|
||||||
|
|
||||||
<!-- Categories -->
|
<!-- Categories -->
|
||||||
<Widget type="Widget" position="228 8 300 18" align="ALIGN_TOP ALIGN_LEFT" name="Categories">
|
<Widget type="Widget" position="228 8 300 18" align="ALIGN_TOP ALIGN_LEFT" name="Categories">
|
||||||
|
|
Loading…
Reference in a new issue