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 over 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 class ElementType // Describes scroll elements
{
StartArrow, // Start or decreasing arrow
Scroller, // A part which could be used to drag and change position
EndArrow, // End or increasing arrow
None // None
};
enum class State // Describes possible states
{
Normal, // Normal
Hovered, // Control is hovered
Active, // Controls is active(user down mouse button over its active element and didn't release it yet)
Disabled // Control is disabled
};
enum class ElementState // States of elements
{
NormalNormal, // Control is in normal state and element is in normal state as well
HoveredNormal, // Control is hovered, element is in normal state
HoveredHovered, // Control is hovered and element is hovered as well
ActiveNormal, // Control is active, element is hovered
ActiveActive, // Control is active and element is active as well
DisabledDisabled // Both control and element are disabled
};
public:
IBuiltInControlListener *getListener() override;
bool isHovered() override;
RectF getRenderRect() override;
bool isDown() override;
void setListener(IBuiltInControlListener *value) override;
bool setEnabled(const bool value) override;
bool setDPI(const Point &value) override;
void UpdateFromStyle(IStyle *style, const String &class_name) override;
void Render(const bool last_pass, const Mat4f &matrix, const Block *block) override;
void Update() override;
// State change notifications
void NotifyOnAttach() override;
void NotifyOnDeactivate() override;
void NotifyOnFreeResources() 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 StringArray &filenames) override;
// Clipboard notifications
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;
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;
bool setArrowsVisible(const bool value) override;
CBuiltInScroll(); // Constructor
virtual State getState(); // Return current control state
ElementType getHoveredElement() const; // Return hovered element
ElementType 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 ElementState state) const; // Return start arrow border colour depending on state
Color getStartArrowBackgroundColor(const ElementState state) const; // Return start arrow background colour depending on state
Gradient *getStartArrowBackgroundGradient(const ElementState state); // Return start arrow background gradient depending on state
Color getStartArrowColor1(const ElementState state) const; // Return start arrow triangle 1st corner colour depending on state
Color getStartArrowColor2(const ElementState state) const; // Return start arrow triangle 2nd corner colour depending on state
Color getStartArrowColor3(const ElementState 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 ElementState state) const; // Return end arrow border colour depending on state
Color getEndArrowBackgroundColor(const ElementState state) const; // Return end arrow background colour depending on state
Gradient *getEndArrowBackgroundGradient(const ElementState state); // Return end arrow background gradient depending on state
Color getEndArrowColor1(const ElementState state) const; // Return end arrow triangle 1st corner colour depending on state
Color getEndArrowColor2(const ElementState state) const; // Return end arrow triangle 2nd corner colour depending on state
Color getEndArrowColor3(const ElementState 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 ElementState state) const; // Return scroller border colour depending on state
Color getScrollerBackgroundColor(const ElementState state) const; // Return scroller background colour depending on state
Gradient *getScrollerBackgroundGradient(const ElementState state); // Return scroller background gradient depending on state
Color getScrollerLinesBorderColor(const ElementState state) const; // Return scroller lines border colour depending on state
Color getScrollerLinesBackgroundColor(const ElementState 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 ElementState state, const Color &value); // Set start arrow borders color depending on state
bool setStartArrowBackgroundColor(const ElementState state, const Color &value); // Set start arrow background color depending on state
bool setStartArrowColor1(const ElementState state, const Color &value); // Set start arrow triangle 1st corner color depending on state
bool setStartArrowColor2(const ElementState state, const Color &value); // Set start arrow triangle 2nd corner color depending on state
bool setStartArrowColor3(const ElementState 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 ElementState state, const Color &value); // Set end arrow borders color depending on state
bool setEndArrowBackgroundColor(const ElementState state, const Color &value); // Set end arrow background color depending on state
bool setEndArrowColor1(const ElementState state, const Color &value); // Set end arrow triangle 1st corner color depending on state
bool setEndArrowColor2(const ElementState state, const Color &value); // Set end arrow triangle 2nd corner color depending on state
bool setEndArrowColor3(const ElementState 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 ElementState state, const Color &value); // Set scroller borders color
bool setScrollerBackgroundColor(const ElementState state, const Color &value); // Set scroller background color
bool setScrollerLinesBorderColor(const ElementState state, const Color &value); // Set scroller lines borders color
bool setScrollerLinesBackgroundColor(const ElementState 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 horizontal and wise versa
};
Namespace: | nitisa |
Include: | Nitisa/BuiltInControls/Scroll/BuiltInScroll.h |