2012-04-14 17:47:44 +02:00
|
|
|
|
|
|
|
#ifndef MWGUI_TOOLTIPS_H
|
|
|
|
#define MWGUI_TOOLTIPS_H
|
|
|
|
|
2015-05-01 02:09:57 +02:00
|
|
|
#include "layout.hpp"
|
2012-04-15 17:10:08 +02:00
|
|
|
#include "../mwworld/ptr.hpp"
|
2012-04-14 17:47:44 +02:00
|
|
|
|
2012-05-24 14:47:57 +02:00
|
|
|
#include "widgets.hpp"
|
|
|
|
|
2014-12-19 11:26:54 +01:00
|
|
|
namespace ESM
|
|
|
|
{
|
2015-03-06 21:36:42 +13:00
|
|
|
struct Class;
|
2014-12-19 11:26:54 +01:00
|
|
|
struct Race;
|
|
|
|
}
|
|
|
|
|
2012-04-14 17:47:44 +02:00
|
|
|
namespace MWGui
|
|
|
|
{
|
2012-04-16 19:14:05 +02:00
|
|
|
// Info about tooltip that is supplied by the MWWorld::Class object
|
|
|
|
struct ToolTipInfo
|
|
|
|
{
|
|
|
|
public:
|
2012-09-09 23:06:24 +02:00
|
|
|
ToolTipInfo()
|
2015-04-25 13:37:42 -05:00
|
|
|
: imageSize(32)
|
2013-04-03 21:14:49 +02:00
|
|
|
, remainingEnchantCharge(-1)
|
2015-04-25 13:37:42 -05:00
|
|
|
, isPotion(false)
|
|
|
|
, wordWrap(true)
|
2012-09-09 23:06:24 +02:00
|
|
|
{}
|
|
|
|
|
2012-04-16 19:14:05 +02:00
|
|
|
std::string caption;
|
|
|
|
std::string text;
|
2012-04-16 22:58:16 +02:00
|
|
|
std::string icon;
|
2013-03-03 12:01:19 +01:00
|
|
|
int imageSize;
|
2012-04-16 19:14:05 +02:00
|
|
|
|
2012-04-18 16:53:56 +02:00
|
|
|
// enchantment (for cloth, armor, weapons)
|
2012-04-30 00:57:41 +02:00
|
|
|
std::string enchant;
|
2013-04-03 21:14:49 +02:00
|
|
|
int remainingEnchantCharge;
|
2012-04-18 16:53:56 +02:00
|
|
|
|
|
|
|
// effects (for potions, ingredients)
|
2012-05-24 14:47:57 +02:00
|
|
|
Widgets::SpellEffectList effects;
|
2012-09-09 23:06:24 +02:00
|
|
|
|
2015-01-31 17:50:19 +01:00
|
|
|
// local map notes
|
|
|
|
std::vector<std::string> notes;
|
|
|
|
|
2012-09-09 23:06:24 +02:00
|
|
|
bool isPotion; // potions do not show target in the tooltip
|
2013-03-03 12:01:19 +01:00
|
|
|
bool wordWrap;
|
2012-04-16 19:14:05 +02:00
|
|
|
};
|
|
|
|
|
2015-05-01 02:09:57 +02:00
|
|
|
class ToolTips : public Layout
|
2012-04-14 17:47:44 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-04-10 14:46:21 -04:00
|
|
|
ToolTips();
|
2012-04-14 17:47:44 +02:00
|
|
|
|
|
|
|
void onFrame(float frameDuration);
|
|
|
|
|
2012-05-13 11:25:35 +02:00
|
|
|
void setEnabled(bool enabled);
|
|
|
|
|
2014-05-16 09:21:08 +02:00
|
|
|
bool toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
2012-04-16 22:58:16 +02:00
|
|
|
bool getFullHelp() const;
|
2012-04-16 15:00:44 +02:00
|
|
|
|
2012-05-28 09:46:05 +02:00
|
|
|
void setDelay(float delay);
|
|
|
|
|
2012-04-15 17:10:08 +02:00
|
|
|
void setFocusObject(const MWWorld::Ptr& focus);
|
2012-05-14 21:37:43 +02:00
|
|
|
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
2012-08-12 18:11:09 +02:00
|
|
|
///< set the screen-space position of the tooltip for focused object
|
2012-04-15 17:10:08 +02:00
|
|
|
|
2012-04-16 22:58:16 +02:00
|
|
|
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);
|
|
|
|
|
2012-05-12 13:46:03 +02:00
|
|
|
static std::string getCountString(const int value);
|
|
|
|
///< @return blank string if count is 1, or else " (value)"
|
|
|
|
|
2014-07-22 20:03:35 +02:00
|
|
|
static std::string getCellRefString(const MWWorld::CellRef& cellref);
|
|
|
|
///< Returns a string containing debug tooltip information about the given cellref.
|
|
|
|
|
2012-05-27 06:39:10 +02:00
|
|
|
// 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);
|
2012-09-23 00:36:20 +02:00
|
|
|
static void createMagicEffectToolTip(MyGUI::Widget* widget, short id);
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2012-04-14 17:47:44 +02:00
|
|
|
private:
|
|
|
|
MyGUI::Widget* mDynamicToolTipBox;
|
|
|
|
|
2012-04-15 17:10:08 +02:00
|
|
|
MWWorld::Ptr mFocusObject;
|
2012-04-15 21:14:14 +02:00
|
|
|
|
2012-05-12 20:28:12 +02:00
|
|
|
MyGUI::IntSize getToolTipViaPtr (bool image=true);
|
2012-04-15 21:14:14 +02:00
|
|
|
///< @return requested tooltip size
|
|
|
|
|
2012-04-18 16:53:56 +02:00
|
|
|
MyGUI::IntSize createToolTip(const ToolTipInfo& info);
|
2012-04-16 00:16:35 +02:00
|
|
|
///< @return requested tooltip size
|
|
|
|
|
2012-05-14 21:37:43 +02:00
|
|
|
float mFocusToolTipX;
|
|
|
|
float mFocusToolTipY;
|
2013-04-10 00:32:05 -04:00
|
|
|
|
2013-07-10 03:25:09 +02:00
|
|
|
/// Adjust position for a tooltip so that it doesn't leave the screen and does not obscure the mouse cursor
|
|
|
|
void position(MyGUI::IntPoint& position, MyGUI::IntSize size, MyGUI::IntSize viewportSize);
|
|
|
|
|
2014-08-24 20:51:41 +02:00
|
|
|
static std::string sSchoolNames[6];
|
|
|
|
|
2012-12-02 14:08:22 +01:00
|
|
|
int mHorizontalScrollIndex;
|
2013-04-10 00:32:05 -04:00
|
|
|
|
2012-05-14 21:37:43 +02:00
|
|
|
|
2012-05-28 09:46:05 +02:00
|
|
|
float mDelay;
|
|
|
|
float mRemainingDelay; // remaining time until tooltip will show
|
|
|
|
|
|
|
|
int mLastMouseX;
|
|
|
|
int mLastMouseY;
|
|
|
|
|
2012-05-13 11:25:35 +02:00
|
|
|
bool mEnabled;
|
|
|
|
|
2012-04-16 15:00:44 +02:00
|
|
|
bool mFullHelp;
|
2012-04-14 17:47:44 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|