DUDS
Distributed Update of Data from Something
duds::ui::menu::renderers::BppMenuRenderer Class Reference

Renders menus to bit-per-pixel images. More...

#include <BppMenuRenderer.hpp>

Collaboration diagram for duds::ui::menu::renderers::BppMenuRenderer:

Public Types

typedef duds::general::BitFlags< struct BppMenuFlags > Flags
 A type for configuration flags. More...
 
enum  ScrollBarPlacement { ScrollRight, ScrollLeft, ScrollBottom, ScrollTop }
 Values used to control which edge of the menu will host the scroll bar. More...
 

Public Member Functions

 BppMenuRenderer (Flags cfg=Flags::Zero())
 Constructs a new menu renderer without a string cache or font. More...
 
 BppMenuRenderer (const duds::ui::graphics::BppStringCacheSptr &cachePtr, Flags cfg=Flags::Zero())
 Constructs a new menu renderer. More...
 
 BppMenuRenderer (const duds::ui::graphics::BppStringCacheSptr &cachePtr, int vmItems, Flags cfg=Flags::Zero())
 Constructs a new menu renderer; best for horizontally oriented menus. More...
 
void addScrollBar (std::uint16_t width=1, std::uint16_t margin=1, std::uint16_t minsize=4, ScrollBarPlacement place=ScrollRight)
 Adds or replaces a scroll bar on the menu. More...
 
const duds::ui::graphics::ConstBppImageSptrdisabledIcon () const
 Returns the currently configured disabled icon image. More...
 
void disabledIcon (const duds::ui::graphics::ConstBppImageSptr &img)
 Changes the optional icon used to inform the user that a menu item is currently disabled. More...
 
Flags flags () const
 Returns the configuration flags for this renderer. More...
 
void flags (Flags cfg)
 Changes the configuration flags for this renderer. More...
 
bool hasScrollBar () const
 Returns true if a scroll bar is in use. More...
 
const duds::ui::graphics::ImageDimensionsiconDimensions () const
 Returns the dimensions used for rendering icons stored inside menu items derived from BppIconItem. More...
 
void iconDimensions (const duds::ui::graphics::ImageDimensions &dim)
 Sets the dimensions used for rendering icons stored inside menu items derived from BppIconItem. More...
 
std::uint16_t iconTextMargin () const
 Returns the size of the margin between icons from menu items and the text label of the item. More...
 
void iconTextMargin (std::uint16_t itm)
 Sets the size of the margin between icons from menu items and the text label of the item. More...
 
std::uint16_t itemMargin () const
 Returns the margin in pixels placed bewteen each menu item. More...
 
void itemMargin (std::uint16_t im)
 Changes the margin in pixels placed bewteen each menu item. More...
 
std::uint16_t maxVisible () const
 Returns the maximum number of visible items to show on the menu; try to avoid calling. More...
 
void maxVisible (std::uint16_t i)
 Sets the maximum number of visible items for horizontally oriented menus. More...
 
void removeScrollBar ()
 Removes the scroll bar from the menu. More...
 
void render (duds::ui::graphics::BppImageSptr &dest, duds::ui::menu::MenuOutputAccess &mova)
 Renders a menu to the given image. More...
 
void render (duds::ui::graphics::BppImageSptr &dest, duds::ui::menu::MenuOutput &mov)
 Renders a menu to the given image. More...
 
duds::ui::graphics::BppImageSptr render (const duds::ui::graphics::ImageDimensions &dim, duds::ui::menu::MenuOutputAccess &mova)
 Renders a menu of the given size. More...
 
duds::ui::graphics::BppImageSptr render (const duds::ui::graphics::ImageDimensions &dim, duds::ui::menu::MenuOutput &mov)
 Renders a menu of the given size. More...
 
const duds::ui::graphics::ConstBppImageSptrselectedIcon () const
 Returns the currently set icon used to indicate item selection. More...
 
void selectedIcon (const duds::ui::graphics::ConstBppImageSptr &img)
 Changes the optional selection icon used to inform the user what item they have selected and are poised to chose. More...
 
