mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:56:39 +00:00 
			
		
		
		
	display the item count in the tooltip
This commit is contained in:
		
							parent
							
								
									7723044df0
								
							
						
					
					
						commit
						d64fccec6f
					
				
					 17 changed files with 31 additions and 20 deletions
				
			
		|  | @ -79,7 +79,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Activator>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
| 
 | ||||
|         std::string text; | ||||
|         if (MWBase::Environment::get().getWindowManager()->getFullHelp()) | ||||
|  |  | |||
|  | @ -122,7 +122,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Apparatus>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -220,7 +220,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Armor>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         std::string text; | ||||
|  |  | |||
|  | @ -119,7 +119,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Book>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -188,7 +188,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Clothing>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -120,7 +120,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Ingredient>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -163,7 +163,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Light>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -132,7 +132,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Tool>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -138,7 +138,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Miscellaneous>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -122,7 +122,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Potion>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -131,7 +131,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Probe>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -121,7 +121,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Repair>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         std::string text; | ||||
|  |  | |||
|  | @ -272,7 +272,7 @@ namespace MWClass | |||
|             ptr.get<ESM::Weapon>(); | ||||
| 
 | ||||
|         MWGui::ToolTipInfo info; | ||||
|         info.caption = ref->base->name; | ||||
|         info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); | ||||
|         info.icon = ref->base->icon; | ||||
| 
 | ||||
|         const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  |  | |||
|  | @ -34,7 +34,6 @@ ContainerBase::ContainerBase(WindowManager& parWindowManager,DragAndDrop* dragAn | |||
|     getWidget(mItemView, "ItemView"); | ||||
| 
 | ||||
|     mContainerWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerBase::onContainerClicked); | ||||
|     static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &ContainerBase::onWindowResize); | ||||
| } | ||||
| 
 | ||||
| ContainerBase::~ContainerBase() | ||||
|  | @ -93,10 +92,6 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void ContainerBase::onWindowResize(MyGUI::Window* window) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ContainerBase::setName(std::string contName) | ||||
| { | ||||
|     setText("_Main", contName); | ||||
|  | @ -190,12 +185,18 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dr | |||
|     int w = MyGUI::RenderManager::getInstance().getViewSize().width; | ||||
|     int h = MyGUI::RenderManager::getInstance().getViewSize().height; | ||||
|     setCoord(w-600,h-300,600,300); | ||||
| 
 | ||||
|     static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &ContainerWindow::onWindowResize); | ||||
| } | ||||
| 
 | ||||
| ContainerWindow::~ContainerWindow() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ContainerWindow::onWindowResize(MyGUI::Window* window) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender) | ||||
| { | ||||
|     if(!mDragAndDrop->mIsOnDragAndDrop) | ||||
|  |  | |||
|  | @ -63,7 +63,6 @@ namespace MWGui | |||
| 
 | ||||
|         void onSelectedItem(MyGUI::Widget* _sender); | ||||
|         void onContainerClicked(MyGUI::Widget* _sender); | ||||
|         void onWindowResize(MyGUI::Window* window); | ||||
| 
 | ||||
|         void drawItems(); | ||||
|     }; | ||||
|  | @ -83,7 +82,7 @@ namespace MWGui | |||
| 
 | ||||
|         bool mIsValid;//is in the right GUI Mode
 | ||||
| 
 | ||||
| 
 | ||||
|         void onWindowResize(MyGUI::Window* window); | ||||
|         void onCloseButtonClicked(MyGUI::Widget* _sender); | ||||
|         void onTakeAllButtonClicked(MyGUI::Widget* _sender); | ||||
|     }; | ||||
|  |  | |||
|  | @ -357,6 +357,14 @@ std::string ToolTips::getMiscString(const std::string& text, const std::string& | |||
|         return "\n" + prefix + ": " + text; | ||||
| } | ||||
| 
 | ||||
| std::string ToolTips::getCountString(const int value) | ||||
| { | ||||
|     if (value == 1) | ||||
|         return ""; | ||||
|     else | ||||
|         return " (" + boost::lexical_cast<std::string>(value) + ")"; | ||||
| } | ||||
| 
 | ||||
| void ToolTips::toggleFullHelp() | ||||
| { | ||||
|     mFullHelp = !mFullHelp; | ||||
|  |  | |||
|  | @ -53,6 +53,9 @@ namespace MWGui | |||
|         static std::string toString(const float value); | ||||
|         static std::string toString(const int value); | ||||
| 
 | ||||
|         static std::string getCountString(const int value); | ||||
|         ///< @return blank string if count is 1, or else " (value)"
 | ||||
| 
 | ||||
|     private: | ||||
|         MyGUI::Widget* mDynamicToolTipBox; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue