CBuiltInScroll



This class is an implementation of the Built-in Scroll control. You may check ScrollBar control source code in the Standard package to see how it may be used in your controls.

"Active" state of control or its part is the state when user has down mouse button ower it but hasn't release it yet.

You can find more information in comments below. Overrided methods can be found in corresponding base class or interface.

class CBuiltInScroll :public virtual IBuiltInScroll, public CBuiltInControl
{
public:
    enum ELEMENT // Describes scroll elements
    {
        elStartArrow, // Start or decreasing arrow
        elScroller, // A part which could be used to drag and change position
        elEndArrow, // End or increasing arrow
        elNone // None
    };

    enum STATE // Describes possible states
    {
        stNormal, // Normal
        stHovered, // Control is hovered
        stActive, // Controls is active(user down mouse button over its active element and didn't release it yet)
        stDisabled // Control is disabled
    };

    enum ELEMENT_STATE // States of elements
    {
        estNormalNormal, // Control is in normal state and element is in normal state as well
        estHoveredNormal, // Control is hovered, element is in normal state
        estHoveredHovered, // Control is hovered and element is hovered as well
        estActiveNormal, // Control is active, element is hovered
        estActiveActive, // Control is active and element is active as well
        estDisabledDisabled // Both control and element are disabled
    };
public:
    IBuiltInControlListener *getListener() override;
    bool isHovered() override;
    RectF getRenderRect() override;
    // Since 5.0.0
    bool isDown() override;

    void setListener(IBuiltInControlListener *value) override;
    bool setEnabled(const bool value) override;
    // Since 4.0.0
    bool setDPI(const Point &value) override;

    void UpdateFromStyle(IStyle *style, const String &class_name) override;
    void Render(const bool last_pass, const Matrix &matrix, const BLOCK *block) override;
    void Update() override;
    void FreeResources() override;

    // State change notifications
    void NotifyOnAttach() override;
    void NotifyOnDeactivate() override;