const duds::ui::graphics::BppStringCacheSptrstringCache () const
 Returns the string cache currently used to render menu item text. More...
 
void stringCache (const duds::ui::graphics::BppStringCacheSptr &sc)
 Changes the string cache used to render menu item text. More...
 
const duds::ui::graphics::ConstBppImageSptrtoggledOffIcon () const
 Returns the icon used to signify a toggle state in the off position. More...
 
void toggledOffIcon (const duds::ui::graphics::ConstBppImageSptr &img)
 Changes the option icon used to signify a toggle state in the off position. More...
 
const duds::ui::graphics::ConstBppImageSptrtoggledOnIcon () const
 Returns the icon used to signify a toggle state in the on position. More...
 
void toggledOnIcon (const duds::ui::graphics::ConstBppImageSptr &img)
 Changes the option icon used to signify a toggle state in the on position. More...
 
std::uint16_t valueMargin () const
 Returns the margin in pixels between a menu item's label text and its value text. More...
 
void valueMargin (std::uint16_t m)
 Changes the margin in pixels between a menu item's label text and its value text. More...
 
std::uint16_t valueWidth () const
 Returns the width in pixels of the value column. More...
 
void valueWidth (std::uint16_t w)
 Changes the width in pixels of the value column. More...
 

Static Public Attributes

static constexpr Flags DoNotShowText = Flags::Bit(6)
 Only show icons, not text, for the menu items. More...
 
static constexpr Flags HorizontalList = Flags::Bit(3)
 Items are arranged horizontally instead of vertically. More...
 
static constexpr Flags InvertSelected = Flags::Bit(4)
 The selected item will be rendered inverted. More...
 
static constexpr Flags ScrollBarMask = Flags(3)
 Mask that defines where the ScrollBarPlacement value is put in the configuration flags. More...
 
static constexpr Flags ScrollBarNeverHides = Flags::Bit(2)
 True to always show the scroll bar. More...
 
static constexpr Flags ValueRightJustified = Flags::Bit(5)
 Right justify value text when values are placed in a column separate from the item label. More...
 

Private Member Functions

void recalculateDimensions (duds::ui::graphics::ImageDimensions fitDim)
 Recalculates the dimension values needed to render a menu that fits into the given dimensions. More...
 

Private Attributes

duds::ui::graphics::BppStringCacheSptr cache
 Pre-rendered strings for menu text. More...
 
duds::ui::graphics::ImageDimensions destDim
 Destination dimensions; used to tell when to recompute dimensions of parts of the menu. More...
 
duds::ui::graphics::ConstBppImageSptr disIcon
 Icon used to denote a disabled menu item. More...
 
Flags flgs
 Option flags that modify how the menu is rendered. More...
 
std::uint16_t fracshow
 The number of pixels to show of a partially visible menu item. More...
 
duds::ui::graphics::ImageDimensions iconDim
 The size of a menu item's icon. More...
 
std::uint16_t iconTxMg = 0
 Space in pixels to have between icons and text. More...
 
duds::ui::graphics::ImageDimensions itemDim
 Computed dimensions of a complete menu item. More...
 
std::uint16_t itemMg = 0
 The margin in pixels between menu items. More...
 
std::uint16_t items = 0
 Number of items to display. More...
 
std::unique_ptr< duds::ui::graphics::BppPositionIndicatorposInd
 Optional position indicator to show user location within the menu. More...
 
std::uint16_t scrollMg = 0
 Space in pixels to have between label or value text and the scroll bar. More...
 
std::uint16_t scrollWidth
 Thw width of the scroll bar in pixels. More...
 
std::uint16_t selDisWidth = 0
 The maximum width of the selection icon and the disabled icon. More...
 
duds::ui::graphics::ConstBppImageSptr selIcon
 Icon used to denote a selected menu item. More...
 
duds::ui::graphics::ImageDimensions textDim
 The size of a menu item's text. More...
 
