1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

added the item tooltips

This commit is contained in:
scrawl 2012-05-12 13:30:34 +02:00
parent ed6ff0a94a
commit 7723044df0
3 changed files with 12 additions and 5 deletions

View File

@ -80,7 +80,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
{
ItemWidget* item = static_cast<ItemWidget*>(mDragAndDrop->mDraggedWidget);
std::cout << item->mPos << (*mDragAndDrop->mStore.begin()).getTypeName();
if(item->mPtr.getContainerStore() == 0) std::cout << "nocontainer!";
if((*item->getUserData<MWWorld::Ptr>()).getContainerStore() == 0) std::cout << "nocontainer!";
MWWorld::ContainerStore& containerStore = MWWorld::Class::get(mContainer).getContainerStore(mContainer);
containerStore.add(*mDragAndDrop->mStore.begin());
mDragAndDrop->mStore.clear();
@ -135,8 +135,9 @@ void ContainerBase::drawItems()
ItemWidget* image = mContainerWidget->createWidget<ItemWidget>("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default);
MyGUI::TextBox* text = image->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label"));
image->eventMouseButtonClick += MyGUI::newDelegate(this,&ContainerBase::onSelectedItem);
image->setUserString("ToolTipType", "ItemPtr");
image->setUserData(*iter);
image->mPos = index;
image->mPtr = *iter;
x += 36;
if(count % 20 == 0)
{

View File

@ -10,9 +10,8 @@ namespace MWGui
MYGUI_RTTI_DERIVED( ItemWidget )
public:
MWWorld::Ptr mPtr;
int mPos;
};
}
#endif
#endif

View File

@ -61,12 +61,14 @@ void ToolTips::onFrame(float frameDuration)
else if (type == "Text")
{
info.text = text;
tooltipSize = createToolTip(info);
}
else if (type == "CaptionText")
{
std::string caption = focus->getUserString("ToolTipCaption");
info.caption = caption;
info.text = text;
tooltipSize = createToolTip(info);
}
else if (type == "ImageCaptionText")
{
@ -77,8 +79,13 @@ void ToolTips::onFrame(float frameDuration)
info.text = text;
info.caption = caption;
info.icon = image;
tooltipSize = createToolTip(info);
}
else if (type == "ItemPtr")
{
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
tooltipSize = getToolTipViaPtr();
}
tooltipSize = createToolTip(info);
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);