NAME
Term::Fabulous::ThemeEditor::SettingsList - The table of settings in the theme editor's form
DESCRIPTION
Part of Term::Fabulous::ThemeEditor; not meant to be used on its own. A tree of rows in sections, each row showing a swatch, the setting (indented, sections with a marker), its value and where the value comes from, under a row of titles. Only the rows near the viewport are widgets, inside a Term::Fabulous::Widget::VirtualList, so the list costs the same with every section open. The rows, which sections are open, the search, the filters and the cursor are kept in a Term::Fabulous::Widget::Table::Model (with open_when_filtered and only_leaves_match): a search or a filter shows the settings it lets through with their sections open, and a section never matches by itself. The rows are painted in the colors of the theme's table family: the cursor in table.cursor (table.selected while the list does not have the focus), the row under the pointer in table.hover, sections in table.group.text on table.group.background, settings the theme does not set in table.muted. A text too long for its column ends in ~; the columns keep their places whatever the list shows.
Keys while the list has the focus: Up, Down, PageUp, PageDown, Home, End move the cursor; Right or + opens a section (on an open one, Right goes to its first row); Left or - closes a section, or goes to the section above a row; Enter or Space opens or closes a section and edits a setting. A click puts the cursor on a row, a click on a section's marker opens or closes it, a double click activates a row, the wheel scrolls.
CONSTRUCTOR
new
my $list = Term::Fabulous::ThemeEditor::SettingsList->new(
id => 'settings',
on_activate => sub ($id) { ... }, # Enter or a double click on a setting
on_cursor => sub ($id) { ... }, # the cursor moved
);
METHODS
rows
Replaces all rows: hashes with id, setting, value, origin, swatch (glyphs), color (the swatch's color), set, and for a section section => 1 with its rows under children.
row, has_row, row_ids, parent_of, children_of, update_row, refresh
Reading the rows (row gives a copy of a row's data without its children; parent_of, children_of and row give nothing for an unknown id), changing one's texts, and showing the rows again after such changes (a search or a filter may take other rows then).
expand, collapse, toggle, expand_all, collapse_all, is_expanded
Opening and closing sections.
search, filter, filtered_row_ids
The search text (rows whose setting, value, origin or id hold it, in any case, with their sections), named filters (code that gets a row), and the ids of the rows shown.
cursor, cursor_index
The row under the cursor; setting it opens the sections above the row and scrolls it into view, and dies for a row a search or a filter hides. When a change hides the row under the cursor, the cursor goes to the first row shown.
activate, click, hover
What Enter, a click and the pointer do to a row. click( $index, $column, $click_count ) takes the click's place in a run of quick clicks ("click_count" in Term::Fabulous::Event::Mouse, default 1); the second click of a double click on the same row activates it.
shown_count, shown_row, hover_index, value_columns
What the rows paint from.
SEE ALSO
Term::Fabulous::ThemeEditor, Term::Fabulous::ThemeEditor::Form, Term::Fabulous::Widget::VirtualList.