#ifndef ToolTip_H #define ToolTip_H #include #include "Array.h" #include "Drawing.h" namespace Framework { class Font; //! Font.h class Image; //! Image.h class AlphaField; //! AlphaField.h class Text; //! Text.h class Border; //! Border.h struct MouseEvent; //! MouseEvent.h class Screen; //! Screen.h #ifdef WIN32 # pragma vtordisp(push, 2) #endif class ToolTip : public DrawableBackground { private: RCArray* members; Punkt size; double animationSpeed; double warten; double wartenCount; double tval; bool mausIn; unsigned char alpha; bool sichtbar; bool zeichnen; bool mausIn2; Screen* bildschirm; std::function onShow; std::function onHide; //! Processes mouse messages //! \param me The event triggered by the mouse input DLLEXPORT void doMouseEvent(MouseEvent& me, bool userRet) override; public: //! Constructor DLLEXPORT ToolTip(Screen* zSceen); //! Destructor DLLEXPORT ~ToolTip(); //! Adds a drawing to the tooltip //! \param m The new drawing DLLEXPORT void addMember(Drawable* m); //! Removes a drawing from the tooltip //! \param m The drawing DLLEXPORT void removeMember(Drawable* zM); //! Removes a drawing from the tooltip //! \param i The index of the drawing DLLEXPORT void removeMember(int i); //! Sets a function that is called when the tooltip is shown //! \param onShow The function DLLEXPORT void setShowEvent(std::function onShow); //! Sets a function that is called when the tooltip is no longer shown //! \param onShow The function DLLEXPORT void setHideEvent(std::function onHide); //! Sets the number of seconds to wait before the tip appears //! \param warten The number of seconds DLLEXPORT void setWarten(double warten); //! Sets how fast the tip appears //! \param speed Number of pixels faded in per second. (Default: 250) DLLEXPORT void setAnimationSpeed(double speed); //! Sets whether the mouse is inside the drawing the tip belongs to //! \param mausIn 1 if the mouse is inside the drawing. 0 otherwise DLLEXPORT void setMausIn(bool mausIn); //! Resets the counter that tracks when the tip should appear DLLEXPORT void wartenReset(); //! Indicates that the drawing the tip belongs to was drawn, //! so the tip could also be drawn DLLEXPORT void setZeichnen(); //! Updates the tip. Called by the framework //! \param tickVal The time in seconds since the last call //! of this function \return 1 if something changed //! and the image needs to be redrawn. 0 otherwise DLLEXPORT bool tick(double tickVal) override; //! Draws the tip to zRObj if it is visible and the associated //! drawing was also drawn \param zRObj The image to draw into DLLEXPORT void render(Image& zRObj) override; //! Returns a pointer to the screen without increased reference counter //! that this tooltip belongs to DLLEXPORT Screen* zScreen() const; //! Returns a specific member (without increased reference counter) //! \param i The index of the member DLLEXPORT Drawable* zMember(int i) const; //! Returns a specific member //! \param i The index of the member DLLEXPORT Drawable* getMember(int i) const; //! Returns the number of drawings belonging to the tooltip DLLEXPORT int getMemberAnzahl() const; //! Creates a complete copy of a tooltip DLLEXPORT Drawable* dublizieren() const override; //! Checks whether the tooltip is currently visible DLLEXPORT bool isVisible() const; }; #ifdef WIN32 # pragma vtordisp(pop) #endif } // namespace Framework #endif