TGUI  1.3-dev
Loading...
Searching...
No Matches
ButtonRenderer.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2024 Bruno Van de Velde (vdv_b@tgui.eu)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25
26#ifndef TGUI_BUTTON_RENDERER_HPP
27#define TGUI_BUTTON_RENDERER_HPP
28
29
30#include <TGUI/Renderers/WidgetRenderer.hpp>
31
33
34TGUI_MODULE_EXPORT namespace tgui
35{
36 class TGUI_API ButtonRenderer : public WidgetRenderer
37 {
38 public:
39
40 using WidgetRenderer::WidgetRenderer;
41
42
48 void setBorders(const Borders& borders);
49
50
56 TGUI_NODISCARD Borders getBorders() const;
57
58
64 void setTextColor(Color color);
65
66
72 TGUI_NODISCARD Color getTextColor() const;
73
74
81
82
88 TGUI_NODISCARD Color getTextColorDown() const;
89
90
97
98
104 TGUI_NODISCARD Color getTextColorHover() const;
105
106
113
114
120 TGUI_NODISCARD Color getTextColorDownHover() const;
121
122
129
130
136 TGUI_NODISCARD Color getTextColorDisabled() const;
137
138
145
146
152 TGUI_NODISCARD Color getTextColorDownDisabled() const;
153
154
160
161
166 TGUI_NODISCARD Color getTextColorFocused() const;
167
168
174
175
180 TGUI_NODISCARD Color getTextColorDownFocused() const;
181
182
191
192
198 TGUI_NODISCARD Color getBackgroundColor() const;
199
200
209
210
216 TGUI_NODISCARD Color getBackgroundColorDown() const;
217
218
227
228
234 TGUI_NODISCARD Color getBackgroundColorHover() const;
235
236
245
246
252 TGUI_NODISCARD Color getBackgroundColorDownHover() const;
253
254
263
264
270 TGUI_NODISCARD Color getBackgroundColorDisabled() const;
271
272
281
282
288 TGUI_NODISCARD Color getBackgroundColorDownDisabled() const;
289
290
298
299
304 TGUI_NODISCARD Color getBackgroundColorFocused() const;
305
306
314
315
320 TGUI_NODISCARD Color getBackgroundColorDownFocused() const;
321
322
329
330
336 TGUI_NODISCARD Color getBorderColor() const;
337
338
345
346
352 TGUI_NODISCARD Color getBorderColorDown() const;
353
354
361
362
368 TGUI_NODISCARD Color getBorderColorHover() const;
369
370
377
378
384 TGUI_NODISCARD Color getBorderColorDownHover() const;
385
386
393
394
400 TGUI_NODISCARD Color getBorderColorDisabled() const;
401
402
409
410
416 TGUI_NODISCARD Color getBorderColorDownDisabled() const;
417
418
425
426
432 TGUI_NODISCARD Color getBorderColorFocused() const;
433
434
441
442
448 TGUI_NODISCARD Color getBorderColorDownFocused() const;
449
450
458 void setTexture(const Texture& texture);
459
460
466 TGUI_NODISCARD const Texture& getTexture() const;
467
468
474 void setTextureDown(const Texture& texture);
475
476
482 TGUI_NODISCARD const Texture& getTextureDown() const;
483
484
490 void setTextureHover(const Texture& texture);
491
492
498 TGUI_NODISCARD const Texture& getTextureHover() const;
499
500
506 void setTextureDownHover(const Texture& texture);
507
508
514 TGUI_NODISCARD const Texture& getTextureDownHover() const;
515
516
522 void setTextureDisabled(const Texture& texture);
523
524
530 TGUI_NODISCARD const Texture& getTextureDisabled() const;
531
532
538 void setTextureDownDisabled(const Texture& texture);
539
540
546 TGUI_NODISCARD const Texture& getTextureDownDisabled() const;
547
548
554 void setTextureFocused(const Texture& texture);
555
556
562 TGUI_NODISCARD const Texture& getTextureFocused() const;
563
564
570 void setTextureDownFocused(const Texture& texture);
571
572
578 TGUI_NODISCARD const Texture& getTextureDownFocused() const;
579
580
587
588
594 TGUI_NODISCARD TextStyles getTextStyle() const;
595
596
603
604
610 TGUI_NODISCARD TextStyles getTextStyleDown() const;
611
612
619
620
626 TGUI_NODISCARD TextStyles getTextStyleHover() const;
627
628
635
636
642 TGUI_NODISCARD TextStyles getTextStyleDownHover() const;
643
644
651
652
658 TGUI_NODISCARD TextStyles getTextStyleDisabled() const;
659
660
667
668
674 TGUI_NODISCARD TextStyles getTextStyleDownDisabled() const;
675
676
683
684
690 TGUI_NODISCARD TextStyles getTextStyleFocused() const;
691
692
699
700
706 TGUI_NODISCARD TextStyles getTextStyleDownFocused() const;
707
708
713 void setTextOutlineColor(Color outlineColor);
714
715
720 TGUI_NODISCARD Color getTextOutlineColor() const;
721
722
727 void setTextOutlineThickness(float outlineThickness);
728
729
734 TGUI_NODISCARD float getTextOutlineThickness() const;
735
736
743 void setRoundedBorderRadius(float radius);
744
745
750 TGUI_NODISCARD float getRoundedBorderRadius() const;
751
752
754 };
755
757
760
762}
763
765
766#endif // TGUI_BUTTON_RENDERER_HPP
Definition ButtonRenderer.hpp:37
void setTextStyleDownHover(TextStyles style)
Changes the text style when in both down and hover state (mouse on button while button pressed)
TGUI_NODISCARD const Texture & getTextureHover() const
Returns the image that is displayed when the mouse is located on top of the button.
TGUI_NODISCARD const Texture & getTextureFocused() const
Returns the image that is drawn on top of the button image when the button is focused.
TGUI_NODISCARD Color getBackgroundColorDownFocused() const
Returns the background color that is used when the button is focused while in pressed state.
TGUI_NODISCARD Color getBackgroundColorDown() const
Returns the background color in the down state (mouse on button and left mouse button being held down...
TGUI_NODISCARD TextStyles getTextStyleDownDisabled() const
Returns text style used when the button is disabled while in pressed state.
void setTextColorHover(Color color)
Changes the color of the text in the hover state (mouse on button, but not pressed)
void setTextOutlineColor(Color outlineColor)
Changes the outline color of the text (used when TextOutlineThickness > 0)
TGUI_NODISCARD const Texture & getTextureDownDisabled() const
Returns the image that is displayed when the button is disabled while in pressed state.
void setBorderColorDownFocused(Color color)
Changes the color of the borders that is used when the button is focused while in pressed state.
TGUI_NODISCARD Color getBorderColorDownHover() const
Returns the color of the borders when in both down and hover state (mouse on button while button pres...
void setTextStyleDownDisabled(TextStyles style)
Changes the text style that is used when the button is disabled while in pressed state.
void setBackgroundColorHover(Color color)
Changes the color of the background in the hover state (mouse on button, but not pressed)
void setBorderColorDownHover(Color color)
Changes the color of the borders when in both down and hover state (mouse on button while button pres...
void setTextColorDownFocused(Color color)
Changes the color of the text that is used when the button is focused while in pressed state.
void setTextureDownHover(const Texture &texture)
Changes the image that is displayed when in both down and hover state (mouse on button while button p...
void setTextureFocused(const Texture &texture)
Change the image that is drawn on top of the button image when the button is focused.
void setTextureHover(const Texture &texture)
Changes the image that is displayed when the mouse is located on top of the button.
void setTextureDown(const Texture &texture)
Changes the image that is displayed when the mouse is held down on top of the button.
void setTextColorDownDisabled(Color color)
Changes the color of the text that is used when the button is disabled while in pressed state.
TGUI_NODISCARD TextStyles getTextStyleDownHover() const
Returns text style when in both down and hover state (mouse on button while button pressed)
TGUI_NODISCARD TextStyles getTextStyleDisabled() const
Returns text style used when the button is disabled.
void setTextureDownDisabled(const Texture &texture)
Changes the image that is displayed when the button is disabled while in pressed state.
void setTextOutlineThickness(float outlineThickness)
Changes the thickness of the text outline (0 by default, which means there is no outline).
TGUI_NODISCARD Color getBackgroundColor() const
Returns the background color.
void setTextColorDown(Color color)
Changes the color of the text in the down state (mouse on button and left mouse button being held dow...
TGUI_NODISCARD TextStyles getTextStyleDownFocused() const
Returns text style used when the button is focused while in pressed state.
void setTextStyleDownFocused(TextStyles style)
Changes the text style that is used when the button is focused while in pressed state.
void setBorderColor(Color color)
Changes the color of the borders.
void setTexture(const Texture &texture)
Change the image that is displayed.
TGUI_NODISCARD float getRoundedBorderRadius() const
Returns the radius for the rounded corners if you want to draw a rounded rectangle as background.
TGUI_NODISCARD Color getBorderColorDisabled() const
Returns the color of the borders that is used when the button is disabled.
TGUI_NODISCARD Color getBorderColor() const
Returns the color of the borders.
TGUI_NODISCARD TextStyles getTextStyleFocused() const
Returns text style used when the button is focused.
TGUI_NODISCARD Color getBackgroundColorFocused() const
Returns the background color that is used when the button is focused.
TGUI_NODISCARD Color getTextColorDown() const
Returns the text color in the down state (mouse on button and left mouse button being held down)
TGUI_NODISCARD Color getTextColorHover() const
Returns the text color in the hover state (mouse on button, but not pressed)
void setBorderColorDownDisabled(Color color)
Changes the color of the borders that is used when the button is disabled while in pressed state.
TGUI_NODISCARD Color getBorderColorDown() const
Returns the color of the borders in the down state (mouse on button and left mouse button being held ...
void setBorderColorDown(Color color)
Changes the color of the borders in the down state (mouse on button and left mouse button being held ...
TGUI_NODISCARD TextStyles getTextStyle() const
Returns text style.
TGUI_NODISCARD Color getBackgroundColorDisabled() const
Returns the background color that is used when the button is disabled.
TGUI_NODISCARD Color getTextColorDisabled() const
Returns the text color that is used when the button is disabled.
TGUI_NODISCARD Color getBorderColorFocused() const
Returns the color of the borders that is used when the button is focused.
void setTextureDownFocused(const Texture &texture)
Change the image that is drawn on top of the button image when the button is focused while in pressed...
void setBorderColorHover(Color color)
Changes the color of the borders in the hover state (mouse on button, but not pressed)
void setBorders(const Borders &borders)
Changes the size of the borders.
TGUI_NODISCARD const Texture & getTextureDown() const
Returns the image that is displayed when the mouse is held down on top of the button.
TGUI_NODISCARD TextStyles getTextStyleDown() const
Returns text style in the down state (mouse on button and left mouse button being held down)
TGUI_NODISCARD Color getBorderColorHover() const
Returns the color of the borders in the hover state (mouse on button, but not pressed)
TGUI_NODISCARD Color getTextColorDownFocused() const
Returns the text color that is used when the button is focused while in pressed state.
void setTextColorDownHover(Color color)
Changes the text color when in both down and hover state (mouse on button while button pressed)
void setBackgroundColorDisabled(Color color)
Changes the color of the background that is used when the button is disabled.
void setBackgroundColorFocused(Color color)
Changes the color of the background that is used when the button is focused.
void setBackgroundColorDownHover(Color color)
Changes the color of the background when in both down and hover state (mouse on button while button p...
void setBackgroundColorDown(Color color)
Changes the color of the background in the down state (mouse on button and left mouse button being he...
TGUI_NODISCARD Color getBorderColorDownDisabled() const
Returns the color of the borders that is used when the button is disabled while in pressed state.
void setTextColorFocused(Color color)
Changes the color of the text that is used when the button is focused.
void setBackgroundColorDownFocused(Color color)
Changes the color of the background used when the button is focused while in pressed state.
TGUI_NODISCARD const Texture & getTextureDownFocused() const
Returns the image that is drawn on top of the button image when the button is focused while in presse...
TGUI_NODISCARD Color getTextColor() const
Returns the text color.
void setTextColorDisabled(Color color)
Changes the color of the text that is used when the button is disabled.
TGUI_NODISCARD Color getTextColorDownDisabled() const
Returns the text color that is used when the button is disabled while in pressed state.
void setBorderColorFocused(Color color)
Changes the color of the borders that is used when the button is focused.
TGUI_NODISCARD Color getBackgroundColorDownHover() const
Returns the background color when in both down and hover state (mouse on button while button pressed)
TGUI_NODISCARD Color getBorderColorDownFocused() const
Returns the color of the borders that is used when the button is focused while in pressed state.
void setTextColor(Color color)
Changes the color of the text.
TGUI_NODISCARD Color getBackgroundColorHover() const
Returns the background color in the hover state (mouse on button, but not pressed)
TGUI_NODISCARD const Texture & getTextureDownHover() const
Returns the image that is displayed when in both down and hover state (mouse on button while button p...
TGUI_NODISCARD Color getBackgroundColorDownDisabled() const
Returns the background color that is used when the button is disabled while in pressed state.
TGUI_NODISCARD Color getTextColorDownHover() const
Returns the text color when in both down and hover state (mouse on button while button pressed)
TGUI_NODISCARD Color getTextOutlineColor() const
Returns the outline color of the text (used when TextOutlineThickness > 0)
void setBackgroundColor(Color color)
Changes the color of the background.
TGUI_NODISCARD TextStyles getTextStyleHover() const
Returns text style in the hover state (mouse on button, but not pressed)
void setRoundedBorderRadius(float radius)
Changes the radius for the rounded corners if you want to draw a rounded rectangle as background.
TGUI_NODISCARD const Texture & getTexture() const
Returns the image that is displayed.
TGUI_NODISCARD Color getTextColorFocused() const
Returns the text color that is used when the button is focused.
void setTextStyle(TextStyles style)
Changes the text style.
TGUI_NODISCARD float getTextOutlineThickness() const
Returns the thickness of the text outline.
TGUI_NODISCARD const Texture & getTextureDisabled() const
Returns the image that is displayed when the button is disabled.
void setTextStyleFocused(TextStyles style)
Changes the text style that is used when the button is focused.
TGUI_NODISCARD Borders getBorders() const
Returns the size of the borders.
void setTextStyleDown(TextStyles style)
Changes the text style in the down state (mouse on button and left mouse button being held down)
void setTextStyleHover(TextStyles style)
Changes the text style in the hover state (mouse on button, but not pressed)
void setBorderColorDisabled(Color color)
Changes the color of the borders that is used when the button is disabled.
void setTextStyleDisabled(TextStyles style)
Changes the text style that is used when the button is disabled.
void setBackgroundColorDownDisabled(Color color)
Changes the color of the background that is used when the button is disabled while in pressed state.
void setTextureDisabled(const Texture &texture)
Changes the image that is displayed when the button is disabled.
Wrapper for colors.
Definition Color.hpp:72
Definition Outline.hpp:39
Wrapper for text styles.
Definition TextStyle.hpp:57
Texture wrapper that internally reuses resources when multiple Texture objects are loaded from the sa...
Definition Texture.hpp:57
Base class for all renderer classes.
Definition WidgetRenderer.hpp:72
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39