    // Mouse input notifications
    bool NotifyOnMouseHover(const PointF &position) override;
    bool NotifyOnMouseLeave() override;
    bool NotifyOnMouseMove(const PointF &position, const bool left, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseLeftDown(const PointF &position, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseLeftUp(const PointF &position, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseLeftDoubleClick(const PointF &position, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseMiddleDown(const PointF &position, const bool left, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseMiddleUp(const PointF &position, const bool left, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseMiddleDoubleClick(const PointF &position, const bool left, const bool right, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseRightDown(const PointF &position, const bool left, const bool middle, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseRightUp(const PointF &position, const bool left, const bool middle, const bool ctrl, const bool alt, const bool shift) override;
    bool NotifyOnMouseRightDoubleClick(const PointF &position, const bool left, const bool middle, const bool ctrl, const bool alt, const bool shift) override;
    void NotifyOnMouseDownCancel() override;
    bool NotifyOnMouseVerticalWheel(const PointF &position, const bool left, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift, const int delta) override;
    bool NotifyOnMouseHorizontalWheel(const PointF &position, const bool left, const bool middle, const bool right, const bool ctrl, const bool alt, const bool shift, const int delta) override;

    // Keyboard input notifications
    bool NotifyOnKeyDown(const KEY key, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;
    bool NotifyOnKeyUp(const KEY key, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;
    bool NotifyOnChar(const wchar_t chr, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;
    bool NotifyOnDeadChar(const wchar_t chr, const bool ctrl, const bool alt, const bool shift, const bool numlock) override;

    // Other input notifications
    bool NotifyOnDropFiles(const PointF &position, const std::vector<String> &filenames) override;

    // Clipboard notifications(since 9.0.0)
    bool NotifyOnPasteString(const String &text) override;

    float getMin() override;
    float getMax() override;
    float getScroll() override;
    float getScrollerSize() override;
    float getDeltaSmall() override;
    float getDeltaMedium() override;
    float getDeltaLarge() override;
    bool isVertical() override;
    // Since 5.0.0
    bool isArrowsVisible() override;

    bool setMin(const float value) override;
    bool setMax(const float value) override;
    bool setScroll(const float value) override;
    bool setScrollerSize(const float value) override;
    bool setDeltaSmall(const float value) override;
    bool setDeltaMedium(const float value) override;
    bool setDeltaLarge(const float value) override;
    bool setVertical(const bool value) override;
    // Since 5.0.0
    bool setArrowsVisible(const bool value) override;

    CBuiltInScroll(); // Constructor

    virtual STATE getState(); // Return current control state
    ELEMENT getHoveredElement() const; // Return hovered element
    ELEMENT getActiveElement() const; // Return active element
    float getScrollInterval() const; // Return scroll timer interval in seconds. Scroll happens when user click on scrolling arrows and hold mouse button
    float getArrowSize() const; // Return relative size of the arrows
    // Background
    float getBorderWidth() const; // Return border width
    float getBorderRadius() const; // Return corners radius
    Color getBorderColor(const STATE state) const; // Return border colour depending on state
    Color getBackgroundColor(const STATE state) const; // Return background colour depending on state
    Gradient *getBackgroundGradient(const STATE state); // Return background gradient depending on state
    // Shadow
    int getShadowRadius(const STATE state) const; // Return shadow blur radius depending on state
    PointF getShadowShift(const STATE state) const; // Return shadow shift depending on state
    Color getShadowColor(const STATE state) const; // Return shadow colour depending on state
    // Start arrow
    float getStartArrowBorderWidth() const; // Return start arrow border width
    float getStartArrowBorderRadius() const; // Return start arrow corners radius
    Color getStartArrowBorderColor(const ELEMENT_STATE state) const; // Return start arrow border colour depending on state
    Color getStartArrowBackgroundColor(const ELEMENT_STATE state) const; // Return start arrow background colour depending on state
    Gradient *getStartArrowBackgroundGradient(const ELEMENT_STATE state); // Return start arrow background gradient depending on state
    Color getStartArrowColor1(const ELEMENT_STATE state) const; // Return start arrow triangle 1st corner colour depending on state
    Color getStartArrowColor2(const ELEMENT_STATE state) const; // Return start arrow triangle 2nd corner colour depending on state
    Color getStartArrowColor3(const ELEMENT_STATE state) const; // Return start arrow triangle 3rd corner colour depending on state
    // End arrow
    float getEndArrowBorderWidth() const; // Return end arrow border width
    float getEndArrowBorderRadius() const; // Return end arrow corners radius
    Color getEndArrowBorderColor(const ELEMENT_STATE state) const; // Return end arrow border colour depending on state
    Color getEndArrowBackgroundColor(const ELEMENT_STATE state) const; // Return end arrow background colour depending on state
    Gradient *getEndArrowBackgroundGradient(const ELEMENT_STATE state); // Return end arrow background gradient depending on state
    Color getEndArrowColor1(const ELEMENT_STATE state) const; // Return end arrow triangle 1st corner colour depending on state
    Color getEndArrowColor2(const ELEMENT_STATE state) const; // Return end arrow triangle 2nd corner colour depending on state
    Color getEndArrowColor3(const ELEMENT_STATE state) const; // Return end arrow triangle 3rd corner colour depending on state
    // Scroller
    float getScrollerBorderWidth() const; // Return scroller border width
    float getScrollerBorderRadius() const; // Return scroller corners radius
    Color getScrollerBorderColor(const ELEMENT_STATE state) const; // Return scroller border colour depending on state
    Color getScrollerBackgroundColor(const ELEMENT_STATE state) const; // Return scroller background colour depending on state
    Gradient *getScrollerBackgroundGradient(const ELEMENT_STATE state); // Return scroller background gradient depending on state
    Color getScrollerLinesBorderColor(const ELEMENT_STATE state) const; // Return scroller lines border colour depending on state
    Color getScrollerLinesBackgroundColor(const ELEMENT_STATE state) const; // Return scroller lines background colour depending on state
    PointF getScrollerLinesSize() const; // Return scroller lines size
    float getScrollerLinesDistance() const; // Return distance between scroller lines
    float getScrollerLinesBorderWidth() const; // Return border width of scroller lines

    bool setScrollInterval(const float value); // Set scroll interval(in seconds)
    bool setArrowSize(const float value); // Set arrow size
    // Background
    bool setBorderWidth(const float value); // Set borders width
    bool setBorderRadius(const float value); // Set corners radius
    bool setBorderColor(const STATE state, const Color &value); // Set borders colour depending on state
    bool setBackgroundColor(const STATE state, const Color &value); // Set background colour depending on state
    // Shadow
    bool setShadowRadius(const STATE state, const int value); // Set shadow blur radius depending on state
    bool setShadowShift(const STATE state, const PointF &value); // Set shadow shift depending on state
    bool setShadowColor(const STATE state, const Color &value); // Set shadow color depending on state
    // Start arrow
    bool setStartArrowBorderWidth(const float value); // Set start arrow borders width
    bool setStartArrowBorderRadius(const float value); // Set start arrow corners radius
    bool setStartArrowBorderColor(const ELEMENT_STATE state, const Color &value); // Set start arrow borders color depending on state
    bool setStartArrowBackgroundColor(const ELEMENT_STATE state, const Color &value); // Set start arrow background color depending on state
    bool setStartArrowColor1(const ELEMENT_STATE state, const Color &value); // Set start arrow triangle 1st corner color depending on state
    bool setStartArrowColor2(const ELEMENT_STATE state, const Color &value); // Set start arrow triangle 2nd corner color depending on state
    bool setStartArrowColor3(const ELEMENT_STATE state, const Color &value); // Set start arrow triangle 3rd corner color depending on state
    // End arrow
    bool setEndArrowBorderWidth(const float value); // Set end arrow borders width
    bool setEndArrowBorderRadius(const float value); // Set end arrow corners radius
    bool setEndArrowBorderColor(const ELEMENT_STATE state, const Color &value); // Set end arrow borders color depending on state
    bool setEndArrowBackgroundColor(const ELEMENT_STATE state, const Color &value); // Set end arrow background color depending on state
    bool setEndArrowColor1(const ELEMENT_STATE state, const Color &value); // Set end arrow triangle 1st corner color depending on state
    bool setEndArrowColor2(const ELEMENT_STATE state, const Color &value); // Set end arrow triangle 2nd corner color depending on state
    bool setEndArrowColor3(const ELEMENT_STATE state, const Color &value); // Set end arrow triangle 3rd corner color depending on state
    // Scroller
    bool setScrollerBorderWidth(const float value); // Set scroller borders width
    bool setScrollerBorderRadius(const float value); // Set scroller corners radius
    bool setScrollerBorderColor(const ELEMENT_STATE state, const Color &value); // Set scroller borders color
    bool setScrollerBackgroundColor(const ELEMENT_STATE state, const Color &value); // Set scroller background color
    bool setScrollerLinesBorderColor(const ELEMENT_STATE state, const Color &value); // Set scroller lines borders color
    bool setScrollerLinesBackgroundColor(const ELEMENT_STATE state, const Color &value); // Set scroller lines background color
    bool setScrollerLinesSize(const PointF &value); // Set scroller lines size
    bool setScrollerLinesDistance(const float value); // Set distance between scroller lines
    bool setScrollerLinesBorderWidth(const float value); // Set borders width of scroller lines

    void SwitchDirection(const bool size); // Vertical become horisontal and wise versa
};
Namespace: nitisa
Include: Nitisa/BuiltInControls/Scroll/BuiltInScroll.h