Skip to content

Commit ffeaa0c

Browse files
committed
Specify underlying type of some enum classes to make them smaller
A number of enum classes can be a lot smaller by specifying a smaller underlying type (and they don't need the big range of the large default type).
1 parent 286cfd2 commit ffeaa0c

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

include/TGUI/Components.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace dev
6464
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6565

6666
/// Layout alignment for automatically setting the position and (part of) the size of a component
67-
enum class AlignLayout
67+
enum class AlignLayout : std::uint8_t
6868
{
6969
None, //!< Position and size need to be manually set. This is the default.
7070
Top, //!< Places the component on on the top and sets its width to the area between Leftmost and Rightmost aligned components. Height needs to be manually set.
@@ -79,7 +79,7 @@ namespace dev
7979
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8080

8181
/// Position alignment of a component within its parent
82-
enum class PositionAlignment
82+
enum class PositionAlignment : std::uint8_t
8383
{
8484
None, //!< Place the component at the manually set position. This is the default.
8585
TopLeft, //!< Place the component in the upper left corner of its parent

include/TGUI/Widgets/ComboBox.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace tgui
4040
public:
4141

4242
/// @brief The side where the list will be displayed
43-
enum class ExpandDirection
43+
enum class ExpandDirection : std::uint8_t
4444
{
4545
Down, //!< Display the list below the combo box
4646
Up, //!< Display the list above the combo box

include/TGUI/Widgets/Grid.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace tgui
5050
/// Where in the cell is the widget located?
5151
/// The widget is centered by default.
5252
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
53-
enum class Alignment
53+
enum class Alignment : std::uint8_t
5454
{
5555
Center, //!< Center the widget in the cell
5656
UpperLeft, //!< Draw the widget in the upper left corner of the cell

include/TGUI/Widgets/ProgressBar.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace tgui
5050
///
5151
/// Determines in which direction the progress bar is filled when value goes from minimum to maximum.
5252
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
53-
enum class FillDirection
53+
enum class FillDirection : std::uint8_t
5454
{
5555
LeftToRight, //!< Start filling at the left side and go to the right
5656
RightToLeft, //!< Start filling at the right side and go to the left

include/TGUI/Widgets/Scrollbar.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace tgui
4848
static constexpr const char StaticWidgetType[] = "Scrollbar"; //!< Type name of the widget
4949

5050
/// @brief Defines when the scrollbar shows up
51-
enum class Policy
51+
enum class Policy : std::uint8_t
5252
{
5353
Automatic, //!< Show the scrollbar only when needed (default)
5454
Always, //!< Always show the scrollbar, even when the contents fits
@@ -383,7 +383,7 @@ namespace tgui
383383
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
384384
protected:
385385

386-
enum class Part
386+
enum class Part : std::uint8_t
387387
{
388388
None,
389389
Track,

include/TGUI/Widgets/TabContainer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace tgui
5353
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5454
/// @brief Enumeration of the tab alignments for tabs
5555
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
56-
enum class TabAlign
56+
enum class TabAlign : std::uint8_t
5757
{
5858
Top = 0, //!< Tabs are above panels
5959
Bottom = 1 << 0 //!< Tabs are below panels

0 commit comments

Comments
 (0)