mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 03:39:14 +00:00
89 lines
2.2 KiB
C++
89 lines
2.2 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
|
|
struct ToolTipInfo
|
|
{
|
|
public:
|
|
ToolTipInfo() :
|
|
effects(0)
|
|
{
|
|
};
|
|
|
|
std::string caption;
|
|
std::string text;
|
|
std::string icon;
|
|
|
|
// enchantment (for cloth, armor, weapons)
|
|
std::string enchant;
|
|
|
|
// effects (for potions, ingredients)
|
|
const ESM::EffectList* effects;
|
|
};
|
|
|
|
class ToolTips : public OEngine::GUI::Layout
|
|
{
|
|
public:
|
|
ToolTips(WindowManager* windowManager);
|
|
|
|
void onFrame(float frameDuration);
|
|
|
|
void enterGameMode();
|
|
void enterGuiMode();
|
|
|
|
void setEnabled(bool enabled);
|
|
|
|
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
|
bool getFullHelp() const;
|
|
|
|
void setFocusObject(const MWWorld::Ptr& focus);
|
|
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
|
///< set the screen-space position of the tooltip for focused object
|
|
|
|
static std::string getValueString(const int value, const std::string& prefix);
|
|
///< @return "prefix: value" or "" if value is 0
|
|
|
|
static std::string getMiscString(const std::string& text, const std::string& prefix);
|
|
///< @return "prefix: text" or "" if text is empty
|
|
|
|
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;
|
|
|
|
WindowManager* mWindowManager;
|
|
|
|
MWWorld::Ptr mFocusObject;
|
|
|
|
void findImageExtension(std::string& image);
|
|
|
|
MyGUI::IntSize getToolTipViaPtr (bool image=true);
|
|
///< @return requested tooltip size
|
|
|
|
MyGUI::IntSize createToolTip(const ToolTipInfo& info);
|
|
///< @return requested tooltip size
|
|
|
|
float mFocusToolTipX;
|
|
float mFocusToolTipY;
|
|
|
|
bool mGameMode;
|
|
|
|
bool mEnabled;
|
|
|
|
bool mFullHelp;
|
|
};
|
|
}
|
|
#endif
|