std::uint16_t toggleWidth = 0
 The maximum width of the toggle icons. More...
 
duds::ui::graphics::ConstBppImageSptr togOffIcon
 Icon used to denote a menu item in its toggled off state. More...
 
duds::ui::graphics::ConstBppImageSptr togOnIcon
 Icon used to denote a menu item in its toggled on state. More...
 
std::uint16_t valMg = 0
 The margin in pixels between the label and value columns,. More...
 
std::uint16_t valWidth = 0
 The width of the value column. More...
 

Static Private Attributes

static constexpr Flags Calculated = Flags::Bit(15)
 When set, indicates that internal dimension values have been calculated. More...
 
static constexpr Flags InternalMask = Flags(0xFF00)
 The second byte (the one next to the least significant byte) is reserved for internal flags. More...
 
static constexpr Flags ScrollBarShown = Flags::Bit(14)
 Indicates that the scroll bar was rendered on the previous render call. More...
 

Detailed Description

Renders menus to bit-per-pixel images.

This class is not thread-safe; if rendering from multiple threads is required, use a separate instance for each thread.

The menu items can be ordered vertically (default) or horizontally. If horizontal, all items will be in the same row. Either way, each item will have the same columns, each the same size, which may include one or more of the following in the given order:

  1. Selection and disabled icons
  2. Toggle on and off icons
  3. BppMenuIconItem icon
  4. Icon to text margin
  5. Item label text
    • Sized by subtracting the width of everything else to fit within the destination image and using the largest height.
    • Omitted if the non-default configuration flag DoNotShowText is used.
    • Requires a string cache be provided to either a constructor or to stringCache(const duds::ui::graphics::BppStringCacheSptr &).
  6. Value margin
    • Optional extra space between the label text and value text set by call to valueMargin(std::uint16_t).
    • Only included if the item value text has its own column.
  7. Item value text
    • This column is omitted unless a non-zero size specified by call to valueWidth(std::uint16_t).
    • If omitted, the value text will be rendered with the label text. This will likely need some more development work to look good.
    • The text may optionally be right justified by using the configuration flag ValueRightJustified.
  8. Item margin
    • Optional extra space between menu items set by call to itemMargin(std::uint16_t).
    • Only present as a column on horizontally oriented menus. Vertically oriented menus place the space as rows of pixels between the items.

Each renderer instance caches information used to define the bounds of each MenuItem based on the instance's configuration, the provided font inside the string cache, and the size of the output image. When the configuration changes in a way that could affect the size of the items, and when the size of the output image changes, the internal item size data is recomputed. As a result, it works best to configure everything once and use the same size destination image for all menu renders. In that case, rendering different menus with one renderer incurs no size-recompute penalty.

Menus are oriented vertically (one item per row) by default. In this case, the number of menu items shown is based upon the computed size of each item and the size of the destination image. For horizontally oriented (one item per column) menus, the maximum number of items to show must be provided in a call to maxVisible(std::uint16_t) before rendering. Each item will take the same amount of space on the destination image.

A scoll bar may be optionally added to the menu by a call to addScrollBar(). By default, the scroll bar will only be present if there are too many menu items to fit in the destination image.

Todo:

Horizontal ordering needs testing; assume broken for now.

Support rendering the selected menu item's description text somewhere.

Author
Jeff Jackowski
Examples:
bppmenu.cpp.

Definition at line 120 of file BppMenuRenderer.hpp.

Member Typedef Documentation

◆ Flags

A type for configuration flags.

Definition at line 134 of file BppMenuRenderer.hpp.

Member Enumeration Documentation

◆ ScrollBarPlacement

Values used to control which edge of the menu will host the scroll bar.

Enumerator
ScrollRight 
ScrollLeft 
ScrollBottom 
ScrollTop 

Definition at line 125 of file BppMenuRenderer.hpp.

Constructor & Destructor Documentation

◆ BppMenuRenderer() [1/3]

duds::ui::menu::renderers::BppMenuRenderer::BppMenuRenderer ( Flags  cfg = Flags::Zero())
inline

