29 #ifndef PT_FORMS_SCROLLBARSTYLE_H
30 #define PT_FORMS_SCROLLBARSTYLE_H
32 #include <Pt/Forms/Styler.h>
33 #include <Pt/Forms/Direction.h>
39 class PT_FORMS_API ScrollBarState
44 bool isEnabled()
const;
46 void setEnabled(
bool value);
48 bool isFocused()
const;
50 void setFocused(
bool value);
52 bool isHandleHovered()
const;
54 void setHandleHovered(
bool value);
56 bool isHandlePressed()
const;
58 void setHandlePressed(
bool value);
60 bool isDecreaseHovered()
const;
62 void setDecreaseHovered(
bool value);
64 bool isDecreasePressed()
const;
66 void setDecreasePressed(
bool value);
68 bool isIncreaseHovered()
const;
70 void setIncreaseHovered(
bool value);
72 bool isIncreasePressed()
const;
74 void setIncreasePressed(
bool value);
81 bool _decreaseHovered;
82 bool _decreasePressed;
83 bool _increaseHovered;
84 bool _increasePressed;
88 class PT_FORMS_API ScrollBarRenderer :
public Renderer
91 explicit ScrollBarRenderer(std::size_t refs = 0);
93 virtual ~ScrollBarRenderer();
97 ScrollBarRenderer* create()
const;
100 Gfx::SizeF measureFrame(PaintSurface& surface,
101 const Gfx::SizeF& contentSize,
102 Direction direction);
104 Gfx::SizeF measureTrack(PaintSurface& surface,
105 Direction direction);
107 Gfx::SizeF measureHandle(PaintSurface& surface,
108 Direction direction);
110 Gfx::SizeF measureButton(PaintSurface& surface,
111 Direction direction);
113 void layoutChrome(PaintSurface& surface,
114 const Gfx::RectF& rect,
116 const Gfx::SizeF& buttonSize,
117 Gfx::RectF& trackRect,
118 Gfx::RectF& decreaseRect,
119 Gfx::RectF& increaseRect);
121 void layoutHandle(PaintSurface& surface,
122 const Gfx::RectF& trackRect,
125 float viewProportion,
126 Gfx::RectF& handleRect);
128 void renderChrome(PaintContext& context,
129 const Gfx::RectF& rect,
131 const Gfx::RectF& trackRect,
132 const Gfx::RectF& handleRect,
133 const Gfx::RectF& decreaseRect,
134 const Gfx::RectF& increaseRect,
135 const ScrollBarState& state);
137 void renderTrack(PaintContext& context,
138 const Gfx::RectF& trackRect,
140 const ScrollBarState& state);
142 void renderHandle(PaintContext& context,
143 const Gfx::RectF& handleRect,
145 const ScrollBarState& state);
147 void renderDecreaseButton(PaintContext& context,
148 const Gfx::RectF& buttonRect,
150 const ScrollBarState& state);
152 void renderIncreaseButton(PaintContext& context,
153 const Gfx::RectF& buttonRect,
155 const ScrollBarState& state);
158 virtual ScrollBarRenderer* onCreate()
const = 0;
162 virtual void onReset(
const StyleOptions& options) = 0;
164 virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
165 const Gfx::SizeF& contentSize,
166 Direction direction) = 0;
168 virtual Gfx::SizeF onMeasureTrack(PaintSurface& surface,
169 Direction direction) = 0;
171 virtual Gfx::SizeF onMeasureHandle(PaintSurface& surface,
172 Direction direction) = 0;
174 virtual Gfx::SizeF onMeasureButton(PaintSurface& surface,
175 Direction direction) = 0;
177 virtual void onLayoutChrome(PaintSurface& surface,
178 const Gfx::RectF& rect,
180 const Gfx::SizeF& buttonSize,
181 Gfx::RectF& trackRect,
182 Gfx::RectF& decreaseRect,
183 Gfx::RectF& increaseRect) = 0;
185 virtual void onLayoutHandle(PaintSurface& surface,
186 const Gfx::RectF& trackRect,
189 float viewProportion,
190 Gfx::RectF& handleRect) = 0;
192 virtual void onRenderChrome(PaintContext& context,
193 const Gfx::RectF& rect,
195 const Gfx::RectF& trackRect,
196 const Gfx::RectF& handleRect,
197 const Gfx::RectF& decreaseRect,
198 const Gfx::RectF& increaseRect,
199 const ScrollBarState& state);
201 virtual void onRenderTrack(PaintContext& context,
202 const Gfx::RectF& trackRect,
204 const ScrollBarState& state) = 0;
206 virtual void onRenderHandle(PaintContext& context,
207 const Gfx::RectF& handleRect,
209 const ScrollBarState& state) = 0;
211 virtual void onRenderDecreaseButton(PaintContext& context,
212 const Gfx::RectF& buttonRect,
214 const ScrollBarState& state) = 0;
216 virtual void onRenderIncreaseButton(PaintContext& context,
217 const Gfx::RectF& buttonRect,
219 const ScrollBarState& state) = 0;
260 Direction direction)
const;
265 Direction direction)
const;
283 float viewProportion,
295 const ScrollBarState& state)
const;
309 FacetPtr<ScrollBarRenderer> _renderer;