![]() |
The ZX Ecosystem v5.1.0;_GUI_v3.1.0
|
This module provides general definitions for the ZXEcosystem GUI.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Namespaces | |
namespace | zxeco |
The main namespace of the library, that spans across all the zx modules. | |
namespace | zxeco::gui |
The namespace of the GUI companion sub-library. | |
Classes | |
struct | zxeco::gui::WinColors |
Colors used in a GUI window. More... | |
class | zxeco::gui::TypingZone |
A zone of a widget where the user can type. More... | |
class | zxeco::gui::Label |
A non-empty label for a widget. More... | |
class | zxeco::gui::LabelList |
A list of labels to be displayed vertically, with possible marks on them. More... | |
class | zxeco::gui::LabelList::Iterator |
Bidirectional iterator to scan indexes in the list under a given view. More... | |
class | zxeco::gui::LabelList::IndsRange |
A range of indexes covering some part of the list. More... | |
class | zxeco::gui::LabelTree |
A tree of labels based on LabelList. More... | |
class | zxeco::gui::LabelTree::DepthFirstInserter |
Inserter of elements into the tree structure. More... | |
class | zxeco::gui::LabelDirBrowser |
A tree of labels that correspond to the entries in a directory tree. More... | |
Macros | |
#define | ZXGUIVER "3.0.0" |
Version of the GUI sublibrary. More... | |
struct zxeco::gui::WinColors |
Colors used in a GUI window.
Definition at line 52 of file ZXGUIGeneral.h.
Static Public Attributes | |
static const WinColors | kLight |
Colors for light background, with bright. More... | |
static const WinColors | kDark |
Colors for dark background, with bright. More... | |
Public Attributes | |
AttrColors | title |
For paper, ink, bright of title (flash ignored) More... | |
BrightColor | backpaper |
For the background paper and bright. More... | |
BasicColor | mainink |
For the ink of main enabled elements. More... | |
BasicColor | maindisink |
For the ink of main disabled elements. More... | |
BasicColor | decink |
For the ink of enabled decorations. More... | |
BasicColor | decdisink |
For the ink of disabled decorations. More... | |
BrightColor | typingpaper |
For the paper of typing areas. More... | |
BrightColor | typingdispaper |
For the paper of disabled typing areas. More... | |
BrightColor | typingmarkpaper |
For marking some part of the typing areas. More... | |
AttrColors | cursor |
For a cursor marking something. More... | |
AttrColors | tooltip |
Colors for the tooltip. More... | |
Public Member Functions | |
uint8_t | attrForBackground (void) const |
< Return an attribute suitable for filling a background attrmap. More... | |
void | setTitleColorsFor (Screen &scr, bool forborder=false) const |
< Put the title colors in SCR. More... | |
void | setBackgroundColorsFor (Screen &scr) const |
< Put the background colors in SCR. More... | |
void | setMainColorsFor (Screen &scr, bool enabled) const |
< Put the main colors in SCR. More... | |
void | setDecorColorsFor (Screen &scr, bool enabled) const |
< Put the decorations colors in SCR. More... | |
void | setTypingColorsFor (Screen &scr, bool enabled) const |
< Put the colors for a typing area in SCR. More... | |
void | setCursorColorsFor (Screen &scr) const |
< Put the cursor colors in SCR. More... | |
std::string | to_string (void) const |
< Return textual information about the colors. More... | |
|
inline |
< Return an attribute suitable for filling a background attrmap.
Definition at line 72 of file ZXGUIGeneral.h.
|
inline |
< Put the title colors in SCR.
Definition at line 77 of file ZXGUIGeneral.h.
|
inline |
< Put the background colors in SCR.
Definition at line 84 of file ZXGUIGeneral.h.
|
inline |
< Put the main colors in SCR.
Definition at line 90 of file ZXGUIGeneral.h.
|
inline |
< Put the decorations colors in SCR.
Definition at line 97 of file ZXGUIGeneral.h.
|
inline |
< Put the colors for a typing area in SCR.
Definition at line 104 of file ZXGUIGeneral.h.
|
inline |
< Put the cursor colors in SCR.
Definition at line 111 of file ZXGUIGeneral.h.
|
inline |
< Return textual information about the colors.
Definition at line 116 of file ZXGUIGeneral.h.
|
static |
Colors for light background, with bright.
Definition at line 55 of file ZXGUIGeneral.h.
|
static |
Colors for dark background, with bright.
Definition at line 56 of file ZXGUIGeneral.h.
AttrColors zxeco::gui::WinColors::title |
For paper, ink, bright of title (flash ignored)
Definition at line 59 of file ZXGUIGeneral.h.
BrightColor zxeco::gui::WinColors::backpaper |
For the background paper and bright.
Definition at line 60 of file ZXGUIGeneral.h.
BasicColor zxeco::gui::WinColors::mainink |
For the ink of main enabled elements.
Definition at line 61 of file ZXGUIGeneral.h.
BasicColor zxeco::gui::WinColors::maindisink |
For the ink of main disabled elements.
Definition at line 62 of file ZXGUIGeneral.h.
BasicColor zxeco::gui::WinColors::decink |
For the ink of enabled decorations.
Definition at line 63 of file ZXGUIGeneral.h.
BasicColor zxeco::gui::WinColors::decdisink |
For the ink of disabled decorations.
Definition at line 64 of file ZXGUIGeneral.h.
BrightColor zxeco::gui::WinColors::typingpaper |
For the paper of typing areas.
Definition at line 65 of file ZXGUIGeneral.h.
BrightColor zxeco::gui::WinColors::typingdispaper |
For the paper of disabled typing areas.
Definition at line 66 of file ZXGUIGeneral.h.
BrightColor zxeco::gui::WinColors::typingmarkpaper |
For marking some part of the typing areas.
Definition at line 67 of file ZXGUIGeneral.h.
AttrColors zxeco::gui::WinColors::cursor |
For a cursor marking something.
Definition at line 68 of file ZXGUIGeneral.h.
AttrColors zxeco::gui::WinColors::tooltip |
Colors for the tooltip.
Definition at line 69 of file ZXGUIGeneral.h.
class zxeco::gui::TypingZone |
A zone of a widget where the user can type.
Definition at line 144 of file ZXGUIGeneral.h.
Public Member Functions | |
TypingZone (void) | |
Default constructor. More... | |
void | set (const CharRect &zone) noexcept |
Change current typing zone. More... | |
const CharRect & | get (void) const noexcept |
Return the current typing zone (updated by derived classes). More... | |
void | move (IntDist xdiff, IntDist ydiff) noexcept |
< Shift typing zone. More... | |
void | clear (Screen &globscr, const WinColors &wincols, bool enabled) |
Draw an empty typing zone in the current zone within GLOBSCR. | |
|
inline |
Default constructor.
Definition at line 148 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Change current typing zone.
Definition at line 151 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Return the current typing zone (updated by derived classes).
Definition at line 154 of file ZXGUIGeneral.h.
< Shift typing zone.
Definition at line 157 of file ZXGUIGeneral.h.
class zxeco::gui::Label |
A non-empty label for a widget.
A label can contain colour controls but not location controls.
Definition at line 178 of file ZXGUIGeneral.h.
Public Types | |
using | Vector = std::vector< Label > |
A vector of labels. More... | |
Public Member Functions | |
Label (void) | |
Default constructor: empty label. More... | |
Label (const std::string &initlabel) | |
Constructor from string. More... | |
Label (const char *initlabel) | |
Constructor from char array. More... | |
void | set (const std::string &label) |
Set the label text to LABEL. More... | |
void | set (const char *label) |
Set the label text to LABEL. More... | |
const std::string & | get (void) const noexcept |
Get the current label text. More... | |
using zxeco::gui::Label::Vector = std::vector<Label> |
A vector of labels.
Definition at line 183 of file ZXGUIGeneral.h.
|
inline |
Default constructor: empty label.
Definition at line 186 of file ZXGUIGeneral.h.
|
inline |
Constructor from string.
Definition at line 189 of file ZXGUIGeneral.h.
|
inline |
Constructor from char array.
Definition at line 192 of file ZXGUIGeneral.h.
void zxeco::gui::Label::set | ( | const std::string & | label | ) |
Set the label text to LABEL.
If empty, throw.
void zxeco::gui::Label::set | ( | const char * | label | ) |
Set the label text to LABEL.
If nullptr or empty, throw.
|
inlinenoexcept |
Get the current label text.
Definition at line 203 of file ZXGUIGeneral.h.
class zxeco::gui::LabelList |
A list of labels to be displayed vertically, with possible marks on them.
< Each label has a number of independent, associated marks equal to the character length of the constructor parameter MARKINMULTIPS. Each char in that string indicates whether that marking allows for multiple selection ('M'), or single selection ('S') or no selection ('N'). In multiple selection, any number of marks can be set or unset. In simple selection, either no mark is set or only one is set. In no selection, no mark can be set. The labels can be set as visible or not, independently from their marks. These lists can refer to other lists, with unlimited recursion length, although accesses to their elements will be slower as longer that length (linearly).
Definition at line 230 of file ZXGUIGeneral.h.
Public Types | |
using | Observer = std::function< void(char)> |
using | Indexes = std::vector< size_t > |
A set of unique absolute indexes on the list. More... | |
Static Public Attributes | |
static const Observer | kNullObserver |
An observer that does nothing. More... | |
Public Attributes | |
const std::string | kMarkingMultips |
Multiple selection mode of markings. More... | |
const size_t | kNumOfMarkings |
Number of independent markings for labels. More... | |
Public Member Functions | |
LabelList (const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor: empty list and marks. More... | |
LabelList (LabelList &oth, size_t begin, size_t length, const Observer &obs=kNullObserver) noexcept | |
Constructor: sublist taken from indexes [begin,begin+length) from OTH. More... | |
LabelList (const Label::Vector &labels, const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor from a vector of labels. | |
LabelList (const LabelList &oth) | |
LabelList (LabelList &&oth) | |
Move constructor eaves OTH in undefined state if OTH has no ownership. | |
LabelList & | operator= (const LabelList &oth) |
LabelList & | operator= (LabelList &&oth) |
Move copy leaves OTH in undefined state if OTH has no ownership. | |
virtual | ~LabelList (void) |
Destructor. More... | |
virtual LabelList * | clone (void) const |
Clone operation for being overriden in derived classes to return them. More... | |
void | checkMarking (unsigned marking) const |
If the given marking is not valid for the current list, throw. | |
void | checkIndex (size_t who) const |
If the given index is not valid in the current list, throw. | |
size_t | size (void) const noexcept |
Return the current number of labels in the list, either visible or not. More... | |
bool | empty (void) const noexcept |
Return TRUE if the list is empty (O(1)). More... | |
CharArea | areaForEntireList (void) const |
Return the area in chars that the visible items of the list would occpy. More... | |
const Observer & | observer (void) const noexcept |
Return a reference to the current observer. More... | |
void | changeObserver (const Observer &obs) |
Change the current observer by OBS. More... | |
Iterator | begin (uint8_t conditions=Iterator::IT_ALL, unsigned marking=0) const |
Return an iterator to iterate in that fashion, pointing to beginning. More... | |
Iterator | end (void) const |
Return an iterator pointing to the end of the list. More... | |
size_t | sizeByIterator (Iterator it) const noexcept |
Return the current number of labels in the list that satisfy IT conds. More... | |
size_t | longestLabel (Iterator it) const noexcept |
Return the maximum number of chars of any label scanned by IT, or 0. More... | |
virtual std::string | labelText (size_t who) const |
Return a copy of the text of the WHO-th label. More... | |
Label & | label (size_t who) |
Return a reference to a modifiable label of the list. More... | |
bool | marked (size_t who, unsigned marking=0) const |
Return the marked state of label WHO in marking MARKING. More... | |
bool | visible (size_t who) const |
Return TRUE if that label is currently visible. | |
LabelList | sublist (const Indexes &inds) const |
Return the given sublist as a copy of the elements of this one. More... | |
bool | mark (size_t who, unsigned marking=0) |
Mark the WHO-th label, according to the mode of marks. More... | |
bool | markAll (unsigned marking=0) |
Mark all labels in marking or do nothing if the multiplicity forbids. More... | |
bool | unmark (size_t who, unsigned marking=0) |
Unmark the WHO-th label. More... | |
bool | unmarkAll (unsigned marking=0) |
Unmark all labels at marking MARKING. More... | |
void | toggle (size_t who, unsigned marking=0) |
Toggle the mark of WHO according to the mode of selections. More... | |
void | toggleAll (unsigned marking=0) |
Like toggle on all marks. More... | |
virtual void | setVisible (size_t who) |
Set that element to visible. More... | |
virtual void | setInvisible (size_t who) |
Set that element to invisible. More... | |
virtual void | toggleVisible (size_t who) |
Toggle visibility of the label WHO. More... | |
virtual void | clear (void) |
Clear the content of the entire list, markings and visibilities. More... | |
size_t | push_back (const Label &l) |
Insert an unmarked, visible label at the end of the list. More... | |
void | push_back (const Label::Vector &v) |
virtual size_t | insert (const Label &l, size_t beforewho) |
Insert an unmarked, visible label before the given element. More... | |
void | insert (const Label::Vector &v, size_t beforewho) |
virtual void | erase (size_t who) |
Erase the given element and its marks. More... | |
bool | eraseMarked (unsigned marking=0) |
Erase all elements marked in the given marking. Return TRUE if any. More... | |
void | append (const LabelList &oth) |
Append a copy of OTH to this. | |
void | append (LabelList &&oth) |
Move the content of OTH to the end of this. | |
virtual void | sort (char mode='A', std::vector< size_t > *order=nullptr) |
Sort all elements in the list, unregarding marks and visibility. More... | |
void | fillWithFiles (const std::filesystem::path &path={}, char mode='T', bool onlyfiles=false, std::vector< std::string > *entries=nullptr) |
Clear the list and fill it with the files and folders in PATH. More... | |
virtual std::string | to_string (void) const |
Return a (potentially long) text with all entries of the list and mrkrs. More... | |
Protected Types | |
using | Marks = std::vector< bool > |
Marks that can be associated to labels in a given marking. More... | |
Protected Member Functions | |
void | copyFrom (const LabelList &oth) |
void | moveFrom (LabelList &&oth) |
Protected Attributes | |
Observer | obs_ |
bool | owner_ |
Label::Vector | labels_ |
std::vector< Marks > | markings_ |
Marks | visible_ |
LabelList * | sect_ |
IndsRange | sectrange_ |
using zxeco::gui::LabelList::Observer = std::function<void(char)> |
char | indicates the reason for calling the observer: 'm' -> change in marking of labels 'c' -> change in content of list 'v' -> change in visibility of labels |
Definition at line 234 of file ZXGUIGeneral.h.
using zxeco::gui::LabelList::Indexes = std::vector<size_t> |
A set of unique absolute indexes on the list.
Definition at line 241 of file ZXGUIGeneral.h.
|
protected |
Marks that can be associated to labels in a given marking.
Definition at line 676 of file ZXGUIGeneral.h.
zxeco::gui::LabelList::LabelList | ( | const std::string & | markingmultips, |
const Observer & | obs = kNullObserver |
||
) |
Constructor: empty list and marks.
Observer will be called every time a method call in this class modifies the list or marks.
|
noexcept |
Constructor: sublist taken from indexes [begin,begin+length) from OTH.
If the range is out of the possibilities of OTH, it is automatically adjusted for fitting OTH. It will be adjusted automatically further on as elements are erased or inserted in the list.
|
inlinevirtual |
Destructor.
In case of the list being supported by another, it does not clear it.
Definition at line 412 of file ZXGUIGeneral.h.
|
inlinevirtual |
Clone operation for being overriden in derived classes to return them.
Reimplemented in zxeco::gui::LabelTree, and zxeco::gui::LabelDirBrowser.
Definition at line 415 of file ZXGUIGeneral.h.
|
noexcept |
Return the current number of labels in the list, either visible or not.
This is O(1). If the list refers to another list, this size will count only the currently covered elements, according to the initially established range of indexes, in the supporting list.
|
inlinenoexcept |
Return TRUE if the list is empty (O(1)).
Definition at line 431 of file ZXGUIGeneral.h.
CharArea zxeco::gui::LabelList::areaForEntireList | ( | void | ) | const |
Return the area in chars that the visible items of the list would occpy.
This method calls longestLabel() to get the width of the area. The returned area is the one needed if the list would be to be printed entirely in both dimensions.
|
inlinenoexcept |
Return a reference to the current observer.
Definition at line 440 of file ZXGUIGeneral.h.
|
inline |
Change the current observer by OBS.
If this is a list referring to another supporting one, the observer of the other will be called (possibly several times) each time a modifica- tion is done in this list, and then the observer of this list will be called once.
Definition at line 443 of file ZXGUIGeneral.h.
Iterator zxeco::gui::LabelList::begin | ( | uint8_t | conditions = Iterator::IT_ALL , |
unsigned | marking = 0 |
||
) | const |
Return an iterator to iterate in that fashion, pointing to beginning.
If no elements in the list that satisfy the conditions, return end().
|
inline |
Return an iterator pointing to the end of the list.
Definition at line 455 of file ZXGUIGeneral.h.
|
noexcept |
|
noexcept |
Return the maximum number of chars of any label scanned by IT, or 0.
Consider labels begining by the one iterated by IT and after end(). This method deals with the labelText() of the appropriate class, either this one or a derived one in case of overriding.
|
virtual |
Return a copy of the text of the WHO-th label.
Derived classes may modify the text, and that modified result will be the one used by longestLabel() and areaForList().
Reimplemented in zxeco::gui::LabelTree.
Label & zxeco::gui::LabelList::label | ( | size_t | who | ) |
Return a reference to a modifiable label of the list.
Use the labelText() method if you only need to read the label text, since the list may return in labelText() a modified version of the string in some cases.
bool zxeco::gui::LabelList::marked | ( | size_t | who, |
unsigned | marking = 0 |
||
) | const |
Return the marked state of label WHO in marking MARKING.
Recall that in 'N' mode, all marks will be false.
Return the given sublist as a copy of the elements of this one.
The observer in the sublist is the null one. All indexes are copied in the sublist, even if they are repeated (then they will appear more than once in the result).
bool zxeco::gui::LabelList::mark | ( | size_t | who, |
unsigned | marking = 0 |
||
) |
Mark the WHO-th label, according to the mode of marks.
Return TRUE if some mark has effectively changed. Consider both visible and invisible labels.
bool zxeco::gui::LabelList::markAll | ( | unsigned | marking = 0 | ) |
Mark all labels in marking or do nothing if the multiplicity forbids.
Consider both visible and invisible labels.
bool zxeco::gui::LabelList::unmark | ( | size_t | who, |
unsigned | marking = 0 |
||
) |
Unmark the WHO-th label.
Return TRUE if some mark has effectively changed. Consider both visible and invisible labels.
bool zxeco::gui::LabelList::unmarkAll | ( | unsigned | marking = 0 | ) |
Unmark all labels at marking MARKING.
Return TRUE if some mark has effectively changed. Consider both visible and invisible labels.
void zxeco::gui::LabelList::toggle | ( | size_t | who, |
unsigned | marking = 0 |
||
) |
Toggle the mark of WHO according to the mode of selections.
Consider both visible and invisible labels.
void zxeco::gui::LabelList::toggleAll | ( | unsigned | marking = 0 | ) |
Like toggle on all marks.
Consider both visible and invisible labels.
|
virtual |
Set that element to visible.
Reimplemented in zxeco::gui::LabelTree.
|
virtual |
Set that element to invisible.
Reimplemented in zxeco::gui::LabelTree.
|
virtual |
Toggle visibility of the label WHO.
Reimplemented in zxeco::gui::LabelTree.
|
virtual |
Clear the content of the entire list, markings and visibilities.
Reimplemented in zxeco::gui::LabelDirBrowser, and zxeco::gui::LabelTree.
|
inline |
Insert an unmarked, visible label at the end of the list.
Return the position where the label has been inserted. If this is a list that refers to another, supporting one, the element will be inserted at the end of its section in the supporting one. Note that the insert() method called by this one is the one of the derived class, if the object is not a plain instance of LabelList.
Definition at line 536 of file ZXGUIGeneral.h.
|
inline |
v | Insert all labels in V at the end of the list, as unmarked, visible. |
Definition at line 543 of file ZXGUIGeneral.h.
|
virtual |
Insert an unmarked, visible label before the given element.
Consider both visible and invisible labels. Return the position where the label has been inserted (which will always be BEFOREWHO).
Reimplemented in zxeco::gui::LabelTree.
|
inline |
beforewho | Insert all labels in V before the given position. |
Definition at line 552 of file ZXGUIGeneral.h.
|
virtual |
Erase the given element and its marks.
Consider both visible and invisible labels. Note that this modifes the size of the labels list and therefore their indexes.
Reimplemented in zxeco::gui::LabelTree.
bool zxeco::gui::LabelList::eraseMarked | ( | unsigned | marking = 0 | ) |
Erase all elements marked in the given marking. Return TRUE if any.
Consider both visible and invisible labels. Internally, use erase() to erase each individual label.
|
virtual |
Sort all elements in the list, unregarding marks and visibility.
mode | indicates the mode: 'A'-> alphabetical increasing, 'D'-> alphabetical decreasing. |
order | if not null will be filled with a vector of indexes in the label list that indicate the order established on the previously unordered list. |
Reimplemented in zxeco::gui::LabelTree.
void zxeco::gui::LabelList::fillWithFiles | ( | const std::filesystem::path & | path = {} , |
char | mode = 'T' , |
||
bool | onlyfiles = false , |
||
std::vector< std::string > * | entries = nullptr |
||
) |
Clear the list and fill it with the files and folders in PATH.
If the path is left empty, the current path will be used. Only regular files and directories are included in the list. The list is ordered alphabetically increasing, case insensitive, directories first.
mode | is the mode in which the different types of entries are filled in the list: 'T' -> directories are preffixed with '/' while files are not. |
onlyfiles | indicates (TRUE) if filling only with files, or (FALSE) with files and directories. |
entries | if not nullptr will be set to a vector with the directory entries corresponding to the filled list; each entry is a string that begins with a letter indicating the type of entry ('D' -> direc- tory, 'P' -> parent directory of PATH, 'F' -> regular file); being the rest the absolute path of the entry in string native format. |
|
virtual |
Return a (potentially long) text with all entries of the list and mrkrs.
Reimplemented in zxeco::gui::LabelTree.
|
static |
An observer that does nothing.
Note that this observer is static; if you have a LabelList that is created statically, it may found this observer uncreated depending on the order of creation of static objects in different compilation units.
Definition at line 373 of file ZXGUIGeneral.h.
const std::string zxeco::gui::LabelList::kMarkingMultips |
Multiple selection mode of markings.
Definition at line 379 of file ZXGUIGeneral.h.
const size_t zxeco::gui::LabelList::kNumOfMarkings |
Number of independent markings for labels.
Definition at line 380 of file ZXGUIGeneral.h.
|
protected |
Definition at line 679 of file ZXGUIGeneral.h.
|
protected |
Definition at line 680 of file ZXGUIGeneral.h.
|
protected |
Definition at line 681 of file ZXGUIGeneral.h.
|
protected |
Definition at line 682 of file ZXGUIGeneral.h.
|
protected |
Definition at line 683 of file ZXGUIGeneral.h.
|
protected |
Definition at line 684 of file ZXGUIGeneral.h.
|
protected |
Definition at line 685 of file ZXGUIGeneral.h.
class zxeco::gui::LabelList::Iterator |
Bidirectional iterator to scan indexes in the list under a given view.
Definition at line 245 of file ZXGUIGeneral.h.
Public Types | |
enum | : uint8_t { IT_VISIBLE = 1 , IT_INVISIBLE = 2 , IT_MARKED = 4 , IT_UNMARKED = 8 } |
Conditions for iterating that define the view (can be OR-ed). More... | |
enum | IniPos : uint8_t { BEGIN , END } |
Iterator to create. More... | |
Static Public Member Functions | |
static bool | labelSatisfiesCondition (uint8_t conditions, const LabelList &l, size_t who, unsigned marking=0) |
Test whether that label satisfies the given conditions. More... | |
Static Public Attributes | |
static const uint8_t | IT_ANY_VISIBILITY = IT_VISIBLE | IT_INVISIBLE |
View of all labels unregarding visibility. More... | |
static const uint8_t | IT_ANY_MARKABILITY = IT_MARKED | IT_UNMARKED |
View of all labels unregarding markability. More... | |
static const uint8_t | IT_ALL = IT_ANY_VISIBILITY | IT_ANY_MARKABILITY |
View of all labels unregarding both visibility and markability. More... | |
static const uint8_t | IT_ALL_VISIBLE = IT_VISIBLE | IT_ANY_MARKABILITY |
View of all visible labels, unregarding marks. More... | |
Public Member Functions | |
Iterator (void) | |
Default constructor: end iterator. | |
Iterator (const LabelList &l, uint8_t conditions=IT_ALL, unsigned marking=0, IniPos inip=BEGIN) | |
Construct an iterator for scanning label indexes in the given list. More... | |
Iterator (const Iterator &oth, uint8_t newconds, unsigned newmarking=0) noexcept | |
Construct iterator to the same label as OTH but with another view. More... | |
Iterator (const Iterator &oth) | |
Iterator (Iterator &&oth) | |
Iterator & | operator= (const Iterator &oth) |
Iterator & | operator= (Iterator &&oth) |
uint8_t | conditions (void) const noexcept |
Return the conditions for which the iterator was created. More... | |
unsigned | marking (void) const noexcept |
Return the marking for which the iterator was created. More... | |
size_t | operator* (void) const |
Return the actual position of the label in the label list. More... | |
size_t | advance (size_t n) noexcept |
Advance the iterator N steps; return the no. of steps not advanced. More... | |
size_t | retreat (size_t n) noexcept |
Retreat the iterator N steps; return the no. of steps not retreatd. More... | |
Iterator & | operator++ (void) noexcept |
Prefix increment for the iterator. More... | |
Iterator & | operator-- (void) noexcept |
Prefix decrement for the iterator. More... | |
bool | operator== (const Iterator &oth) const |
Return TRUE if both iterators are end or point to the same element. More... | |
bool | operator!= (const Iterator &oth) const |
Return TRUE if any of them is not end or point to diffrnt elements. | |
int | operator- (const Iterator &rhs) const |
Return the distance from OTH to THIS (negative if OTH comes before) More... | |
std::string | to_string (void) const |
Return a text describing the iterator. | |
anonymous enum : uint8_t |
Conditions for iterating that define the view (can be OR-ed).
Enumerator | |
---|---|
IT_VISIBLE | Iterate on visible labels. |
IT_INVISIBLE | Iterate on invisible labels. |
IT_MARKED | Iterate on marked labels. |
IT_UNMARKED | Iterate on unmarked labels. |
Definition at line 250 of file ZXGUIGeneral.h.
enum zxeco::gui::LabelList::Iterator::IniPos : uint8_t |
Iterator to create.
Enumerator | |
---|---|
BEGIN | One that points to the first index in view. |
END | One that points past the last index in view. |
Definition at line 270 of file ZXGUIGeneral.h.
zxeco::gui::LabelList::Iterator::Iterator | ( | const LabelList & | l, |
uint8_t | conditions = IT_ALL , |
||
unsigned | marking = 0 , |
||
IniPos | inip = BEGIN |
||
) |
Construct an iterator for scanning label indexes in the given list.
This is O(n), being N the length of the list.
l | is the list to iterate on. It must outlive the iterator. Any change in the list should be consider to invalidate the iterator. |
conditions | is the view: an OR-ed set of conditions to iterate. |
marking | is considered only if IT_MARKED (xor) IT_UNMARKED; in that case, indicates the marking to use. |
inip | indicates whether the iterator is constructed to point to the first element in the list under that view or past the end. |
|
noexcept |
|
inline |
Definition at line 304 of file ZXGUIGeneral.h.
|
inline |
Definition at line 305 of file ZXGUIGeneral.h.
|
static |
Test whether that label satisfies the given conditions.
Marking is only used if IT_MARKED != IT_UNMARKED in conditions.
Definition at line 306 of file ZXGUIGeneral.h.
Definition at line 308 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Return the conditions for which the iterator was created.
Definition at line 312 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Return the marking for which the iterator was created.
Definition at line 315 of file ZXGUIGeneral.h.
size_t zxeco::gui::LabelList::Iterator::operator* | ( | void | ) | const |
Return the actual position of the label in the label list.
Throw if end.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
bool zxeco::gui::LabelList::Iterator::operator== | ( | const Iterator & | oth | ) | const |
Return TRUE if both iterators are end or point to the same element.
All end iterators are considered equal, unregarding the list and view they have been created for. For non-end iterators, equality requires same view and list (otherwise, throw).
int zxeco::gui::LabelList::Iterator::operator- | ( | const Iterator & | rhs | ) | const |
Return the distance from OTH to THIS (negative if OTH comes before)
Throw if both do not have the same view. This is O(1).
|
static |
View of all labels unregarding visibility.
Definition at line 258 of file ZXGUIGeneral.h.
|
static |
View of all labels unregarding markability.
Definition at line 261 of file ZXGUIGeneral.h.
|
static |
View of all labels unregarding both visibility and markability.
Definition at line 264 of file ZXGUIGeneral.h.
|
static |
View of all visible labels, unregarding marks.
Definition at line 267 of file ZXGUIGeneral.h.
class zxeco::gui::LabelList::IndsRange |
A range of indexes covering some part of the list.
Definition at line 606 of file ZXGUIGeneral.h.
Public Types | |
using | IntervalType = Interval< size_t > |
Public Member Functions | |
IndsRange (size_t b, size_t e) | |
IndsRange (const IntervalType &i) | |
size_t | begin (void) const noexcept |
size_t | end (void) const noexcept |
bool | empty (void) const noexcept |
size_t | length (void) const noexcept |
size_t | first (void) const |
size_t | last (void) const |
size_t | nth (size_t offset) const |
void | clear (void) |
void | expand (size_t l) |
void | contract (size_t l) |
Indexes | toIndexes (void) const |
IntervalType | toInterval (void) const |
std::string | to_string (void) const |
using zxeco::gui::LabelList::IndsRange::IntervalType = Interval<size_t> |
Definition at line 610 of file ZXGUIGeneral.h.
|
inline |
Definition at line 612 of file ZXGUIGeneral.h.
|
inline |
Definition at line 614 of file ZXGUIGeneral.h.
|
inline |
Definition at line 617 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Definition at line 622 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Definition at line 623 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Definition at line 625 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Definition at line 626 of file ZXGUIGeneral.h.
|
inline |
Definition at line 629 of file ZXGUIGeneral.h.
|
inline |
Definition at line 632 of file ZXGUIGeneral.h.
|
inline |
Definition at line 635 of file ZXGUIGeneral.h.
|
inline |
Definition at line 641 of file ZXGUIGeneral.h.
|
inline |
Definition at line 643 of file ZXGUIGeneral.h.
|
inline |
Definition at line 648 of file ZXGUIGeneral.h.
|
inline |
Definition at line 654 of file ZXGUIGeneral.h.
|
inline |
Definition at line 660 of file ZXGUIGeneral.h.
|
inline |
Definition at line 664 of file ZXGUIGeneral.h.
class zxeco::gui::LabelTree |
A tree of labels based on LabelList.
< This class adds a depth level to each label, new methods to add/del labels with correct depths and a version of the text of a label that can include additional preffixes.
If you need a directory tree, do not use this class, but LabelDirBrowser instead since this class assumes a tree completely read in memory before browsing, which leads to problems in the case of large directories.
Definition at line 719 of file ZXGUIGeneral.h.
Public Member Functions | |
LabelTree (const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor: empty tree. More... | |
LabelTree (const LabelTree &oth) | |
LabelTree (LabelTree &&oth) | |
LabelTree & | operator= (const LabelTree &oth) |
LabelTree & | operator= (LabelTree &&oth) |
LabelList * | clone (void) const override |
Clone operation for being overriden in derived classes to return them. More... | |
const std::string & | preffixChars (void) const noexcept |
Return the current preffixes used by labelText();. More... | |
void | changePreffixChars (const std::string &preffixchars) |
Set the chars used as preffixes by labelText(). More... | |
virtual std::string | preffixForLabel (size_t who, size_t *posdeploy=nullptr) const |
Return the preffix corresponding to that label. More... | |
std::string | labelText (size_t who) const override |
< Return the label of the text including a preffix indicating the tree. More... | |
size_t | depth (size_t pos) const |
Return the depth of the given element in the tree (from 0 for root). | |
size_t | depth (void) const |
Return the depth of the tree, i.e., the maximum depth in it. More... | |
bool | hasChildren (size_t parent) const |
< Return whether the given element has any children. More... | |
Indexes | firstBorn (size_t parent) const |
Return the set of indexes (ordered) for the firstborns of PARENT. More... | |
LabelTree | subtree (size_t parent, bool withparent=false, Indexes *indexmap=nullptr) const |
Return a tree copied from the subtree of PARENT, with or without it. More... | |
size_t | insert (const Label &l, size_t beforewho) override |
Insert the new label previously to BEFOREWHO, with its same depth. More... | |
virtual size_t | insert_child (const Label &l, size_t parent) |
Insert the new label as the last child of PARENT, that must exist. More... | |
void | erase (size_t who) override |
Erase WHO and all its children, at all depths. More... | |
virtual void | erase_children (size_t who) |
Erase all children of WHO, at all depths, if any. | |
void | setVisible (size_t who) override |
< Set visibility for WHO and all its children. More... | |
void | setInvisible (size_t who) override |
< Unset visibility for WHO and all its children. More... | |
void | toggleVisible (size_t who) override |
< Toggle visibility for WHO and all its children. More... | |
virtual void | changeVisibilityDepth (size_t fromdepth, bool visib) |
Set visibility to VISIB for all elements with depth >= FROMDEPTH. | |
virtual void | toggleFolding (size_t who) |
Toggle visibility of children of WHO for folding/unfolding it. More... | |
void | sort (char mode='A', std::vector< size_t > *order=nullptr) override |
Do sort only if there is only one level in the tree; otherwise, throw. More... | |
void | clear (void) override |
Clear the content of the entire list, markings and visibilities. More... | |
std::string | to_string (void) const override |
Return a (potentially long) text with all entries of the list and mrkrs. More... | |
![]() | |
LabelList (const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor: empty list and marks. More... | |
LabelList (LabelList &oth, size_t begin, size_t length, const Observer &obs=kNullObserver) noexcept | |
Constructor: sublist taken from indexes [begin,begin+length) from OTH. More... | |
LabelList (const Label::Vector &labels, const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor from a vector of labels. | |
LabelList (const LabelList &oth) | |
LabelList (LabelList &&oth) | |
Move constructor eaves OTH in undefined state if OTH has no ownership. | |
LabelList & | operator= (const LabelList &oth) |
LabelList & | operator= (LabelList &&oth) |
Move copy leaves OTH in undefined state if OTH has no ownership. | |
virtual | ~LabelList (void) |
Destructor. More... | |
virtual LabelList * | clone (void) const |
Clone operation for being overriden in derived classes to return them. More... | |
void | checkMarking (unsigned marking) const |
If the given marking is not valid for the current list, throw. | |
void | checkIndex (size_t who) const |
If the given index is not valid in the current list, throw. | |
size_t | size (void) const noexcept |
Return the current number of labels in the list, either visible or not. More... | |
bool | empty (void) const noexcept |
Return TRUE if the list is empty (O(1)). More... | |
CharArea | areaForEntireList (void) const |
Return the area in chars that the visible items of the list would occpy. More... | |
const Observer & | observer (void) const noexcept |
Return a reference to the current observer. More... | |
void | changeObserver (const Observer &obs) |
Change the current observer by OBS. More... | |
Iterator | begin (uint8_t conditions=Iterator::IT_ALL, unsigned marking=0) const |
Return an iterator to iterate in that fashion, pointing to beginning. More... | |
Iterator | end (void) const |
Return an iterator pointing to the end of the list. More... | |
size_t | sizeByIterator (Iterator it) const noexcept |
Return the current number of labels in the list that satisfy IT conds. More... | |
size_t | longestLabel (Iterator it) const noexcept |
Return the maximum number of chars of any label scanned by IT, or 0. More... | |
virtual std::string | labelText (size_t who) const |
Return a copy of the text of the WHO-th label. More... | |
Label & | label (size_t who) |
Return a reference to a modifiable label of the list. More... | |
bool | marked (size_t who, unsigned marking=0) const |
Return the marked state of label WHO in marking MARKING. More... | |
bool | visible (size_t who) const |
Return TRUE if that label is currently visible. | |
LabelList | sublist (const Indexes &inds) const |
Return the given sublist as a copy of the elements of this one. More... | |
bool | mark (size_t who, unsigned marking=0) |
Mark the WHO-th label, according to the mode of marks. More... | |
bool | markAll (unsigned marking=0) |
Mark all labels in marking or do nothing if the multiplicity forbids. More... | |
bool | unmark (size_t who, unsigned marking=0) |
Unmark the WHO-th label. More... | |
bool | unmarkAll (unsigned marking=0) |
Unmark all labels at marking MARKING. More... | |
void | toggle (size_t who, unsigned marking=0) |
Toggle the mark of WHO according to the mode of selections. More... | |
void | toggleAll (unsigned marking=0) |
Like toggle on all marks. More... | |
virtual void | setVisible (size_t who) |
Set that element to visible. More... | |
virtual void | setInvisible (size_t who) |
Set that element to invisible. More... | |
virtual void | toggleVisible (size_t who) |
Toggle visibility of the label WHO. More... | |
virtual void | clear (void) |
Clear the content of the entire list, markings and visibilities. More... | |
size_t | push_back (const Label &l) |
Insert an unmarked, visible label at the end of the list. More... | |
void | push_back (const Label::Vector &v) |
virtual size_t | insert (const Label &l, size_t beforewho) |
Insert an unmarked, visible label before the given element. More... | |
void | insert (const Label::Vector &v, size_t beforewho) |
virtual void | erase (size_t who) |
Erase the given element and its marks. More... | |
bool | eraseMarked (unsigned marking=0) |
Erase all elements marked in the given marking. Return TRUE if any. More... | |
void | append (const LabelList &oth) |
Append a copy of OTH to this. | |
void | append (LabelList &&oth) |
Move the content of OTH to the end of this. | |
virtual void | sort (char mode='A', std::vector< size_t > *order=nullptr) |
Sort all elements in the list, unregarding marks and visibility. More... | |
void | fillWithFiles (const std::filesystem::path &path={}, char mode='T', bool onlyfiles=false, std::vector< std::string > *entries=nullptr) |
Clear the list and fill it with the files and folders in PATH. More... | |
virtual std::string | to_string (void) const |
Return a (potentially long) text with all entries of the list and mrkrs. More... | |
Protected Member Functions | |
Observer | skipObserver (void) |
void | retrieveObserver (const Observer &obs, char reason) |
IndsRange | subtreeRange (size_t pos, bool withparent=true) const |
size_t | parent (size_t pos) const |
size_t | prevSibling (size_t pos) const |
size_t | nextSibling (size_t pos) const |
size_t | lastRoot (void) const |
![]() | |
void | copyFrom (const LabelList &oth) |
void | moveFrom (LabelList &&oth) |
Protected Attributes | |
std::string | chars_ |
std::vector< size_t > | depths_ |
![]() | |
Observer | obs_ |
bool | owner_ |
Label::Vector | labels_ |
std::vector< Marks > | markings_ |
Marks | visible_ |
LabelList * | sect_ |
IndsRange | sectrange_ |
Additional Inherited Members | |
![]() | |
using | Observer = std::function< void(char)> |
using | Indexes = std::vector< size_t > |
A set of unique absolute indexes on the list. More... | |
![]() | |
static const Observer | kNullObserver |
An observer that does nothing. More... | |
![]() | |
const std::string | kMarkingMultips |
Multiple selection mode of markings. More... | |
const size_t | kNumOfMarkings |
Number of independent markings for labels. More... | |
![]() | |
using | Marks = std::vector< bool > |
Marks that can be associated to labels in a given marking. More... | |
zxeco::gui::LabelTree::LabelTree | ( | const std::string & | markingmultips, |
const Observer & | obs = kNullObserver |
||
) |
Constructor: empty tree.
obs | will be called every time a method call in this class modifies the list or marks. |
|
inlineoverridevirtual |
Clone operation for being overriden in derived classes to return them.
Reimplemented from zxeco::gui::LabelList.
Reimplemented in zxeco::gui::LabelDirBrowser.
Definition at line 778 of file ZXGUIGeneral.h.
|
inlinenoexcept |
Return the current preffixes used by labelText();.
Definition at line 780 of file ZXGUIGeneral.h.
void zxeco::gui::LabelTree::changePreffixChars | ( | const std::string & | preffixchars | ) |
Set the chars used as preffixes by labelText().
preffixchars | must contain a character for each of the special characters used in preffixes when returning a label text: 0-> an element with no parent; 1-> an element that has a parent and no siblings; 2-> an element that has a parent and siblings before but not after; 3-> an element that has a parent and siblings after but not before; 4-> an element that has a parent and siblings both after and before; 5-> to fill indentation; 6-> an element that has no children; 7-> an element that has children but it is not deployed; 8-> an element that has children and it is deployed. |
|
virtual |
Return the preffix corresponding to that label.
If not null, fill *POSDEPLOY with the position in the preffix of the char used for deployments.
Reimplemented in zxeco::gui::LabelDirBrowser.
|
inlineoverridevirtual |
< Return the label of the text including a preffix indicating the tree.
< The preffix will contain characters from the preffixchars argument of the constructor. In particular, the preffix will have as many indentation characters as its depth, then 1 character indicating whether the element has a parent (either no parent, parent and no siblings, parent and siblings before but no siblings after, parent and siblings after but not before, or parent and siblings both before and after), then 1 char indicating the existence of children (either no children, children that are deployed, or children not deployed).
Reimplemented from zxeco::gui::LabelList.
Definition at line 800 of file ZXGUIGeneral.h.
size_t zxeco::gui::LabelTree::depth | ( | void | ) | const |
Return the depth of the tree, i.e., the maximum depth in it.
Return 0 if the tree is empty, 1 if it has only 1 level, and so on. This is O(n).
|
inline |
< Return whether the given element has any children.
< Throw if PARENT does not exist.
Definition at line 820 of file ZXGUIGeneral.h.
Indexes zxeco::gui::LabelTree::firstBorn | ( | size_t | parent | ) | const |
Return the set of indexes (ordered) for the firstborns of PARENT.
Only return the children that have 1 more depth than the parent. If PARENT is >= size of the tree, return the root nodes of the tree.
LabelTree zxeco::gui::LabelTree::subtree | ( | size_t | parent, |
bool | withparent = false , |
||
Indexes * | indexmap = nullptr |
||
) | const |
Return a tree copied from the subtree of PARENT, with or without it.
The markings are the same as in this tree but are all cleared in the new one. The observer is null. If INDEXMAP != nullptr, fill it with the indexes of each of the subtree labels in the original tree.
|
overridevirtual |
Insert the new label previously to BEFOREWHO, with its same depth.
This is O(1). Return the position where L is in the list. If BEFOREWHO is the number of elements in the tree, insert the label as a sibling of the last one.
/note - push_back() adds siblings of the last element of the tree after that last element.
Reimplemented from zxeco::gui::LabelList.
|
virtual |
Insert the new label as the last child of PARENT, that must exist.
Return the position where the child has been inserted. This is O(n).
|
overridevirtual |
Erase WHO and all its children, at all depths.
This is O(n).
Reimplemented from zxeco::gui::LabelList.
|
inlineoverridevirtual |
< Set visibility for WHO and all its children.
< This is O(n).
Reimplemented from zxeco::gui::LabelList.
Definition at line 857 of file ZXGUIGeneral.h.
|
inlineoverridevirtual |
< Unset visibility for WHO and all its children.
< This is O(n).
Reimplemented from zxeco::gui::LabelList.
Definition at line 862 of file ZXGUIGeneral.h.
|
inlineoverridevirtual |
< Toggle visibility for WHO and all its children.
< This is O(n).
Reimplemented from zxeco::gui::LabelList.
Definition at line 867 of file ZXGUIGeneral.h.
|
virtual |
Toggle visibility of children of WHO for folding/unfolding it.
Reimplemented in zxeco::gui::LabelDirBrowser.
|
overridevirtual |
Do sort only if there is only one level in the tree; otherwise, throw.
Reimplemented from zxeco::gui::LabelList.
|
overridevirtual |
Clear the content of the entire list, markings and visibilities.
Reimplemented from zxeco::gui::LabelList.
Reimplemented in zxeco::gui::LabelDirBrowser.
|
overridevirtual |
Return a (potentially long) text with all entries of the list and mrkrs.
Reimplemented from zxeco::gui::LabelList.
|
protected |
Definition at line 889 of file ZXGUIGeneral.h.
|
protected |
Definition at line 890 of file ZXGUIGeneral.h.
class zxeco::gui::LabelTree::DepthFirstInserter |
Inserter of elements into the tree structure.
For more confortable and readable insertions than using the insert(), insert_child() and push_back() methods.
Definition at line 726 of file ZXGUIGeneral.h.
Public Member Functions | |
DepthFirstInserter (LabelTree <, size_t parentpos=0) | |
Constructor to insert elements as subtree of PARENTPOS in LT. More... | |
size_t | add (const Label &l) |
Add the given element as another child of the current parent. More... | |
void | add (const Label::Vector &v) |
Add each of the elements in V in that order. More... | |
void | openSubtree (void) |
Make the last added element a parent of a new subtree. | |
void | closeSubtree (void) |
Close the last parent and consider its parent as the new one. More... | |
|
inline |
Constructor to insert elements as subtree of PARENTPOS in LT.
If PARENTPOS >= size of LT, elements will be added either as siblings of the last element in the tree (if any) or as top-level-siblings (if the tree is empty), until a subtree is opened.
Definition at line 730 of file ZXGUIGeneral.h.
size_t zxeco::gui::LabelTree::DepthFirstInserter::add | ( | const Label & | l | ) |
Add the given element as another child of the current parent.
Return the index in the tree of the inserted element. If it is the first insertion of this inserter, either there is no current parent set in the constructor (then L will become the current parent and will be created as indicated in the constructor) or there is (then L will become a child of it and the current parent will be unchanged).
|
inline |
Add each of the elements in V in that order.
Definition at line 747 of file ZXGUIGeneral.h.
void zxeco::gui::LabelTree::DepthFirstInserter::closeSubtree | ( | void | ) |
Close the last parent and consider its parent as the new one.
If no more closing can be done, do nothing.
class zxeco::gui::LabelDirBrowser |
A tree of labels that correspond to the entries in a directory tree.
< The visibility of the labels are made private in this class to avoid erroneous manipulations, as well as insertion / deletion of elements.
Definition at line 921 of file ZXGUIGeneral.h.
Public Member Functions | |
LabelDirBrowser (const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor. Empty directory. More... | |
LabelDirBrowser (const LabelDirBrowser &oth) | |
LabelDirBrowser (LabelDirBrowser &&oth) | |
LabelDirBrowser & | operator= (const LabelDirBrowser &oth) |
LabelDirBrowser & | operator= (LabelDirBrowser &&oth) |
LabelList * | clone (void) const override |
Clone operation for being overriden in derived classes to return them. More... | |
void | clear (void) |
Clear the entire content of the tree. More... | |
size_t | readStartingPath (const std::filesystem::path &p) |
Clear the content of the list and fill it with the 1st level dirs in P. More... | |
std::string | preffixForLabel (size_t who, size_t *posdeploy=nullptr) const override |
Return the preffix corresponding to that label (see LabelTree). More... | |
std::filesystem::path | absolutePath (size_t who) const |
Return the absolute path in the disk corresponding to the WHO label. | |
bool | isParent (size_t who) const |
Return TRUE if the given index is the parent directory of the tree. | |
void | toggleFolding (size_t who) override |
Fold or unfold the given parent directory. More... | |
![]() | |
LabelTree (const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor: empty tree. More... | |
LabelTree (const LabelTree &oth) | |
LabelTree (LabelTree &&oth) | |
LabelTree & | operator= (const LabelTree &oth) |
LabelTree & | operator= (LabelTree &&oth) |
LabelList * | clone (void) const override |
Clone operation for being overriden in derived classes to return them. More... | |
const std::string & | preffixChars (void) const noexcept |
Return the current preffixes used by labelText();. More... | |
void | changePreffixChars (const std::string &preffixchars) |
Set the chars used as preffixes by labelText(). More... | |
virtual std::string | preffixForLabel (size_t who, size_t *posdeploy=nullptr) const |
Return the preffix corresponding to that label. More... | |
std::string | labelText (size_t who) const override |
< Return the label of the text including a preffix indicating the tree. More... | |
size_t | depth (size_t pos) const |
Return the depth of the given element in the tree (from 0 for root). | |
size_t | depth (void) const |
Return the depth of the tree, i.e., the maximum depth in it. More... | |
bool | hasChildren (size_t parent) const |
< Return whether the given element has any children. More... | |
Indexes | firstBorn (size_t parent) const |
Return the set of indexes (ordered) for the firstborns of PARENT. More... | |
LabelTree | subtree (size_t parent, bool withparent=false, Indexes *indexmap=nullptr) const |
Return a tree copied from the subtree of PARENT, with or without it. More... | |
size_t | insert (const Label &l, size_t beforewho) override |
Insert the new label previously to BEFOREWHO, with its same depth. More... | |
virtual size_t | insert_child (const Label &l, size_t parent) |
Insert the new label as the last child of PARENT, that must exist. More... | |
void | erase (size_t who) override |
Erase WHO and all its children, at all depths. More... | |
virtual void | erase_children (size_t who) |
Erase all children of WHO, at all depths, if any. | |
void | setVisible (size_t who) override |
< Set visibility for WHO and all its children. More... | |
void | setInvisible (size_t who) override |
< Unset visibility for WHO and all its children. More... | |
void | toggleVisible (size_t who) override |
< Toggle visibility for WHO and all its children. More... | |
virtual void | changeVisibilityDepth (size_t fromdepth, bool visib) |
Set visibility to VISIB for all elements with depth >= FROMDEPTH. | |
virtual void | toggleFolding (size_t who) |
Toggle visibility of children of WHO for folding/unfolding it. More... | |
void | sort (char mode='A', std::vector< size_t > *order=nullptr) override |
Do sort only if there is only one level in the tree; otherwise, throw. More... | |
void | clear (void) override |
Clear the content of the entire list, markings and visibilities. More... | |
std::string | to_string (void) const override |
Return a (potentially long) text with all entries of the list and mrkrs. More... | |
![]() | |
LabelList (const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor: empty list and marks. More... | |
LabelList (LabelList &oth, size_t begin, size_t length, const Observer &obs=kNullObserver) noexcept | |
Constructor: sublist taken from indexes [begin,begin+length) from OTH. More... | |
LabelList (const Label::Vector &labels, const std::string &markingmultips, const Observer &obs=kNullObserver) | |
Constructor from a vector of labels. | |
LabelList (const LabelList &oth) | |
LabelList (LabelList &&oth) | |
Move constructor eaves OTH in undefined state if OTH has no ownership. | |
LabelList & | operator= (const LabelList &oth) |
LabelList & | operator= (LabelList &&oth) |
Move copy leaves OTH in undefined state if OTH has no ownership. | |
virtual | ~LabelList (void) |
Destructor. More... | |
virtual LabelList * | clone (void) const |
Clone operation for being overriden in derived classes to return them. More... | |
void | checkMarking (unsigned marking) const |
If the given marking is not valid for the current list, throw. | |
void | checkIndex (size_t who) const |
If the given index is not valid in the current list, throw. | |
size_t | size (void) const noexcept |
Return the current number of labels in the list, either visible or not. More... | |
bool | empty (void) const noexcept |
Return TRUE if the list is empty (O(1)). More... | |
CharArea | areaForEntireList (void) const |
Return the area in chars that the visible items of the list would occpy. More... | |
const Observer & | observer (void) const noexcept |
Return a reference to the current observer. More... | |
void | changeObserver (const Observer &obs) |
Change the current observer by OBS. More... | |
Iterator | begin (uint8_t conditions=Iterator::IT_ALL, unsigned marking=0) const |
Return an iterator to iterate in that fashion, pointing to beginning. More... | |
Iterator | end (void) const |
Return an iterator pointing to the end of the list. More... | |
size_t | sizeByIterator (Iterator it) const noexcept |
Return the current number of labels in the list that satisfy IT conds. More... | |
size_t | longestLabel (Iterator it) const noexcept |
Return the maximum number of chars of any label scanned by IT, or 0. More... | |
virtual std::string | labelText (size_t who) const |
Return a copy of the text of the WHO-th label. More... | |
Label & | label (size_t who) |
Return a reference to a modifiable label of the list. More... | |
bool | marked (size_t who, unsigned marking=0) const |
Return the marked state of label WHO in marking MARKING. More... | |
bool | visible (size_t who) const |
Return TRUE if that label is currently visible. | |
LabelList | sublist (const Indexes &inds) const |
Return the given sublist as a copy of the elements of this one. More... | |
bool | mark (size_t who, unsigned marking=0) |
Mark the WHO-th label, according to the mode of marks. More... | |
bool | markAll (unsigned marking=0) |
Mark all labels in marking or do nothing if the multiplicity forbids. More... | |
bool | unmark (size_t who, unsigned marking=0) |
Unmark the WHO-th label. More... | |
bool | unmarkAll (unsigned marking=0) |
Unmark all labels at marking MARKING. More... | |
void | toggle (size_t who, unsigned marking=0) |
Toggle the mark of WHO according to the mode of selections. More... | |
void | toggleAll (unsigned marking=0) |
Like toggle on all marks. More... | |
virtual void | setVisible (size_t who) |
Set that element to visible. More... | |
virtual void | setInvisible (size_t who) |
Set that element to invisible. More... | |
virtual void | toggleVisible (size_t who) |
Toggle visibility of the label WHO. More... | |
virtual void | clear (void) |
Clear the content of the entire list, markings and visibilities. More... | |
size_t | push_back (const Label &l) |
Insert an unmarked, visible label at the end of the list. More... | |
void | push_back (const Label::Vector &v) |
virtual size_t | insert (const Label &l, size_t beforewho) |
Insert an unmarked, visible label before the given element. More... | |
void | insert (const Label::Vector &v, size_t beforewho) |
virtual void | erase (size_t who) |
Erase the given element and its marks. More... | |
bool | eraseMarked (unsigned marking=0) |
Erase all elements marked in the given marking. Return TRUE if any. More... | |
void | append (const LabelList &oth) |
Append a copy of OTH to this. | |
void | append (LabelList &&oth) |
Move the content of OTH to the end of this. | |
virtual void | sort (char mode='A', std::vector< size_t > *order=nullptr) |
Sort all elements in the list, unregarding marks and visibility. More... | |
void | fillWithFiles (const std::filesystem::path &path={}, char mode='T', bool onlyfiles=false, std::vector< std::string > *entries=nullptr) |
Clear the list and fill it with the files and folders in PATH. More... | |
virtual std::string | to_string (void) const |
Return a (potentially long) text with all entries of the list and mrkrs. More... | |
Additional Inherited Members | |
![]() | |
using | Observer = std::function< void(char)> |
using | Indexes = std::vector< size_t > |
A set of unique absolute indexes on the list. More... | |
![]() | |
static const Observer | kNullObserver |
An observer that does nothing. More... | |
![]() | |
const std::string | kMarkingMultips |
Multiple selection mode of markings. More... | |
const size_t | kNumOfMarkings |
Number of independent markings for labels. More... | |
![]() | |
using | Marks = std::vector< bool > |
Marks that can be associated to labels in a given marking. More... | |
![]() | |
Observer | skipObserver (void) |
void | retrieveObserver (const Observer &obs, char reason) |
IndsRange | subtreeRange (size_t pos, bool withparent=true) const |
size_t | parent (size_t pos) const |
size_t | prevSibling (size_t pos) const |
size_t | nextSibling (size_t pos) const |
size_t | lastRoot (void) const |
![]() | |
void | copyFrom (const LabelList &oth) |
void | moveFrom (LabelList &&oth) |
![]() | |
std::string | chars_ |
std::vector< size_t > | depths_ |
![]() | |
Observer | obs_ |
bool | owner_ |
Label::Vector | labels_ |
std::vector< Marks > | markings_ |
Marks | visible_ |
LabelList * | sect_ |
IndsRange | sectrange_ |
zxeco::gui::LabelDirBrowser::LabelDirBrowser | ( | const std::string & | markingmultips, |
const Observer & | obs = kNullObserver |
||
) |
Constructor. Empty directory.
obs | will be called every time a method call in this class modifies the list or marks. |
|
inlineoverridevirtual |
Clone operation for being overriden in derived classes to return them.
Reimplemented from zxeco::gui::LabelTree.
Definition at line 936 of file ZXGUIGeneral.h.
|
virtual |
Clear the entire content of the tree.
Reimplemented from zxeco::gui::LabelTree.
size_t zxeco::gui::LabelDirBrowser::readStartingPath | ( | const std::filesystem::path & | p | ) |
Clear the content of the list and fill it with the 1st level dirs in P.
If P does not exist, only clear the tree. Return the index in the list of P, or size() if none.
p | is the path from which the directories must be read. Only the 1st level directories within P are read. The tree is formed by adding first a parent path to go up P, if any. If P is empty, the current dir is used. To use the root path, pass std::filesystem::current_path().root_path(). |
|
overridevirtual |
Return the preffix corresponding to that label (see LabelTree).
If not null, fill *POSDEPLOY with the position in the preffix of the char used for deployments.
Reimplemented from zxeco::gui::LabelTree.
|
overridevirtual |
Fold or unfold the given parent directory.
If WHO has children, unfold it; otherwise, fold it. Folding involves to erase its children. Unfolding involves to re-read directory children.
Reimplemented from zxeco::gui::LabelTree.
#define ZXGUIVER "3.0.0" |
#include <ZXGUIGeneral.h>
Version of the GUI sublibrary.
Definition at line 24 of file ZXGUIGeneral.h.