Constructs a new menu renderer without a string cache or font.

This can work well for menus that won't render any text, or will be further configured later.

Parameters
cfgThe inital configuration flags.

Definition at line 282 of file BppMenuRenderer.hpp.

◆ BppMenuRenderer() [2/3]

duds::ui::menu::renderers::BppMenuRenderer::BppMenuRenderer ( const duds::ui::graphics::BppStringCacheSptr cachePtr,
Flags  cfg = Flags::Zero() 
)
inline

Constructs a new menu renderer.

Parameters
cachePtrThe cache of rendered strings to use for menu text.
cfgThe inital configuration flags.

Definition at line 288 of file BppMenuRenderer.hpp.

◆ BppMenuRenderer() [3/3]

duds::ui::menu::renderers::BppMenuRenderer::BppMenuRenderer ( const duds::ui::graphics::BppStringCacheSptr cachePtr,
int  vmItems,
Flags  cfg = Flags::Zero() 
)
inline

Constructs a new menu renderer; best for horizontally oriented menus.

Parameters
cachePtrThe cache of rendered strings to use for menu text.
vmItemsThe maximum number of visible menu items. This is only useful if the menu is oriented horizontally.
cfgThe inital configuration flags.

Definition at line 299 of file BppMenuRenderer.hpp.

Member Function Documentation

◆ addScrollBar()

void duds::ui::menu::renderers::BppMenuRenderer::addScrollBar ( std::uint16_t  width = 1,
std::uint16_t  margin = 1,
std::uint16_t  minsize = 4,
ScrollBarPlacement  place = ScrollRight 
)

Adds or replaces a scroll bar on the menu.

The menu only supports a single scroll bar.

Parameters
widthThe width of the indicator, or slider, in pixels.
marginThe width of the border between the indicator and menu item(s).
minsizeThe minimum length of the indicator (slider).
placeThe edge occupied by the scroll bar.
Bug:
The scroll bar will be sized as though menu items that are hidden from view are present on the display.
Examples:
bppmenu.cpp.

Definition at line 45 of file BppMenuRenderer.cpp.

◆ disabledIcon() [1/2]

const duds::ui::graphics::ConstBppImageSptr& duds::ui::menu::renderers::BppMenuRenderer::disabledIcon ( ) const
inline

Returns the currently configured disabled icon image.

Examples:
bppmenu.cpp.

Definition at line 334 of file BppMenuRenderer.hpp.

◆ disabledIcon() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::disabledIcon ( const duds::ui::graphics::ConstBppImageSptr img)
inline

Changes the optional icon used to inform the user that a menu item is currently disabled.

Definition at line 341 of file BppMenuRenderer.hpp.

◆ flags() [1/2]

Flags duds::ui::menu::renderers::BppMenuRenderer::flags ( ) const
inline

Returns the configuration flags for this renderer.

Definition at line 307 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ flags() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::flags ( Flags  cfg)
inline

Changes the configuration flags for this renderer.

Definition at line 313 of file BppMenuRenderer.hpp.

◆ hasScrollBar()

bool duds::ui::menu::renderers::BppMenuRenderer::hasScrollBar ( ) const
inline

Returns true if a scroll bar is in use.

Definition at line 507 of file BppMenuRenderer.hpp.

◆ iconDimensions() [1/2]

const duds::ui::graphics::ImageDimensions& duds::ui::menu::renderers::BppMenuRenderer::iconDimensions ( ) const
inline

Returns the dimensions used for rendering icons stored inside menu items derived from BppIconItem.

Examples:
bppmenu.cpp.

Definition at line 377 of file BppMenuRenderer.hpp.

◆ iconDimensions() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::iconDimensions ( const duds::ui::graphics::ImageDimensions dim)

Sets the dimensions used for rendering icons stored inside menu items derived from BppIconItem.

Use an empty size to prevent icons from being rendered.

Postcondition
If an empty size is used, iconTextMargin will be set to zero.
See also
BppMenuIconItem
GenericBppMenuIconItem

