11#include "sml/events/listener_notifier.h"
12#include "../image_view.h"
13#include "../shapes/text.h"
14#include "../shapes/rectangle.h"
15#include "../../paint/background.h"
16#include "../../paint/border.h"
17#include "../../paint/insets.h"
18#include "../../paint/shadow.h"
31 extern Sml::Font* g_DefaultFont;
36 class ButtonBaseSkinEventListener;
43 Insets paddingLabelOnly{0};
45 Insets paddingIconAndLabel{0};
47 Border border{0, Sml::COLOR_BLACK};
52 const Insets& paddingIconOnly,
53 const Insets& paddingIconAndLabel,
67 Sml::Color foreground;
83 virtual void dispose()
override;
84 virtual void attach(
Button* button)
override;
86 virtual void prerenderControl()
override;
88 virtual const Control* getControl()
const override;
89 virtual Control* getModifiableControl()
override;
91 virtual int32_t computePrefHeight(int32_t width = -1)
const override;
92 virtual int32_t computePrefWidth(int32_t height = -1)
const override;
94 virtual void layoutChildren()
override;
96 void applyInteractionStyle(InteractionStyle::Type type);
111 int32_t getMargin()
const;
113 void applyStaticStyle();
132 static const Insets PADDING_LABEL_ONLY;
133 static const Insets PADDING_ICON_ONLY;
134 static const Insets PADDING_LABEL_AND_ICON;
135 static const int32_t MARGIN;
136 static const Border BORDER;
139 static const Sml::Color IDLE_FOREGROUND;
140 static const ColorFill IDLE_BACKGROUND_FILL;
144 static const Sml::Color HOVERED_FOREGROUND;
145 static const ColorFill HOVERED_BACKGROUND_FILL;
160 static const Insets PADDING;
161 static const int32_t MARGIN;
162 static const Border BORDER;
165 static const Sml::Color IDLE_FOREGROUND;
166 static const ColorFill IDLE_BACKGROUND_FILL;
170 static const Sml::Color HOVERED_FOREGROUND;
171 static const ColorFill HOVERED_BACKGROUND_FILL;
190 static const ColorFill NOT_SELECTED_FILL;
192 static const Sml::Color KNOB_COLOR;
193 static const int32_t THICKNESS;
194 static const int32_t KNOB_SIZE_ALONG;
195 static const int32_t KNOB_SIZE_ACROSS;
199 const Fill* selectedFill,
200 Sml::Color knobColor = KNOB_COLOR,
201 int32_t thickness = THICKNESS,
202 int32_t knobSizeAlong = KNOB_SIZE_ALONG,
203 int32_t knobSizeAcross = KNOB_SIZE_ACROSS);
207 virtual void dispose()
override;
208 virtual void attach(
Slider* slider)
override;
210 virtual Component* getHitComponent(int32_t x, int32_t y)
override;
211 virtual void prerenderControl()
override;
213 virtual const Control* getControl()
const override;
214 virtual Control* getModifiableControl()
override;
216 virtual int32_t computePrefWidth(int32_t height = -1)
const override;
217 virtual int32_t computePrefHeight(int32_t width = -1)
const override;
219 virtual void layoutChildren()
override;
221 int32_t getThickness()
const;
222 void setThickness(int32_t thickness);
224 int32_t getKnobSizeAlong()
const;
225 void setKnobSizeAlong(int32_t knobWidth);
227 int32_t getKnobSizeAcross()
const;
228 void setKnobSizeAcross(int32_t knobSizeAcross);
232 Sml::Rectangle<int32_t> getLineRect();
233 Sml::Rectangle<int32_t> getKnobRect();
234 float getPercentage();
237 Slider* m_Slider =
nullptr;
241 const Fill* m_NotSelectedFill =
nullptr;
242 const Fill* m_SelectedFill =
nullptr;
244 int32_t m_Thickness = 0;
245 int32_t m_KnobSizeAlong = 0;
246 int32_t m_KnobSizeAcross = 0;
257 static const Sml::Color KNOB_COLOR;
263 virtual void dispose()
override;
264 virtual void attach(
ScrollBar* scrollBar)
override;
266 virtual const Control* getControl()
const override;
267 virtual Control* getModifiableControl()
override;
269 virtual void layoutChildren()
override;
276 Slider* m_Slider =
nullptr;
277 Button* m_DecrementButton =
nullptr;
278 Button* m_IncrementButton =
nullptr;
289 virtual void dispose()
override;
290 virtual void attach(
ScrollPane* scrollPane)
override;
292 virtual Component* getHitComponent(int32_t x, int32_t y)
override;
294 virtual void prerenderControl()
override;
296 virtual const Control* getControl()
const override;
297 virtual Control* getModifiableControl()
override;
299 virtual int32_t computePrefWidth(int32_t height = -1)
const override;
300 virtual int32_t computePrefHeight(int32_t width = -1)
const override;
302 virtual void layoutChildren()
override;
308 ScrollBar* m_HorizontalScrollBar =
nullptr;
309 ScrollBar* m_VerticalScrollBar =
nullptr;
311 Sml::Texture* m_RenderedContentTexture =
nullptr;
316 Sml::Rectangle<int32_t> computeContentRegion()
const;
317 void updateRenderedContentTexture();
Basic list-like container which lays out children in a line one after another.
virtual void dispose() override
Should be called by Control when this skin is replaced.