TGUI 1.13
Loading...
Searching...
No Matches
ButtonRenderer.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2026 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
32namespace tgui
33{
34 class TGUI_API ButtonRenderer : public WidgetRenderer
35 {
36 public:
38
44 void setBorders(const Borders& borders);
45
51 [[nodiscard]] Borders getBorders() const;
52
58 void setTextColor(Color color);
59
65 [[nodiscard]] Color getTextColor() const;
66
73
79 [[nodiscard]] Color getTextColorDown() const;
80
87
93 [[nodiscard]] Color getTextColorHover() const;
94
101
107 [[nodiscard]] Color getTextColorDownHover() const;
108
115
121 [[nodiscard]] Color getTextColorDisabled() const;
122
129
135 [[nodiscard]] Color getTextColorDownDisabled() const;
136
142
147 [[nodiscard]] Color getTextColorFocused() const;
148
154
159 [[nodiscard]] Color getTextColorDownFocused() const;
160
169
175 [[nodiscard]] Color getBackgroundColor() const;
176
185
191 [[nodiscard]] Color getBackgroundColorDown() const;
192
201
207 [[nodiscard]] Color getBackgroundColorHover() const;
208
217
223 [[nodiscard]] Color getBackgroundColorDownHover() const;
224
233
239 [[nodiscard]] Color getBackgroundColorDisabled() const;
240
249
256
264
269 [[nodiscard]] Color getBackgroundColorFocused() const;
270
278
284
291
297 [[nodiscard]] Color getBorderColor() const;
298
305
311 [[nodiscard]] Color getBorderColorDown() const;
312
319
325 [[nodiscard]] Color getBorderColorHover() const;
326
333
339 [[nodiscard]] Color getBorderColorDownHover() const;
340
347
353 [[nodiscard]] Color getBorderColorDisabled() const;
354
361
367 [[nodiscard]] Color getBorderColorDownDisabled() const;
368
375
381 [[nodiscard]] Color getBorderColorFocused() const;
382
389
395 [[nodiscard]] Color getBorderColorDownFocused() const;
396
404 void setTexture(const Texture& texture);
405
411 [[nodiscard]] const Texture& getTexture() const;
412
418 void setTextureDown(const Texture& texture);
419
425 [[nodiscard]] const Texture& getTextureDown() const;
426
432 void setTextureHover(const Texture& texture);
433
439 [[nodiscard]] const Texture& getTextureHover() const;
440
446 void setTextureDownHover(const Texture& texture);
447
453 [[nodiscard]] const Texture& getTextureDownHover() const;
454
460 void setTextureDisabled(const Texture& texture);
461
467 [[nodiscard]] const Texture& getTextureDisabled() const;
468
474 void setTextureDownDisabled(const Texture& texture);
475
481 [[nodiscard]] const Texture& getTextureDownDisabled() const;
482
488 void setTextureFocused(const Texture& texture);
489
495 [[nodiscard]] const Texture& getTextureFocused() const;
496
502 void setTextureDownFocused(const Texture& texture);
503
509 [[nodiscard]] const Texture& getTextureDownFocused() const;
510
517
523 [[nodiscard]] TextStyles getTextStyle() const;
524
531
537 [[nodiscard]] TextStyles getTextStyleDown() const;
538
545
551 [[nodiscard]] TextStyles getTextStyleHover() const;
552
559
565 [[nodiscard]] TextStyles getTextStyleDownHover() const;
566
573
579 [[nodiscard]] TextStyles getTextStyleDisabled() const;
580
587
594
601
607 [[nodiscard]] TextStyles getTextStyleFocused() const;
608
615
621 [[nodiscard]] TextStyles getTextStyleDownFocused() const;
622
627 void setTextOutlineColor(Color outlineColor);
628
633 [[nodiscard]] Color getTextOutlineColor() const;
634
639 void setTextOutlineThickness(float outlineThickness);
640
645 [[nodiscard]] float getTextOutlineThickness() const;
646
653 void setRoundedBorderRadius(float radius);
654
659 [[nodiscard]] float getRoundedBorderRadius() const;
660
662 };
663
665
666 using ToggleButtonRenderer = ButtonRenderer;
667 using BitmapButtonRenderer = ButtonRenderer;
668} // namespace tgui
669
670#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.
WidgetRenderer()=default
Default constructor.
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:63
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:53
WidgetRenderer()=default
Default constructor.
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37