neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
scrollbar.hpp
Go to the documentation of this file.
1// i_scrollbar.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
31
32namespace neogfx
33{
34 class scrollbar : public object<i_scrollbar>, public i_skinnable_item
35 {
37 public:
38 typedef i_scrollbar abstract_type;
39 private:
41 public:
42 struct no_transition : std::logic_error { no_transition() : std::logic_error{ "neogfx::scrollbar::no_transition" } {} };
43 public:
44 scrollbar(i_scrollbar_container& aContainer, scrollbar_orientation aOrientation, scrollbar_style aStyle = scrollbar_style::Normal, bool aIntegerPositions = true);
46 public:
48 public:
50 scrollbar_style style() const override;
51 scrollbar_style type() const override;
52 void set_style(scrollbar_style aStyle) override;
53 bool always_visible() const override;
54 bool always_hidden() const override;
55 void show() override;
56 void hide() override;
57 bool visible() const override;
58 bool auto_hide() const override;
59 void set_auto_hide(bool aAutoHide) override;
60 bool auto_hidden() const override;
61 scrollbar_zone zone() const override;
62 void push_zone() override;
64 value_type position() const override;
65 value_type effective_position() const override;
66 value_type maximum_position() const override;
67 bool set_position(value_type aPosition) override;
68 value_type minimum() const override;
69 void set_minimum(value_type aMinimum) override;
70 value_type maximum() const override;
71 void set_maximum(value_type aMaximum) override;
72 value_type step() const override;
73 void set_step(value_type aStep) override;
74 value_type page() const override;
75 void set_page(value_type aPage) override;
76 public:
77 bool locked() const override;
78 void lock(value_type aPosition) override;
79 void unlock() override;
80 public:
81 dimension width() const override;
82 void render(i_graphics_context& aGc) const override;
83 public:
84 rect element_geometry(scrollbar_element aElement) const override;
85 scrollbar_element element_at(const point& aPosition) const override;
86 public:
87 void update(const update_params_t& aUpdateParams = update_params_t()) override;
89 void click_element(scrollbar_element aElement) override;
90 void unclick_element() override;
92 void hover_element(scrollbar_element aElement) override;
93 void unhover_element() override;
94 void pause() override;
95 void resume() override;
96 void track() override;
97 void untrack() override;
98 public:
99 bool transition_set() const noexcept override;
100 void set_transition(easing aTransition, double aTransitionDuration = 0.5, bool aOnlyWhenPaging = true) override;
101 void clear_transition() override;
102 public:
104 public:
105 bool is_widget() const final;
106 const i_widget& as_widget() const final;
108 public:
109 rect element_rect(skin_element aElement) const override;
110 private:
111 i_scrollbar_container& iContainer;
112 scrollbar_orientation iOrientation;
113 scrollbar_style iStyle;
114 bool iIntegerPositions;
115 bool iVisible;
116 bool iAutoHide;
117 value_type iMinimum;
118 value_type iMaximum;
119 value_type iStep;
120 value_type iPage;
121 std::optional<value_type> iLockedPosition;
122 scrollbar_element iClickedElement;
123 scrollbar_element iHoverElement;
124 std::optional<std::shared_ptr<widget_timer>> iTimer;
125 bool iPaused;
126 point iThumbClickedPosition;
127 value_type iThumbClickedValue;
128 bool iOnlyTransitionWhenPaging = true;
129 optional_point iScrollTrackPosition;
130 std::vector<scrollbar_zone> iZoneStack;
131 // properties / anchors
132 public:
133 define_property(property_category::interaction, value_type, Position, position)
134 };
135}
void set_style(scrollbar_style aStyle) override
scrollbar_zone pop_zone() override
dimension width() const override
bool set_position(value_type aPosition) override
void lock(value_type aPosition) override
void hide() override
value_type step() const override
void hover_element(scrollbar_element aElement) override
void unlock() override
bool always_visible() const override
bool transition_set() const noexcept override
bool visible() const override
scrollbar_style type() const override
bool is_widget() const final
void show() override
value_type page() const override
rect element_geometry(scrollbar_element aElement) const override
scrollbar_element hovering_element() const override
void update(const update_params_t &aUpdateParams=update_params_t()) override
const i_widget & as_widget() const final
scrollbar_zone zone() const override
value_type maximum_position() const override
scrollbar_style style() const override
void pause() override
bool auto_hidden() const override
void untrack() override
i_scrollbar_container & container() const override
void push_zone() override
void clear_transition() override
void track() override
scrollbar_orientation orientation() const override
bool locked() const override
rect element_rect(skin_element aElement) const override
scrollbar(i_scrollbar_container &aContainer, scrollbar_orientation aOrientation, scrollbar_style aStyle=scrollbar_style::Normal, bool aIntegerPositions=true)
void set_step(value_type aStep) override
void resume() override
value_type effective_position() const override
void click_element(scrollbar_element aElement) override
void render(i_graphics_context &aGc) const override
value_type minimum() const override
void set_maximum(value_type aMaximum) override
void unclick_element() override
void set_page(value_type aPage) override
void set_auto_hide(bool aAutoHide) override
void set_transition(easing aTransition, double aTransitionDuration=0.5, bool aOnlyWhenPaging=true) override
bool always_hidden() const override
void set_minimum(value_type aMinimum) override
scrollbar_element element_at(const point &aPosition) const override
bool auto_hide() const override
value_type maximum() const override
value_type position() const override
void unhover_element() override
scrollbar_element clicked_element() const override
scrollbar_orientation
default_geometry_value_type dimension
Definition plf_hive.h:79
#define meta_object(...)
Definition i_object.hpp:28
#define define_property(category, type, name, calculator,...)
Definition property.hpp:536