CButton



Implements Button control.

You can find more information in comments below. Overrided methods can be found in corresponding base classes and interfaces.

class CButton :public virtual IButton, public CControl
{
public:
    enum STATE // Possible states 
    {
        stNormal, // Normal 
        stHovered, // Hovered 
        stFocused, // Focused 
        stFocusedHovered, // Focused and hovered 
        stActive, // Active(mouse was down but not released) 
        stActiveHovered, // Active and hovered 
        stDisabled // Disabled 
    };
public:
    void(*OnClick)(IControl *sender); // Event called when click on the button(or Enter) 

    RectF getClientRect() override;
    RectF getRenderRect() override;
    String getCaption() override;

    bool setDPI(const Point &value) override;
    bool setCaption(const String &value) override;

    // IControl methods 
    void Refresh(const bool refresh_children) override;

    CButton();
    CButton(IControl *parent);
    CButton(IForm *parent);

    STATE getState(); // Return state 
    // Return layout properties depending on state 
    RectF getOuterBorderWidth(const STATE state) const;
    RectF getInnerBorderWidth(const STATE state) const;
    RectF getBorderRadius(const STATE state) const;
    RectC getOuterBorderColor(const STATE state) const;
    Color getLeftOuterBorderColor(const STATE state) const;
    Color getTopOuterBorderColor(const STATE state) const;
    Color getRightOuterBorderColor(const STATE state) const;
    Color getBottomOuterBorderColor(const STATE state) const;
    RectC getInnerBorderColor(const STATE state) const;
    Color getLeftInnerBorderColor(const STATE state) const;
    Color getTopInnerBorderColor(const STATE state) const;
    Color getRightInnerBorderColor(const STATE state) const;
    Color getBottomInnerBorderColor(const STATE state) const;
    Color getBackgroundColor(const STATE state) const;
    Gradient *getBackgroundGradient(const STATE state);
    Color getShadowColor(const STATE state) const;
    PointF getShadowShift(const STATE state) const;
    int getShadowRadius(const STATE state) const;
    RectF getPadding(const STATE state) const;
    TEXT_ALIGN getContentHorizontalAlign(const STATE state) const;
    VERTICAL_ALIGN getContentVerticalAlign(const STATE state) const;
    Color getCaptionColor(const STATE state) const;
    Color getCaptionShadowColor(const STATE state) const;
    PointF getCaptionShadowShift(const STATE state) const;
    int getCaptionShadowRadius(const STATE state) const;
    IImageList *getImageList(const STATE state) const; // Return associated image list 
    int getIconIndex(const STATE state) const; // Return icon index from image list to be displayed or -1 
    float getIconPadding(const STATE state) const;
    bool isIconOnRight(const STATE state) const;

    // Set layout properties depending on state 
    bool setOuterBorderWidth(const STATE state, const RectF &value);
    bool setInnerBorderWidth(const STATE state, const RectF &value);
    bool setBorderRadius(const STATE state, const RectF &value);
    bool setOuterBorderColor(const STATE state, const RectC &value);
    bool setLeftOuterBorderColor(const STATE state, const Color &value);
    bool setTopOuterBorderColor(const STATE state, const Color &value);
    bool setRightOuterBorderColor(const STATE state, const Color &value);
    bool setBottomOuterBorderColor(const STATE state, const Color &value);
    bool setInnerBorderColor(const STATE state, const RectC &value);
    bool setLeftInnerBorderColor(const STATE state, const Color &value);
    bool setTopInnerBorderColor(const STATE state, const Color &value);
    bool setRightInnerBorderColor(const STATE state, const Color &value);
    bool setBottomInnerBorderColor(const STATE state, const Color &value);
    bool setBackgroundColor(const STATE state, const Color &value);
    bool setShadowColor(const STATE state, const Color &value);
    bool setShadowShift(const STATE state, const PointF &value);
    bool setShadowRadius(const STATE state, const int value);
    bool setPadding(const STATE state, const RectF &value);
    bool setContentHorizontalAlign(const STATE state, const TEXT_ALIGN value);
    bool setContentVerticalAlign(const STATE state, const VERTICAL_ALIGN value);
    bool setCaptionColor(const STATE state, const Color &value);
    bool setCaptionShadowColor(const STATE state, const Color &value);
    bool setCaptionShadowShift(const STATE state, const PointF &value);
    bool setCaptionShadowRadius(const STATE state, const int value);
    bool setImageList(const STATE state, IImageList *value);
    bool setIconIndex(const STATE state, const int value);
    bool setIconPadding(const STATE state, const float value);
    bool setIconOnRight(const STATE state, const bool value);
    // Set layout properties same for all states 
    bool setOuterBorderWidth(const RectF &value);
    bool setInnerBorderWidth(const RectF &value);
    bool setBorderRadius(const RectF &value);
    bool setOuterBorderColor(const RectC &value);
    bool setInnerBorderColor(const RectC &value);
    bool setBackgroundColor(const Color &value);
    bool setShadowColor(const Color &value);
    bool setShadowShift(const PointF &value);
    bool setShadowRadius(const int value);
    bool setPadding(const RectF &value);
    bool setContentHorizontalAlign(const TEXT_ALIGN value);
    bool setContentVerticalAlign(const VERTICAL_ALIGN value);
    bool setCaptionColor(const Color &value);
    bool setCaptionShadowColor(const Color &value);
    bool setCaptionShadowShift(const PointF &value);
    bool setCaptionShadowRadius(const int value);
    bool setImageList(IImageList *value);
    bool setIconIndex(const int value);
    bool setIconPadding(const float value);
    bool setIconOnRight(const bool value);

    void Click() override;
};
Namespace: nitisa::standard
Include: Standard/Controls/Button/Button.h