1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00
OpenMW/apps/openmw/mwgui/tooltips.hpp

71 lines
1.8 KiB
C++

#ifndef MWGUI_TOOLTIPS_H
#define MWGUI_TOOLTIPS_H
#include <openengine/gui/layout.hpp>
#include "../mwworld/ptr.hpp"
namespace MWGui
{
class WindowManager;
// Info about tooltip that is supplied by the MWWorld::Class object
// Not used yet, but it will replace the if-else-if blocks in tooltips.cpp
struct ToolTipInfo
{
public:
std::string caption;
std::string text;
std::string image;
/// \todo enchantments (armor, cloth, weapons), magic effects (potions, ingredients)
};
class ToolTips : public OEngine::GUI::Layout
{
public:
ToolTips(WindowManager* windowManager);
void onFrame(float frameDuration);
void enterGameMode();
void enterGuiMode();
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
void setFocusObject(const MWWorld::Ptr& focus);
private:
MyGUI::Widget* mDynamicToolTipBox;
WindowManager* mWindowManager;
MWWorld::Ptr mFocusObject;
void findImageExtension(std::string& image);
MyGUI::IntSize getToolTipViaPtr ();
///< @return requested tooltip size
MyGUI::IntSize createImageToolTip(const std::string& caption, const std::string& image, const int imageSize, const std::string& text);
///< @return requested tooltip size
MyGUI::IntSize createToolTip(const std::string& caption, const std::string& text);
///< @return requested tooltip size
MyGUI::IntSize createToolTip(const std::string& text);
///< @return requested tooltip size
std::string getValueString(const int value);
///< get "Value: X" string or "" if value is 0
std::string toString(const float value);
std::string toString(const int value);
bool mGameMode;
bool mFullHelp;
};
}
#endif