neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i_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>
28
29namespace neogfx
30{
31 enum class scrollbar_orientation : std::uint32_t
32 {
33 Vertical = 0x01,
34 Horizontal = 0x02,
35 };
36
37 enum class scrollbar_style : std::uint32_t
38 {
39 None = 0x00,
40 Normal = 0x01,
41 Menu = 0x02,
42 Scroller = 0x03,
43
44 AlwaysVisible = 0x80,
45
46 TYPE_MASK = 0x0F
47 };
48
50 {
51 return static_cast<scrollbar_style>(~static_cast<std::uint32_t>(aStyle));
52 }
53
55 {
56 return static_cast<scrollbar_style>(static_cast<std::uint32_t>(aLhs) & static_cast<std::uint32_t>(aRhs));
57 }
58
60 {
61 return static_cast<scrollbar_style>(static_cast<std::uint32_t>(aLhs) | static_cast<std::uint32_t>(aRhs));
62 }
63
64 enum class scrollbar_element : std::uint32_t
65 {
66 None = 0x00,
67 Scrollbar = 0x01,
68 UpButton = 0x02,
70 DownButton = 0x03,
72 PageUpArea = 0x04,
74 PageDownArea = 0x05,
76 Thumb = 0x06
77 };
78
79 enum class scrollbar_zone
80 {
81 Top,
82 Middle,
83 Bottom,
84 Left = Top,
86 };
87
88 class i_transition;
89
90 class i_scrollbar_container;
91
93 {
94 public:
95 typedef double value_type;
108 public:
109 struct element_already_clicked : std::logic_error { element_already_clicked() : std::logic_error("neogfx::i_scrollbar::element_already_clicked") {} };
110 struct element_not_clicked : std::logic_error{ element_not_clicked() : std::logic_error("neogfx::i_scrollbar::element_not_clicked") {} };
111 struct already_locked : std::logic_error { already_locked() : std::logic_error("neogfx::i_scrollbar::already_locked") {} };
112 struct not_locked : std::logic_error { not_locked() : std::logic_error("neogfx::i_scrollbar::not_locked") {} };
113 public:
114 virtual i_scrollbar_container& container() const = 0;
115 public:
117 virtual scrollbar_style style() const = 0;
118 virtual scrollbar_style type() const = 0;
119 virtual void set_style(scrollbar_style aStyle) = 0;
120 virtual bool always_visible() const = 0;
121 virtual bool always_hidden() const = 0;
122 virtual void show() = 0;
123 virtual void hide() = 0;
124 virtual bool visible() const = 0;
125 virtual bool auto_hide() const = 0;
126 virtual void set_auto_hide(bool aAutoHide) = 0;
127 virtual bool auto_hidden() const = 0;
128 virtual scrollbar_zone zone() const = 0;
129 virtual void push_zone() = 0;
131 virtual value_type position() const = 0;
132 virtual value_type effective_position() const = 0;
133 virtual value_type maximum_position() const = 0;
134 virtual bool set_position(value_type aPosition) = 0;
135 virtual value_type minimum() const = 0;
136 virtual void set_minimum(value_type aMinimum) = 0;
137 virtual value_type maximum() const = 0;
138 virtual void set_maximum(value_type aMaximum) = 0;
139 virtual value_type step() const = 0;
140 virtual void set_step(value_type aStep) = 0;
141 virtual value_type page() const = 0;
142 virtual void set_page(value_type aPage) = 0;
143 public:
144 virtual bool locked() const = 0;
145 virtual void lock(value_type aPosition) = 0;
146 virtual void unlock() = 0;
147 public:
148 virtual dimension width() const = 0;
149 virtual void render(i_graphics_context& aGc) const = 0;
150 public:
151 virtual rect element_geometry(scrollbar_element aElement) const = 0;
152 virtual scrollbar_element element_at(point const& aPosition) const = 0;
153 public:
154 virtual void update(const update_params_t& aUpdateParams = update_params_t()) = 0;
156 virtual void click_element(scrollbar_element aElement) = 0;
157 virtual void unclick_element() = 0;
159 virtual void hover_element(scrollbar_element aElement) = 0;
160 virtual void unhover_element() = 0;
161 virtual void pause() = 0;
162 virtual void resume() = 0;
163 virtual void track() = 0;
164 virtual void untrack() = 0;
165 public:
166 virtual bool transition_set() const noexcept = 0;
167 virtual void set_transition(easing aTransition, double aTransitionDuration = 0.5, bool aOnlyWhenPaging = true) = 0;
168 virtual void clear_transition() = 0;
169 };
170
172 {
173 friend class scrollbar_container_updater;
174 public:
175 virtual rect scroll_area() const = 0;
176 virtual size scroll_page() const = 0;
177 public:
178 virtual rect scrollbar_geometry(const i_scrollbar& aScrollbar) const = 0;
179 virtual void scrollbar_updated(const i_scrollbar& aScrollbar, i_scrollbar::update_reason_e aReason) = 0;
180 virtual color scrollbar_color(const i_scrollbar& aScrollbar) const = 0;
181 public:
182 virtual const i_widget& as_widget() const = 0;
183 virtual i_widget& as_widget() = 0;
184 protected:
185 virtual void update_scrollbar_visibility() = 0;
186 };
187
189 {
190 public:
191 virtual void queue(i_scrollbar_container& aContainer) = 0;
192 virtual void unqueue(i_scrollbar_container& aContainer) = 0;
193 virtual bool processing() const = 0;
194 virtual void process() = 0;
195 virtual i_scrollbar_container& current() const = 0;
196 public:
197 // {76C8BC39-25EA-4E55-B41C-4798E609E5B9}
198 static uuid const& iid() { static uuid const sIid{ 0x76c8bc39, 0x25ea, 0x4e55, 0xb41c, { 0x47, 0x98, 0xe6, 0x9, 0xe5, 0xb9 } }; return sIid; }
199 };
200}
virtual i_scrollbar_container & current() const =0
virtual void unqueue(i_scrollbar_container &aContainer)=0
virtual void queue(i_scrollbar_container &aContainer)=0
virtual bool processing() const =0
virtual size scroll_page() const =0
virtual i_widget & as_widget()=0
virtual rect scrollbar_geometry(const i_scrollbar &aScrollbar) const =0
virtual color scrollbar_color(const i_scrollbar &aScrollbar) const =0
virtual void update_scrollbar_visibility()=0
virtual void scrollbar_updated(const i_scrollbar &aScrollbar, i_scrollbar::update_reason_e aReason)=0
virtual const i_widget & as_widget() const =0
virtual rect scroll_area() const =0
virtual void set_transition(easing aTransition, double aTransitionDuration=0.5, bool aOnlyWhenPaging=true)=0
virtual void untrack()=0
virtual void render(i_graphics_context &aGc) const =0
virtual void set_maximum(value_type aMaximum)=0
virtual bool locked() const =0
virtual void set_auto_hide(bool aAutoHide)=0
virtual void clear_transition()=0
virtual void set_minimum(value_type aMinimum)=0
virtual value_type step() const =0
virtual void lock(value_type aPosition)=0
virtual void set_page(value_type aPage)=0
virtual value_type position() const =0
virtual bool always_visible() const =0
virtual value_type minimum() const =0
virtual void update(const update_params_t &aUpdateParams=update_params_t())=0
virtual bool transition_set() const noexcept=0
virtual scrollbar_element hovering_element() const =0
virtual scrollbar_element element_at(point const &aPosition) const =0
virtual void unclick_element()=0
virtual void show()=0
virtual void hover_element(scrollbar_element aElement)=0
virtual void unlock()=0
virtual void resume()=0
virtual value_type effective_position() const =0
virtual bool auto_hidden() const =0
virtual void set_step(value_type aStep)=0
virtual void push_zone()=0
virtual void pause()=0
virtual void unhover_element()=0
virtual void track()=0
virtual rect element_geometry(scrollbar_element aElement) const =0
virtual bool auto_hide() const =0
virtual void set_style(scrollbar_style aStyle)=0
virtual value_type maximum() const =0
virtual bool always_hidden() const =0
virtual scrollbar_style style() const =0
virtual dimension width() const =0
neolib::variant< point > update_params_t
virtual bool set_position(value_type aPosition)=0
virtual scrollbar_element clicked_element() const =0
virtual value_type maximum_position() const =0
virtual scrollbar_orientation orientation() const =0
virtual i_scrollbar_container & container() const =0
virtual scrollbar_zone pop_zone()=0
virtual void click_element(scrollbar_element aElement)=0
virtual value_type page() const =0
virtual scrollbar_zone zone() const =0
virtual scrollbar_style type() const =0
virtual void hide()=0
virtual bool visible() const =0
scrollbar_orientation
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:60
audio_channel operator~(audio_channel lhs)
default_geometry_value_type dimension
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:55