mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 14:56:38 +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();
 | ||||
|     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<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::ImageBox* image = mContainerWidget->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default); | ||||
|         MyGUI::TextBox* text = mContainerWidget->createWidget<MyGUI::TextBox>("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<std::string>(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!"; | ||||
| } | ||||
|  | @ -47,15 +47,15 @@ namespace MWGui | |||
| 
 | ||||
|         protected: | ||||
|         MWWorld::Environment& mEnvironment; | ||||
|         std::vector<MyGUI::WidgetPtr> containerWidgets; | ||||
|         MyGUI::WidgetPtr containerWidget; | ||||
|         std::vector<MyGUI::WidgetPtr> 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;
 | ||||
|     }; | ||||
|  |  | |||
|  | @ -1,19 +1,19 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| 
 | ||||
| <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"> | ||||
|             <Property key="Caption" value=""/> | ||||
|             <Property key="Caption" value="Name"/> | ||||
|             <Property key="TextAlign" value="ALIGN_CENTER"/> | ||||
|         </Widget> | ||||
|         </Widget>--> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         <!-- 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="Button" skin="MW_Button" position="100 0 75 24" name="TakeButton"/> | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|         </Widget> | ||||
| 
 | ||||
|         <!-- 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 --> | ||||
|         <Widget type="Widget" position="228 8 300 18" align="ALIGN_TOP ALIGN_LEFT" name="Categories"> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue