Card.hpp

Wraps a Bootstrap card.

class Card : public Div
#include <Card.hpp>

Use Card class to create Bootstrap style cards.

Subclassed by ReadoutPanel

Public Functions

inline Card(const std::string &state = "STATIC", const bool &show_glyphs = true, const std::string &id = "")
Parameters:
  • state – indicate whether card should be STATIC, INIT_OPEN, or INIT_CLOSED (default STATIC)

  • show_glyphs – should toggle icons show in collapsible card header? (default true)

  • id – user defined ID for card Div, (default emscripten generated)

template<typename T>
inline void AddHeaderContent(T val, const bool link_content = false)

Add content to header section of card.

Parameters:
  • val – content to be added to header, can be a web element or primitive type

  • link_content – indicates whether the content should have Bootstrap link properties (default false)

template<typename T>
inline void AddBodyContent(T val)

Add content to body section of card.

Deprecated:

Use stream operator instead

Parameters:

val – can be a web element or primitive type

template<typename IN_TYPE>
inline Card &operator<<(IN_TYPE &&in_val)

Add content to the body section of the card.

Parameters:

in_val – can be a web element or primitive type

inline void SetOnToggle(on_toggle_fun_t on_toggle)

Sets the on-toggle function for this component.

Parameters:

on_toggle – the function to be called whenever the card’s state is toggled open or closed

inline on_toggle_fun_t &GetOnToggle()

Get the on-toggle function for this component.

Returns:

the function to be called whenever the card’s state is toggled open or closed

Protected Functions

inline void AddBootstrap()
inline Card(const std::string &state, const bool &show_glyphs, internal::CardInfo *in_info)

A protected constructor for a Card.

Parameters:
  • state – indicate whether card should be STATIC, INIT_OPEN, or INIT_CLOSED (default STATIC)

  • show_glyphs – should toggle icons show in collapsible card header? (default true)

  • in_info – a pointer to the underlying ReadoutPanelInfo object for this ReadoutPanel or a pointer to a derived info object (simulating inheritance)

Protected Attributes

std::string card_base = this->GetID()
Div card_header = {to_string(card_base, "_card_header")}
Div card_body = {to_string(card_base, "_card_body")}

Private Types

using on_toggle_fun_t = internal::CardInfo::on_toggle_fun_t

Private Functions

inline internal::CardInfo *Info()

Get shared info pointer, cast to Card-specific type.

Returns:

cast pointer

inline const internal::CardInfo *Info() const

Get shared info pointer, cast to const Card-specific type.

Returns:

cast pointer