Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
cadran::List Class Reference

#include <aurore/cadran/ui/cadran_list.hpp>

Public Member Functions

 List (aurore::View *tab, bool sub_screen=false)
 
 List (aurore::View *screen, aurore::Box *column)
 
aurore::Box * content () const
 The column of lines (nullptr when the tab has none).
 
aurore::Box * tiles (const std::vector< std::pair< const char *, const char * > > &cells, bool status)
 
void state (const char *id, const char *color_key)
 
void tag (const char *id, const std::string &text, bool warn, const std::string &note="")
 
aurore::Box * head (const char *id) const
 
Card * wrap (const char *id)
 Puts this line (not a cell: a box of text) in a card of its own.
 
void apply (const std::vector< std::pair< const char *, const char * > > &icons)
 
Card * card_of (const char *id) const
 The card holding this cell (after apply()).
 
void sync ()
 

Static Public Member Functions

static void section (aurore::Header *header)
 
static void row (aurore::DetailCell *cell, const char *icon=nullptr, bool alone=false)
 
static void row_image (aurore::DetailCell *cell, const std::string &image)
 
static void row_swatch (aurore::DetailCell *cell, const CadranSwatch::Colors &colors)
 The same with a swatch of colours in its icon's place (CadranSwatch).
 
static void recolor_icon (aurore::DetailCell *cell, const char *icon, const char *color_key, const char *square_key=nullptr)
 
static aurore::Box * rows_in (aurore::Box *list)
 

Detailed Description

The Cadran look of a list screen built as usual: its headers as kickers, its cells in cards with icons, chevrons and switches, a few cells as tiles.

Constructor & Destructor Documentation

◆ List() [1/2]

cadran::List::List ( aurore::View *  tab,
bool  sub_screen = false 
)
explicit

A screen inflated from one of the list XMLs (a ScrollView and its column): a tab (sub_screen false: the rail at its left) or a screen of its own (wider margins).

◆ List() [2/2]

cadran::List::List ( aurore::View *  screen,
aurore::Box *  column 
)

A column built by its screen's own code (column, under screen, whose ids it looks up), its padding left as it is: a list rebuilt as its entries change dresses each new column before showing it.

Member Function Documentation

◆ apply()

void cadran::List::apply ( const std::vector< std::pair< const char *, const char * > > &  icons)

Restyles every other line; icons: cell id -> icon name. A line that opens a screen keeps the app's own "›" at the end of its value.

◆ card_of()

Card * cadran::List::card_of ( const char *  id) const

The card holding this cell (after apply()).

◆ content()

aurore::Box * cadran::List::content ( ) const
inline

The column of lines (nullptr when the tab has none).

◆ head()

aurore::Box * cadran::List::head ( const char *  id) const

A tile's head (its icon's row, an action tile's title in it too), for a sign at its far end (RowIcon, TabBadge): the tile's corner, not under its value.

◆ recolor_icon()

static void cadran::List::recolor_icon ( aurore::DetailCell *  cell,
const char *  icon,
const char *  color_key,
const char *  square_key = nullptr 
)
static

A row's icon (row()'s, at its start) changed: another icon (nullptr: the same), in color_key, on square_key (nullptr: the usual square).

◆ row()

static void cadran::List::row ( aurore::DetailCell *  cell,
const char *  icon = nullptr,
bool  alone = false 
)
static

◆ row_image()

static void cadran::List::row_image ( aurore::DetailCell *  cell,
const std::string &  image 
)
static

The same with a picture in its icon's place (a resource, "img/…png": a language's flag), drawn as it is, without the square.

◆ row_swatch()

static void cadran::List::row_swatch ( aurore::DetailCell *  cell,
const CadranSwatch::Colors &  colors 
)
static

The same with a swatch of colours in its icon's place (CadranSwatch).

◆ rows_in()

static aurore::Box * cadran::List::rows_in ( aurore::Box *  list)
static

The box a screen's rows go in: a card in list (made the first time). The screen clears and fills that one.

◆ section()

static void cadran::List::section ( aurore::Header *  header)
static

For the lists a screen fills itself (its own code finds its lines where it put them, so nothing is moved): a section title, and a cell as a row of a card (apply()'s own), or as a card of its own (alone).

◆ state()

void cadran::List::state ( const char *  id,
const char *  color_key 
)

A status tile's state beside its value, by its shape and colour as Today's pills: "cadran/teal_fill" a check (as it should be), "cadran/amber_fill" a warning (needs the user); nullptr: none.

◆ sync()

void cadran::List::sync ( )

After the tab's refresh(): the headers' titles in capitals again (a tab may set them, e.g. About's "What's new in …"), and a status tile's plain value in the text colour (its warnings keep theirs).

◆ tag()

void cadran::List::tag ( const char *  id,
const std::string &  text,
bool  warn,
const std::string &  note = "" 
)

A status tile's pill under its value ("23.0.1 available"; empty: none): in amber on its amber ground, the tile outlined in amber, when warn (something to do), else in the calm pill colours ("Up to date"); and note under it, smaller ("2 versions behind"; empty: none), in amber when warn. A note without a pill stands alone.

◆ tiles()

aurore::Box * cadran::List::tiles ( const std::vector< std::pair< const char *, const char * > > &  cells,
bool  status 
)

Turns these cells (direct lines of the column) into tiles on one row, where the first one was: status tiles show a reading (title small, value large, no chevron), the others an action (icon then title on one line, its words on the next, each smaller rather than on two). Before apply(). Returns the row.

◆ wrap()

Card * cadran::List::wrap ( const char *  id)

Puts this line (not a cell: a box of text) in a card of its own.


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