mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-04 02:26:46 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			112 lines
		
	
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			112 lines
		
	
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
 | 
						|
#ifndef MWGUI_TOOLTIPS_H
 | 
						|
#define MWGUI_TOOLTIPS_H
 | 
						|
 | 
						|
#include <openengine/gui/layout.hpp>
 | 
						|
#include "../mwworld/ptr.hpp"
 | 
						|
 | 
						|
#include "widgets.hpp"
 | 
						|
 | 
						|
namespace MWGui
 | 
						|
{
 | 
						|
    // Info about tooltip that is supplied by the MWWorld::Class object
 | 
						|
    struct ToolTipInfo
 | 
						|
    {
 | 
						|
    public:
 | 
						|
        ToolTipInfo()
 | 
						|
            : isPotion(false)
 | 
						|
            , imageSize(32)
 | 
						|
            , wordWrap(true)
 | 
						|
            , remainingEnchantCharge(-1)
 | 
						|
        {}
 | 
						|
 | 
						|
        std::string caption;
 | 
						|
        std::string text;
 | 
						|
        std::string icon;
 | 
						|
        int imageSize;
 | 
						|
 | 
						|
        // enchantment (for cloth, armor, weapons)
 | 
						|
        std::string enchant;
 | 
						|
        int remainingEnchantCharge;
 | 
						|
 | 
						|
        // effects (for potions, ingredients)
 | 
						|
        Widgets::SpellEffectList effects;
 | 
						|
 | 
						|
        bool isPotion; // potions do not show target in the tooltip
 | 
						|
        bool wordWrap;
 | 
						|
    };
 | 
						|
 | 
						|
    class ToolTips : public OEngine::GUI::Layout
 | 
						|
    {
 | 
						|
    public:
 | 
						|
        ToolTips();
 | 
						|
 | 
						|
        void onFrame(float frameDuration);
 | 
						|
 | 
						|
        void setEnabled(bool enabled);
 | 
						|
 | 
						|
        bool toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
 | 
						|
        bool getFullHelp() const;
 | 
						|
 | 
						|
        void setDelay(float delay);
 | 
						|
 | 
						|
        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);
 | 
						|
        static void createMagicEffectToolTip(MyGUI::Widget* widget, short id);
 | 
						|
 | 
						|
    private:
 | 
						|
        MyGUI::Widget* mDynamicToolTipBox;
 | 
						|
 | 
						|
        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;
 | 
						|
 | 
						|
        /// 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);
 | 
						|
 | 
						|
	int mHorizontalScrollIndex;
 | 
						|
 | 
						|
 | 
						|
        float mDelay;
 | 
						|
        float mRemainingDelay; // remaining time until tooltip will show
 | 
						|
 | 
						|
        int mLastMouseX;
 | 
						|
        int mLastMouseY;
 | 
						|
 | 
						|
        bool mEnabled;
 | 
						|
 | 
						|
        bool mFullHelp;
 | 
						|
    };
 | 
						|
}
 | 
						|
#endif
 |