Definition at line 28 of file BppMenuRenderer.cpp.

◆ iconTextMargin() [1/2]

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::iconTextMargin ( ) const
inline

Returns the size of the margin between icons from menu items and the text label of the item.

Examples:
bppmenu.cpp.

Definition at line 393 of file BppMenuRenderer.hpp.

◆ iconTextMargin() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::iconTextMargin ( std::uint16_t  itm)
inline

Sets the size of the margin between icons from menu items and the text label of the item.

See also
BppMenuIconItem
GenericBppMenuIconItem

Definition at line 402 of file BppMenuRenderer.hpp.

◆ itemMargin() [1/2]

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::itemMargin ( ) const
inline

Returns the margin in pixels placed bewteen each menu item.

Definition at line 472 of file BppMenuRenderer.hpp.

◆ itemMargin() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::itemMargin ( std::uint16_t  im)
inline

Changes the margin in pixels placed bewteen each menu item.

Parameters
imThe new margin size.

Definition at line 479 of file BppMenuRenderer.hpp.

◆ maxVisible() [1/2]

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::maxVisible ( ) const
inline

Returns the maximum number of visible items to show on the menu; try to avoid calling.

Precondition
Either the menu is horizontally oriented and maxVisible() has been called, or the menu has already been rendered.
Note
The number of visible items may change for vertically oriented menus if the size of the image used to hold the rendered menu image changes. This update occurs inside recalculateDimensions().
Examples:
bppmenu.cpp.

Definition at line 428 of file BppMenuRenderer.hpp.

◆ maxVisible() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::maxVisible ( std::uint16_t  i)

Sets the maximum number of visible items for horizontally oriented menus.

For vertically oriented menus, this does nothing.

Parameters
iThe number of items to show.

Definition at line 38 of file BppMenuRenderer.cpp.

◆ recalculateDimensions()

void duds::ui::menu::renderers::BppMenuRenderer::recalculateDimensions ( duds::ui::graphics::ImageDimensions  fitDim)
private

Recalculates the dimension values needed to render a menu that fits into the given dimensions.

Parameters
fitDimThe dimensions in which the menu must fit.
Exceptions
BppMenuDestinationTooSmallCurrent settings will not fit the menu item(s) into fitDim.

Definition at line 68 of file BppMenuRenderer.cpp.

Referenced by render().

◆ removeScrollBar()

void duds::ui::menu::renderers::BppMenuRenderer::removeScrollBar ( )

Removes the scroll bar from the menu.

Definition at line 62 of file BppMenuRenderer.cpp.

◆ render() [1/4]

void duds::ui::menu::renderers::BppMenuRenderer::render ( duds::ui::graphics::BppImageSptr dest,
duds::ui::menu::MenuOutputAccess mova 
)

Renders a menu to the given image.

Parameters
destThe destination image. If its size is different than the last image used, or if this is the first time rendering, size data for the menu items and their parts will be recomputed.
movaOutput access to the menu to render.
Exceptions
BppMenuLacksStringCacheThe renderer is configured to show text, but doesn't have the string cache needed to render the text.
BppMenuDestinationTooSmallCurrent settings will not fit the menu item(s) into dest.

Definition at line 188 of file BppMenuRenderer.cpp.

◆ render() [2/4]

void duds::ui::menu::renderers::BppMenuRenderer::render ( duds::ui::graphics::BppImageSptr dest,
duds::ui::menu::MenuOutput mov 
)
inline

Renders a menu to the given image.

Parameters
destThe destination image. If its size is different than the last image used, or if this is the first time rendering, size data for the menu items and their parts will be recomputed.
movThe MenuOutput of the menu to render. An access object to the menu output is made inside this function.
Exceptions
BppMenuLacksStringCacheThe renderer is configured to show text, but doesn't have the string cache needed to render the text.
BppMenuDestinationTooSmallCurrent settings will not fit the menu item(s) into dest.

Definition at line 541 of file BppMenuRenderer.hpp.

◆ render() [3/4]

duds::ui::graphics::BppImageSptr duds::ui::menu::renderers::BppMenuRenderer::render ( const duds::ui::graphics::ImageDimensions dim,
duds::ui::menu::MenuOutputAccess mova 
)
inline

Renders a menu of the given size.

Parameters
dimThe size of the image that will hold the rendered menu. If the size is different than the last size used, or if this is the first time rendering, size data for the menu items and their parts will be recomputed.
movaOutput access to the menu to render.
Returns
An image with the rendered menu.
Exceptions
BppMenuLacksStringCacheThe renderer is configured to show text, but doesn't have the string cache needed to render the text.
BppMenuDestinationTooSmallCurrent settings will not fit the menu item(s) into dest.

Definition at line 562 of file BppMenuRenderer.hpp.

◆ render() [4/4]

duds::ui::graphics::BppImageSptr duds::ui::menu::renderers::BppMenuRenderer::render ( const duds::ui::graphics::ImageDimensions dim,
duds::ui::menu::MenuOutput mov 
)
inline

Renders a menu of the given size.

Parameters
dimThe size of the image that will hold the rendered menu. If the size is different than the last size used, or if this is the first time rendering, size data for the menu items and their parts will be recomputed.
movThe MenuOutput of the menu to render. An access object to the menu output is made inside this function.
Returns
An image with the rendered menu.
Exceptions
BppMenuLacksStringCacheThe renderer is configured to show text, but doesn't have the string cache needed to render the text.
BppMenuDestinationTooSmallCurrent settings will not fit the menu item(s) into dest.

Definition at line 585 of file BppMenuRenderer.hpp.

◆ selectedIcon() [1/2]

const duds::ui::graphics::ConstBppImageSptr& duds::ui::menu::renderers::BppMenuRenderer::selectedIcon ( ) const
inline

Returns the currently set icon used to indicate item selection.

This shows the user which option they are poised to chose.

Definition at line 320 of file BppMenuRenderer.hpp.

◆ selectedIcon() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::selectedIcon ( const duds::ui::graphics::ConstBppImageSptr img)
inline

Changes the optional selection icon used to inform the user what item they have selected and are poised to chose.

Definition at line 327 of file BppMenuRenderer.hpp.

◆ stringCache() [1/2]

const duds::ui::graphics::BppStringCacheSptr& duds::ui::menu::renderers::BppMenuRenderer::stringCache ( ) const
inline

Returns the string cache currently used to render menu item text.

Definition at line 409 of file BppMenuRenderer.hpp.

◆ stringCache() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::stringCache ( const duds::ui::graphics::BppStringCacheSptr sc)
inline

Changes the string cache used to render menu item text.

Definition at line 415 of file BppMenuRenderer.hpp.

◆ toggledOffIcon() [1/2]

const duds::ui::graphics::ConstBppImageSptr& duds::ui::menu::renderers::BppMenuRenderer::toggledOffIcon ( ) const
inline

Returns the icon used to signify a toggle state in the off position.

Examples:
bppmenu.cpp.

Definition at line 348 of file BppMenuRenderer.hpp.

◆ toggledOffIcon() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::toggledOffIcon ( const duds::ui::graphics::ConstBppImageSptr img)
inline

Changes the option icon used to signify a toggle state in the off position.

Definition at line 355 of file BppMenuRenderer.hpp.

◆ toggledOnIcon() [1/2]

const duds::ui::graphics::ConstBppImageSptr& duds::ui::menu::renderers::BppMenuRenderer::toggledOnIcon ( ) const
inline

Returns the icon used to signify a toggle state in the on position.

Examples:
bppmenu.cpp.

Definition at line 362 of file BppMenuRenderer.hpp.

◆ toggledOnIcon() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::toggledOnIcon ( const duds::ui::graphics::ConstBppImageSptr img)
inline

Changes the option icon used to signify a toggle state in the on position.

Definition at line 369 of file BppMenuRenderer.hpp.

◆ valueMargin() [1/2]

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::valueMargin ( ) const
inline

Returns the margin in pixels between a menu item's label text and its value text.

Definition at line 456 of file BppMenuRenderer.hpp.

◆ valueMargin() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::valueMargin ( std::uint16_t  m)
inline

Changes the margin in pixels between a menu item's label text and its value text.

This margin is only used if the value width is non-zero.

Parameters
mThe new margin size.
See also
valueWidth(std::int16_t)

Definition at line 465 of file BppMenuRenderer.hpp.

◆ valueWidth() [1/2]

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::valueWidth ( ) const
inline

Returns the width in pixels of the value column.

Definition at line 440 of file BppMenuRenderer.hpp.

◆ valueWidth() [2/2]

void duds::ui::menu::renderers::BppMenuRenderer::valueWidth ( std::uint16_t  w)
inline

Changes the width in pixels of the value column.

Parameters
wThe new width of the pixels column. If zero, the column will be omitted.

Definition at line 448 of file BppMenuRenderer.hpp.

Member Data Documentation

◆ cache

duds::ui::graphics::BppStringCacheSptr duds::ui::menu::renderers::BppMenuRenderer::cache
private

Pre-rendered strings for menu text.

Definition at line 202 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ Calculated

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::Calculated = Flags::Bit(15)
staticprivate

When set, indicates that internal dimension values have been calculated.

This avoids the need to recalculate them every time the menu is rendered.

Definition at line 173 of file BppMenuRenderer.hpp.

Referenced by addScrollBar(), iconDimensions(), maxVisible(), recalculateDimensions(), removeScrollBar(), and render().

◆ destDim

duds::ui::graphics::ImageDimensions duds::ui::menu::renderers::BppMenuRenderer::destDim
private
Initial value:

Destination dimensions; used to tell when to recompute dimensions of parts of the menu.

Definition at line 215 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ disIcon

duds::ui::graphics::ConstBppImageSptr duds::ui::menu::renderers::BppMenuRenderer::disIcon
private

Icon used to denote a disabled menu item.

Definition at line 190 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ DoNotShowText

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::DoNotShowText = Flags::Bit(6)
static

Only show icons, not text, for the menu items.

This will prevent values, as well as text naming a menu item, from being shown.

Definition at line 163 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ flgs

Flags duds::ui::menu::renderers::BppMenuRenderer::flgs
private

Option flags that modify how the menu is rendered.

Definition at line 225 of file BppMenuRenderer.hpp.

Referenced by addScrollBar(), iconDimensions(), maxVisible(), recalculateDimensions(), removeScrollBar(), and render().

◆ fracshow

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::fracshow
private

The number of pixels to show of a partially visible menu item.

Definition at line 266 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ HorizontalList

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::HorizontalList = Flags::Bit(3)
static

Items are arranged horizontally instead of vertically.

Definition at line 148 of file BppMenuRenderer.hpp.

Referenced by maxVisible(), recalculateDimensions(), and render().

◆ iconDim

duds::ui::graphics::ImageDimensions duds::ui::menu::renderers::BppMenuRenderer::iconDim
private
Initial value:

The size of a menu item's icon.

Definition at line 220 of file BppMenuRenderer.hpp.

Referenced by iconDimensions(), recalculateDimensions(), and render().

◆ iconTxMg

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::iconTxMg = 0
private

Space in pixels to have between icons and text.

Definition at line 250 of file BppMenuRenderer.hpp.

Referenced by iconDimensions(), recalculateDimensions(), and render().

◆ InternalMask

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::InternalMask = Flags(0xFF00)
staticprivate

The second byte (the one next to the least significant byte) is reserved for internal flags.

Definition at line 178 of file BppMenuRenderer.hpp.

◆ InvertSelected

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::InvertSelected = Flags::Bit(4)
static

The selected item will be rendered inverted.

Definition at line 152 of file BppMenuRenderer.hpp.

Referenced by render().

◆ itemDim

