⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ceguifaldimensions.h

📁 OGRE开发包的依赖包
💻 H
📖 第 1 页 / 共 2 页
字号:
        */
        void setSourceDimension(DimensionType dim);

    protected:
        // Implementation of the base class interface
        float getValue_impl(const Window& wnd) const;
        float getValue_impl(const Window& wnd, const Rect& container) const;
        void writeXMLElementName_impl(XMLSerializer& xml_stream) const;
        void writeXMLElementAttributes_impl(XMLSerializer& xml_stream) const;
        BaseDim* clone_impl() const;

    private:
        String d_widgetName;    //!< Holds target window name suffix.
        DimensionType d_what;   //!< the dimension of the target window that we are to represent.
    };


    /*!
    \brief
        Dimension type that represents an Unified dimension.  Implements BaseDim interface.
    */
    class CEGUIEXPORT UnifiedDim : public BaseDim
    {
    public:
        /*!
        \brief
            Constructor.

        \param value
            UDim holding the value to assign to this UnifiedDim.

        \param dim
            DimensionType value indicating what this UnifiedDim is to represent.  This is required
            because we need to know what part of the base Window that the UDim scale component is
            to operate against.
        */
        UnifiedDim(const UDim& value, DimensionType dim);

    protected:
        // Implementation of the base class interface
        float getValue_impl(const Window& wnd) const;
        float getValue_impl(const Window& wnd, const Rect& container) const;
        void writeXMLElementName_impl(XMLSerializer& xml_stream) const;
        void writeXMLElementAttributes_impl(XMLSerializer& xml_stream) const;
        BaseDim* clone_impl() const;

    private:
        UDim d_value;           //!< The UDim value.
        DimensionType d_what;   //!< what we represent.
    };

    /*!
    \brief
        Dimension type that represents some metric of a Font.  Implements BaseDim interface.
    */
    class CEGUIEXPORT FontDim : public BaseDim
    {
    public:
        /*!
        \brief
            Constructor.

        \param name
            String holding the name suffix of the window to be accessed to obtain the font
            and / or text strings to be used when these items are not explicitly given.

        \param font
            String holding the name of the font to use for this dimension.  If the string is
            empty, the font assigned to the window passed to getValue will be used.

        \param text
            String holding the text to be measured for horizontal extent.  If this is empty,
            the text from the window passed to getValue will be used.

        \param metric
            One of the FontMetricType values indicating what we should represent.

        \param padding
            constant pixel padding value to be added.
        */
        FontDim(const String& name, const String& font, const String& text, FontMetricType metric, float padding = 0);

    protected:
        // Implementation of the base class interface
        float getValue_impl(const Window& wnd) const;
        float getValue_impl(const Window& wnd, const Rect& container) const;
        void writeXMLElementName_impl(XMLSerializer& xml_stream) const;
        void writeXMLElementAttributes_impl(XMLSerializer& xml_stream) const;
        BaseDim* clone_impl() const;

    private:
        String  d_font;          //!< Name of Font.  If empty font will be taken from Window.
        String  d_text;          //!< String to measure for extents, if empty will use window text.
        String  d_childSuffix;   //!< String to hold the name suffix of the window to use for fetching missing font and/or text.
        FontMetricType d_metric; //!< what metric we represent.
        float   d_padding;       //!< padding value to be added.
    };

    /*!
    \brief
        Dimension type that represents the value of a Window property.  Implements BaseDim interface.
    */
    class CEGUIEXPORT PropertyDim : public BaseDim
    {
    public:
        /*!
        \brief
            Constructor.

        \param name
            String holding the name suffix of the window on which the property is to be accessed.

        \param property
            String object holding the name of the property this PropertyDim represents the value of.
            The property named should represent a simple float value.

        \param type
            DimensionType value indicating what dimension named property represents.
        */
        PropertyDim(const String& name, const String& property, DimensionType type);

    protected:
        // Implementation of the base class interface
        float getValue_impl(const Window& wnd) const;
        float getValue_impl(const Window& wnd, const Rect& container) const;
        void writeXMLElementName_impl(XMLSerializer& xml_stream) const;
        void writeXMLElementAttributes_impl(XMLSerializer& xml_stream) const;
        BaseDim* clone_impl() const;

    private:
        String d_property;      //!< Propery that this object represents.
        String d_childSuffix;   //!< String to hold the name suffix of the child to access the property form.
        DimensionType d_type;   //!< String to hold the type of dimension
    };

    /*!
    \brief
        Class representing some kind of dimension.

        The key thing to understand about Dimension is that it contains not just a dimensional value,
        but also a record of what the dimension value is supposed to represent. (e.g. a co-ordinate on
        the x axis, or the height of something).
    */
    class CEGUIEXPORT Dimension
    {
    public:
        /*!
        \brief
            Constructor
        */
        Dimension();

        /*!
        \brief
            Destructor
        */
        ~Dimension();

        /*!
        \brief
            Constructor

        \param dim
            object based on subclass of BaseDim which holds the dimensional value.

        \param type
            DimensionType value indicating what dimension this object is to represent.
        */
        Dimension(const BaseDim& dim, DimensionType type);

        /*!
        \brief
            Copy constructor
        */
        Dimension(const Dimension& other);

        /*!
        \brief
            Assignment operator
        */
        Dimension& operator=(const Dimension& other);

        /*!
        \brief
            return the BaseDim object currently used as the value for this Dimension.

        \return
            const reference to the BaseDim sub-class object which contains the value for this Dimension.
        */
        const BaseDim& getBaseDimension() const;

        /*!
        \brief
            set the current value for this Dimension.

        \param dim
            object based on a subclass of BaseDim which holds the dimensional value.

        \return
            Nothing.
        */
        void setBaseDimension(const BaseDim& dim);

        /*!
        \brief
            Return a DimensionType value indicating what this Dimension represents.

        \return
            one of the DimensionType enumerated values.
        */
        DimensionType getDimensionType() const;

        /*!
        \brief
            Sets what this Dimension represents.

        \param type
            one of the DimensionType enumerated values.

        \return
            Nothing.
        */
        void setDimensionType(DimensionType type);

        /*!
        \brief
            Writes an xml representation of this Dimension to \a out_stream.

        \param xml_stream
            Stream where xml data should be output.
        
        \return
            Nothing.
        */
        void writeXMLToStream(XMLSerializer& xml_stream) const;

    private:
        BaseDim*        d_value;    //!< Pointer to the value for this Dimension.
        DimensionType   d_type;     //!< What we represent.
    };


    /*!
    \brief
        Class that represents a target area for a widget or imagery component.

        This is essentially a Rect built out of Dimension objects.  Of note is that
        what would normally be the 'right' and 'bottom' edges may alternatively
        represent width and height depending upon what the assigned Dimension(s)
        represent.
    */
    class CEGUIEXPORT ComponentArea
    {
    public:
        /*!
        \brief
            Return a Rect describing the absolute pixel area represented by this ComponentArea.

        \param wnd
            Window object to be used when calculating final pixel area.

        \return
            Rect object describing the pixels area represented by this ComponentArea when using \a wnd
            as a reference for calculating the final pixel dimensions.
        */
        Rect getPixelRect(const Window& wnd) const;

        /*!
        \brief
            Return a Rect describing the absolute pixel area represented by this ComponentArea.

        \param wnd
            Window object to be used when calculating final pixel area.

        \param container
            Rect object to be used as a base or container when converting relative dimensions.

        \return
            Rect object describing the pixels area represented by this ComponentArea when using \a wnd
            and \a container as a reference for calculating the final pixel dimensions.
        */
        Rect getPixelRect(const Window& wnd, const Rect& container) const;

        /*!
        \brief
            Writes an xml representation of this ComponentArea to \a out_stream.

        \param xml_stream
            Stream where xml data should be output.


        \return
            Nothing.
        */
        void writeXMLToStream(XMLSerializer& xml_stream) const;

        /*!
        \brief
            Return whether this ComponentArea fetches it's area via a property on the target window.

        \return
            - true if the area comes via a Propery.
            - false if the area is defined explicitly via the Dimension fields.
        */
        bool isAreaFetchedFromProperty() const;

        /*!
        \brief
            Return the name of the property that will be used to determine the pixel area for this ComponentArea.

        \return
            String object holding the name of a Propery.
        */
        const String& getAreaPropertySource() const;

        /*!
        \brief
            Set the name of the property that will be used to determine the pixel area for this ComponentArea.

        \param property
            String object holding the name of a Propery.  The property should access a URect type property.

        \return
            Nothing.
        */
        void setAreaPropertySource(const String& property);


        Dimension d_left;   //!< Left edge of the area.
        Dimension d_top;    //!< Top edge of the area.
        Dimension d_right_or_width;     //!< Either the right edge or the width of the area.
        Dimension d_bottom_or_height;   //!< Either the bototm edge or the height of the area.

    private:
        String  d_areaProperty;         //!< Property to access.  Must be a URect style property.
    };

} // End of  CEGUI namespace section


#endif  // end of guard _CEGUIFalDimensions_h_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -