ReadoutPanel.hpp
UI framework for live statistic readouts.
-
class ReadoutPanel : public Card
- #include <ReadoutPanel.hpp>
Use a ReadoutPanel to display a collection of related live values in a Card.
Public Functions
-
inline ReadoutPanel(const std::string &group_name, const double refresh_milliseconds = 250, const std::string &state = "INIT_OPEN", const bool &show_glyphs = true, const std::string &id = "")
- Parameters:
group_name – name for this collection of values, displayed in card header
refresh_milliseconds – the time in milliseconds between refreshes to the live values
state – initial state of the card, one of STAITC, INIT_OPEN, or INIT_CLOSED
show_glyphs – whether the underlying card should show toggle icons in card header
id – a user defined ID for ReadoutPanel div (default is emscripten generated)
-
template<typename VALUE_TYPE>
inline ReadoutPanel &AddValue(const std::string &name, const std::string &desc, VALUE_TYPE &&value) Adds a LiveValueDisplay to this component and adds the value’s parent div to a list of divs to be redrawn at the refresh rate.
- Parameters:
name – the name for this value.
desc – a description for this value.
value – a function that will return the string for this value.
- Returns:
the readout panel for chaining calls
-
template<typename VALUE_TYPE, typename ...OTHER_VALUES>
inline ReadoutPanel &AddValues(const std::string &name, const std::string &desc, VALUE_TYPE &&value, OTHER_VALUES&&... others) A version of AddValue that can take multiple name, description, value tuples for ease of use when adding lots of values.
-
inline ReadoutPanel &AddValues()
Protected Functions
-
inline ReadoutPanel(const std::string &group_name, double refresh_milliseconds, const std::string &state, const bool &show_glyphs, internal::ReadoutPanelInfo *in_info)
A protected constructor for a ReadoutPanel which sets up the necessary structures for it to function. All other constructors should delegate to this one first before causing subsequent modifications.
- Parameters:
group_name – name for this collection of values, displayed in card header
refresh_milliseconds – the minimum time in milliseconds between refreshes to the live values
state – initial state of the card, one of STATIC, INIT_OPEN, or INIT_CLOSED
show_glyphs – whether the underlying card should show toggle icons in card header
in_info – a pointer to the underlying ReadoutPanelInfo object for this ReadoutPanel or a pointer to a derived info object (simulating inheritance)
Protected Static Functions
Private Functions
-
inline internal::ReadoutPanelInfo *Info()
Get shared info pointer, cast to ReadoutPanel-specific type. Necessary to access info’s list of live divs.
- Returns:
cast pointer
-
inline const internal::ReadoutPanelInfo *Info() const
Get shared info pointer, cast to const ReadoutPanel-specific type. Necessary to access info’s list of live divs.
- Returns:
cast pointer
-
inline ReadoutPanel(const std::string &group_name, const double refresh_milliseconds = 250, const std::string &state = "INIT_OPEN", const bool &show_glyphs = true, const std::string &id = "")