duds::ui::graphics::ImageDimensions duds::ui::menu::renderers::BppMenuRenderer::itemDim
private

Computed dimensions of a complete menu item.

Definition at line 206 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ itemMg

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::itemMg = 0
private

The margin in pixels between menu items.

Definition at line 246 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ items

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::items = 0
private

Number of items to display.

Definition at line 258 of file BppMenuRenderer.hpp.

Referenced by maxVisible(), recalculateDimensions(), and render().

◆ posInd

std::unique_ptr<duds::ui::graphics::BppPositionIndicator> duds::ui::menu::renderers::BppMenuRenderer::posInd
private

Optional position indicator to show user location within the menu.

Definition at line 182 of file BppMenuRenderer.hpp.

Referenced by addScrollBar(), recalculateDimensions(), removeScrollBar(), and render().

◆ ScrollBarMask

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::ScrollBarMask = Flags(3)
static

Mask that defines where the ScrollBarPlacement value is put in the configuration flags.

Definition at line 139 of file BppMenuRenderer.hpp.

Referenced by addScrollBar(), recalculateDimensions(), and render().

◆ ScrollBarNeverHides

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::ScrollBarNeverHides = Flags::Bit(2)
static

True to always show the scroll bar.

If not set, the scroll bar will not be shown if the menu fits within the destination image.

Definition at line 144 of file BppMenuRenderer.hpp.

Referenced by render().

◆ ScrollBarShown

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::ScrollBarShown = Flags::Bit(14)
staticprivate

Indicates that the scroll bar was rendered on the previous render call.

Definition at line 168 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), removeScrollBar(), and render().

◆ scrollMg

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::scrollMg = 0
private

Space in pixels to have between label or value text and the scroll bar.

Definition at line 254 of file BppMenuRenderer.hpp.

Referenced by addScrollBar(), recalculateDimensions(), removeScrollBar(), and render().

◆ scrollWidth

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::scrollWidth
private

Thw width of the scroll bar in pixels.

Definition at line 262 of file BppMenuRenderer.hpp.

Referenced by addScrollBar(), recalculateDimensions(), removeScrollBar(), and render().

◆ selDisWidth

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::selDisWidth = 0
private

The maximum width of the selection icon and the disabled icon.

Definition at line 229 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ selIcon

duds::ui::graphics::ConstBppImageSptr duds::ui::menu::renderers::BppMenuRenderer::selIcon
private

Icon used to denote a selected menu item.

Definition at line 186 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ textDim

duds::ui::graphics::ImageDimensions duds::ui::menu::renderers::BppMenuRenderer::textDim
private

The size of a menu item's text.

Definition at line 210 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ toggleWidth

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::toggleWidth = 0
private

The maximum width of the toggle icons.

Definition at line 233 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ togOffIcon

duds::ui::graphics::ConstBppImageSptr duds::ui::menu::renderers::BppMenuRenderer::togOffIcon
private

Icon used to denote a menu item in its toggled off state.

Definition at line 194 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ togOnIcon

duds::ui::graphics::ConstBppImageSptr duds::ui::menu::renderers::BppMenuRenderer::togOnIcon
private

Icon used to denote a menu item in its toggled on state.

Definition at line 198 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ valMg

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::valMg = 0
private

The margin in pixels between the label and value columns,.

Definition at line 242 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().

◆ ValueRightJustified

constexpr BppMenuRenderer::Flags duds::ui::menu::renderers::BppMenuRenderer::ValueRightJustified = Flags::Bit(5)
static

Right justify value text when values are placed in a column separate from the item label.

If the value column width is zero or not provided, this flag will have no effect.

Definition at line 158 of file BppMenuRenderer.hpp.

Referenced by render().

◆ valWidth

std::uint16_t duds::ui::menu::renderers::BppMenuRenderer::valWidth = 0
private

The width of the value column.

If zero, the value will be combined with the item label and will not have its own column.

Definition at line 238 of file BppMenuRenderer.hpp.

Referenced by recalculateDimensions(), and render().


The documentation for this class was generated from the following files: