You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw/mwgui/tooltips.hpp

95 lines
2.9 KiB
C++

13 years ago
#ifndef MWGUI_TOOLTIPS_H
#define MWGUI_TOOLTIPS_H
#include <openengine/gui/layout.hpp>
#include "../mwworld/ptr.hpp"
13 years ago
#include "widgets.hpp"
13 years ago
namespace MWGui
{
13 years ago
class WindowManager;
// Info about tooltip that is supplied by the MWWorld::Class object
struct ToolTipInfo
{
public:
std::string caption;
std::string text;
std::string icon;
// enchantment (for cloth, armor, weapons)
std::string enchant;
// effects (for potions, ingredients)
Widgets::SpellEffectList effects;
};
13 years ago
class ToolTips : public OEngine::GUI::Layout
{
public:
13 years ago
ToolTips(WindowManager* windowManager);
13 years ago
void onFrame(float frameDuration);
void enterGameMode();
void enterGuiMode();
void setEnabled(bool enabled);
13 years ago
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
bool getFullHelp() const;
13 years ago
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)"
// these do not create an actual tooltip, but they fill in the data that is required so the tooltip
// system knows what to show in case this widget is hovered
static void createSkillToolTip(MyGUI::Widget* widget, int skillId);
static void createAttributeToolTip(MyGUI::Widget* widget, int attributeId);
static void createSpecializationToolTip(MyGUI::Widget* widget, const std::string& name, int specId);
static void createBirthsignToolTip(MyGUI::Widget* widget, const std::string& birthsignId);
static void createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace);
static void createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playerClass);
13 years ago
private:
MyGUI::Widget* mDynamicToolTipBox;
13 years ago
WindowManager* mWindowManager;
MWWorld::Ptr mFocusObject;
13 years ago
void findImageExtension(std::string& image);
MyGUI::IntSize getToolTipViaPtr (bool image=true);
13 years ago
///< @return requested tooltip size
MyGUI::IntSize createToolTip(const ToolTipInfo& info);
///< @return requested tooltip size
float mFocusToolTipX;
float mFocusToolTipY;
13 years ago
bool mGameMode;
13 years ago
bool mEnabled;
13 years ago
bool mFullHelp;
13 years ago
};
}
#endif