TGUI  1.6.1
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#ifndef TGUI_BUTTON_RENDERER_HPP
26#define TGUI_BUTTON_RENDERER_HPP
27
28#include <TGUI/Renderers/WidgetRenderer.hpp>
29
31
32TGUI_MODULE_EXPORT namespace tgui
33{
34 class TGUI_API ButtonRenderer : public WidgetRenderer
35 {
36 public:
37
38 using WidgetRenderer::WidgetRenderer;
39
45 void setBorders(const Borders& borders);
46
52 TGUI_NODISCARD Borders getBorders() const;
53
59 void setTextColor(Color color);
60
66 TGUI_NODISCARD Color getTextColor() const;
67
74
80 TGUI_NODISCARD Color getTextColorDown() const;
81
88
94 TGUI_NODISCARD Color getTextColorHover() const;
95
102
108 TGUI_NODISCARD Color getTextColorDownHover() const;
109
116
122 TGUI_NODISCARD Color getTextColorDisabled() const;
123
130
136 TGUI_NODISCARD Color getTextColorDownDisabled() const;
137
143
148 TGUI_NODISCARD Color getTextColorFocused() const;
149
155
160 TGUI_NODISCARD Color getTextColorDownFocused() const;
161
170
176 TGUI_NODISCARD Color getBackgroundColor() const;
177
186
192 TGUI_NODISCARD Color getBackgroundColorDown() const;
193
202
208 TGUI_NODISCARD Color getBackgroundColorHover() const;
209
218
224 TGUI_NODISCARD Color getBackgroundColorDownHover() const;
225
234
240 TGUI_NODISCARD Color getBackgroundColorDisabled() const;
241
250
256 TGUI_NODISCARD Color getBackgroundColorDownDisabled() const;
257
265
270 TGUI_NODISCARD Color getBackgroundColorFocused() const;
271
279
284 TGUI_NODISCARD Color getBackgroundColorDownFocused() const;
285
292
298 TGUI_NODISCARD Color getBorderColor() const;
299
306
312 TGUI_NODISCARD Color getBorderColorDown() const;
313
320
326 TGUI_NODISCARD Color getBorderColorHover() const;
327
334
340 TGUI_NODISCARD Color getBorderColorDownHover() const;
341
348
354 TGUI_NODISCARD Color getBorderColorDisabled() const;
355
362
368 TGUI_NODISCARD Color getBorderColorDownDisabled() const;
369
376
382 TGUI_NODISCARD Color getBorderColorFocused() const;
383
390
396 TGUI_NODISCARD Color getBorderColorDownFocused() const;
397
405 void setTexture(const Texture& texture);
406
412 TGUI_NODISCARD const Texture& getTexture() const;
413
419 void setTextureDown(const Texture& texture);
420
426 TGUI_NODISCARD const Texture& getTextureDown() const;
427
433 void setTextureHover(const Texture& texture);
434
440 TGUI_NODISCARD const Texture& getTextureHover() const;
441
447 void setTextureDownHover(const Texture& texture);
448
454 TGUI_NODISCARD const Texture& getTextureDownHover() const;
455
461 void setTextureDisabled(const Texture& texture);
462
468 TGUI_NODISCARD const Texture& getTextureDisabled() const;
469
475 void setTextureDownDisabled(const Texture& texture);
476
482 TGUI_NODISCARD const Texture& getTextureDownDisabled() const;
483
489 void setTextureFocused(const Texture& texture);
490
496 TGUI_NODISCARD const Texture& getTextureFocused() const;
497
503 void setTextureDownFocused(const Texture& texture);
504
510 TGUI_NODISCARD const Texture& getTextureDownFocused() const;
511
518
524 TGUI_NODISCARD TextStyles getTextStyle() const;
525
532
538 TGUI_NODISCARD TextStyles getTextStyleDown() const;
539
546
552 TGUI_NODISCARD TextStyles getTextStyleHover() const;
553
560
566 TGUI_NODISCARD TextStyles getTextStyleDownHover() const;
567
574
580 TGUI_NODISCARD TextStyles getTextStyleDisabled() const;
581
588
594 TGUI_NODISCARD TextStyles getTextStyleDownDisabled() const;
595
602
608 TGUI_NODISCARD TextStyles getTextStyleFocused() const;
609
616
622 TGUI_NODISCARD TextStyles getTextStyleDownFocused() const;
623
628 void setTextOutlineColor(Color outlineColor);
629
634 TGUI_NODISCARD Color getTextOutlineColor() const;
635
640 void setTextOutlineThickness(float outlineThickness);
641
646 TGUI_NODISCARD float getTextOutlineThickness() const;
647
654 void setRoundedBorderRadius(float radius);
655
660 TGUI_NODISCARD float getRoundedBorderRadius() const;
661
663 };
664
666
669
671}
672
674
675#endif // TGUI_BUTTON_RENDERER_HPP
Definition ButtonRenderer.hpp:35
void setTextStyleDownHover(TextStyles style)
Changes the text style when in both down and hover state (mouse on button while button pressed)
Color getBorderColorDownHover() const
Returns the color of the borders when in both down and hover state (mouse on button while button pres...
const Texture & getTextureDownFocused() const
Returns the image that is drawn on top of the button image when the button is focused while in presse...
TextStyles getTextStyle() const
Returns text style.
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)
void setBorderColorDownFocused(Color color)
Changes the color of the borders that is used when the button is focused while in pressed state.
void setTextStyleDownDisabled(TextStyles style)
Changes the text style that is used when the button is disabled while in pressed state.
Color getTextColorDownFocused() const
Returns the text color that is used when the button is focused 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.
TextStyles getTextStyleDownDisabled() const
Returns text style used when the button is disabled while in pressed state.
void setTextureDownDisabled(const Texture &texture)
Changes the image that is displayed when the button is disabled while in pressed state.
TextStyles getTextStyleFocused() const
Returns text style used when the button is focused.
void setTextOutlineThickness(float outlineThickness)
Changes the thickness of the text outline (0 by default, which means there is no outline).
TextStyles getTextStyleDownFocused() const
Returns text style used when the button is focused while in pressed state.
const Texture & getTexture() const
Returns the image that is displayed.
void setTextColorDown(Color color)
Changes the color of the text in the down state (mouse on button and left mouse button being held dow...
Color getTextColorDown() const
Returns the text color in the down state (mouse on button and left mouse button being held down)
Color getBackgroundColorDisabled() const
Returns the background color that is used when the button is disabled.
Color getTextColorDownHover() const
Returns the text color when in both down and hover state (mouse on button while button pressed)
void setTextStyleDownFocused(TextStyles style)
Changes the text style that is used when the button is focused while in pressed state.
Color getTextColorFocused() const
Returns the text color that is used when the button is focused.
TextStyles getTextStyleDownHover() const
Returns text style when in both down and hover state (mouse on button while button pressed)
Color getTextColorHover() const
Returns the text color in the hover state (mouse on button, but not pressed)
void setBorderColor(Color color)
Changes the color of the borders.
void setTexture(const Texture &texture)
Change the image that is displayed.
Color getBorderColorHover() const
Returns the color of the borders in the hover state (mouse on button, but not pressed)
const Texture & getTextureDown() const
Returns the image that is displayed when the mouse is held down on top of the button.
void setBorderColorDownDisabled(Color color)
Changes the color of the borders that is used when the button is disabled while in pressed state.
Color getBackgroundColorDownDisabled() const
Returns the background color that is used when the button is disabled while in pressed state.
Color getBorderColorFocused() const
Returns the color of the borders that is used when the button is focused.
void setBorderColorDown(Color color)
Changes the color of the borders in the down state (mouse on button and left mouse button being held ...
Color getTextColorDownDisabled() const
Returns the text color that is used when the button is disabled while in pressed state.
Color getTextOutlineColor() const
Returns the outline color of the text (used when TextOutlineThickness > 0)
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.
Color getBackgroundColor() const
Returns the background color.
Color getBackgroundColorHover() const
Returns the background color in the hover state (mouse on button, but not pressed)
TextStyles getTextStyleHover() const
Returns text style in the hover state (mouse on button, but not pressed)
const Texture & getTextureDownHover() const
Returns the image that is displayed when in both down and hover state (mouse on button while button p...
Color getBorderColorDown() const
Returns the color of the borders in the down state (mouse on button and left mouse button being held ...
void setTextColorDownHover(Color color)
Changes the text color when in both down and hover state (mouse on button while button pressed)
Borders getBorders() const
Returns the size of the borders.
const Texture & getTextureHover() const
Returns the image that is displayed when the mouse is located on top of the button.
Color getBorderColorDisabled() const
Returns the color of the borders that is used when the button is disabled.
const Texture & getTextureDisabled() const
Returns the image that is displayed when the button is disabled.
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.
Color getBackgroundColorDown() const
Returns the background color in the down state (mouse on button and left mouse button being held down...
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...
const Texture & getTextureDownDisabled() const
Returns the image that is displayed 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.
const Texture & getTextureFocused() const
Returns the image that is drawn on top of the button image when the button is focused.
Color getBorderColor() const
Returns the color of the borders.
Color getBackgroundColorFocused() const
Returns the background color that is used when the button is focused.
Color getBorderColorDownFocused() const
Returns the color of the borders that is used when the button is focused while in pressed state.
float getRoundedBorderRadius() const
Returns the radius for the rounded corners if you want to draw a rounded rectangle as background.
void setBackgroundColorDownFocused(Color color)
Changes the color of the background used when the button is focused while in pressed state.
float getTextOutlineThickness() const
Returns the thickness of the text outline.
void setTextColorDisabled(Color color)
Changes the color of the text that is used when the button is disabled.
void setBorderColorFocused(Color color)
Changes the color of the borders that is used when the button is focused.
void setTextColor(Color color)
Changes the color of the text.
void setBackgroundColor(Color color)
Changes the color of the background.
void setRoundedBorderRadius(float radius)
Changes the radius for the rounded corners if you want to draw a rounded rectangle as background.
Color getBackgroundColorDownFocused() const
Returns the background color that is used when the button is focused while in pressed state.
Color getTextColorDisabled() const
Returns the text color that is used when the button is disabled.
void setTextStyle(TextStyles style)
Changes the text style.
TextStyles getTextStyleDown() const
Returns text style in the down state (mouse on button and left mouse button being held down)
Color getBorderColorDownDisabled() const
Returns the color of the borders that is used when the button is disabled while in pressed state.
Color getTextColor() const
Returns the text color.
TextStyles getTextStyleDisabled() const
Returns text style used when the button is disabled.
void setTextStyleFocused(TextStyles style)
Changes the text style that is used when the button is focused.
Color getBackgroundColorDownHover() const
Returns the background color when in both down and hover state (mouse on button while button pressed)
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:73
Definition Outline.hpp:38
Wrapper for text styles.
Definition TextStyle.hpp:55
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:69
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38