The ZX Ecosystem v5.1.0;_GUI_v3.1.0
Loading...
Searching...
No Matches
ZXGUIGeneral.h
Go to the documentation of this file.
1
2/* **************************************************************************/
20#ifndef ZXGUIGENERAL
21#define ZXGUIGENERAL
22
24#define ZXGUIVER "3.0.0"
25
26
27#include <string>
28#include <vector>
29#include <functional>
30#include <filesystem>
31#include <utility>
35
36
37namespace zxeco
38{
39
41namespace gui
42{
43
44
45/*****************************************************************************
46*
47* Class: WinColors
48*
49*******************************************************************************/
50
53{
54
55 static const WinColors kLight;
56 static const WinColors kDark;
57
58
70
71
72 uint8_t attrForBackground(void) const
74 { return(AttrColors{Flash{OFF},Bright{backpaper.bright()},
75 Paper{backpaper.color()}, Ink{mainink}}.toAttr()); }
76
77 void setTitleColorsFor(Screen & scr, bool forborder = false) const
79 { scr.colors() = {(forborder ?
82 title), Inverse{OFF},Over{OFF}}; }
83
86 { scr.colors() = {{Flash{OFF},Bright{backpaper.bright()},
88 Inverse{OFF},Over{OFF}}; }
89
90 void setMainColorsFor(Screen & scr, bool enabled) const
92 { scr.colors() = {{Flash{OFF},Bright{backpaper.bright()},
94 Ink{enabled ? mainink : maindisink}},
95 Inverse{OFF},Over{OFF}}; }
96
97 void setDecorColorsFor(Screen & scr, bool enabled) const
99 { scr.colors() = {{Flash{OFF},Bright{backpaper.bright()},
101 Ink{enabled ? decink : decdisink}},
102 Inverse{OFF},Over{OFF}}; }
103
104 void setTypingColorsFor(Screen & scr, bool enabled) const
106 { const BrightColor & pc = enabled ? typingpaper : typingdispaper;
107 scr.colors() = {{Flash{OFF},Bright{pc.bright()},
108 Paper{pc.color()},Ink{pc.color().contrasting()}},
109 Inverse{OFF},Over{OFF}}; }
110
111 void setCursorColorsFor(Screen & scr) const
113 { scr.colors() = {cursor,Inverse{OFF},Over{OFF}}; }
114
115
116 std::string to_string(void) const
118 { return("WinColors{ title: " + title.to_string() +
119 "; background paper: " + backpaper.to_string() +
120 "; main ink: " +
121 endistext(mainink.to_string(),maindisink.to_string()) +
122 "; decorations ink: " +
123 endistext(decink.to_string(),decdisink.to_string()) +
124 "; typing paper: " +
126 "; cursor colors: " +
127 cursor.to_string() + " }"); }
128
129 private:
130
131 static std::string endistext(const std::string & entxt,
132 const std::string & distxt)
133 { return(entxt + " (enabled) or " + distxt + " (disabled)"); }
134};
135
136
137/*****************************************************************************
138*
139* Helper Class: TypingZone
140*
141*******************************************************************************/
142
145{
146 public:
147
148 TypingZone(void): typing_zone_{{0,0},{0,0}} {}
150
151 void set(const CharRect & zone) noexcept { typing_zone_ = zone; }
153
154 const CharRect & get(void) const noexcept { return(typing_zone_); }
156
157 void move(IntDist xdiff, IntDist ydiff) noexcept
159 { typing_zone_.corner.addDiff(xdiff,ydiff); }
160
161 void clear(Screen & globscr, const WinColors & wincols, bool enabled);
163
164 private:
165
166 CharRect typing_zone_;
167};
168
169
170/*****************************************************************************
171*
172* Class: Label
173*
174*******************************************************************************/
175
177
178class Label
179{
180 public:
181
183 using Vector = std::vector<Label>;
184
185
186 Label(void) {}
188
189 Label(const std::string & initlabel) { set(initlabel); }
191
192 Label(const char * initlabel) { set(initlabel); }
194
195 void set(const std::string & label);
197
199 void set(const char * label);
201
203 const std::string & get(void) const noexcept { return(label_); }
205
206
207 private:
208
209 std::string label_;
210};
211
212
213/*****************************************************************************
214*
215* Class: LabelList
216*
217*******************************************************************************/
218
220
231{
232 public:
233
234 using Observer = std::function<void(char)>;
236
241 using Indexes = std::vector<size_t>;
243
246 {
247 public:
248
250 enum : uint8_t {
251 IT_VISIBLE = 1,
252 IT_INVISIBLE = 2,
253 IT_MARKED = 4,
254 IT_UNMARKED = 8
255 };
256
258 static const uint8_t IT_ANY_VISIBILITY = IT_VISIBLE | IT_INVISIBLE;
259
261 static const uint8_t IT_ANY_MARKABILITY = IT_MARKED | IT_UNMARKED;
262
264 static const uint8_t IT_ALL = IT_ANY_VISIBILITY | IT_ANY_MARKABILITY;
265
267 static const uint8_t IT_ALL_VISIBLE = IT_VISIBLE | IT_ANY_MARKABILITY;
268
270 enum IniPos: uint8_t {
272 END
273 };
274
275 static bool labelSatisfiesCondition(uint8_t conditions,
276 const LabelList & l,
277 size_t who, unsigned marking = 0);
279
282 Iterator(void);
284
285 Iterator(const LabelList & l, uint8_t conditions = IT_ALL,
286 unsigned marking = 0, IniPos inip = BEGIN);
288
297 Iterator(const Iterator & oth, uint8_t newconds,
298 unsigned newmarking = 0) noexcept;
300
304 Iterator(const Iterator & oth) { copyFrom(oth); }
305 Iterator(Iterator && oth) { moveFrom(std::move(oth)); }
306 Iterator & operator=(const Iterator & oth)
307 { if (this != &oth) copyFrom(oth); return(*this); }
308 Iterator & operator=(Iterator && oth)
309 { if (this != &oth) { moveFrom(std::move(oth)); } return(*this); }
310
311
312 uint8_t conditions(void) const noexcept { return(conditions_); }
314
315 unsigned marking(void) const noexcept { return(marking_); }
317
318 size_t operator*(void) const;
320
322 size_t advance(size_t n) noexcept;
324
326 size_t retreat(size_t n) noexcept;
328
330 Iterator & operator++(void) noexcept;
332
335 Iterator & operator--(void) noexcept;
337
340 bool operator==(const Iterator & oth) const;
342
346 bool operator!=(const Iterator & oth) const;
348
349 int operator-(const Iterator & rhs) const;
351
353 std::string to_string(void) const;
355
356 private:
357
358 LabelList * l_;
359 uint8_t conditions_;
360 unsigned marking_;
361
362 bool isend_;
363 size_t pos_;
364 size_t dist_;
365 size_t begpos_;
366
367 void checkderef(void) const;
368 bool testconditions(void) const noexcept;
369 void copyFrom(const Iterator & oth) noexcept;
370 void moveFrom(Iterator && oth) noexcept;
371 };
372
375
379 const std::string kMarkingMultips;
380 const size_t kNumOfMarkings;
381
382
383 LabelList(const std::string & markingmultips,
384 const Observer & obs = kNullObserver );
386
389 LabelList(LabelList & oth, size_t begin, size_t length,
390 const Observer & obs = kNullObserver) noexcept;
392
400 LabelList(const Label::Vector & labels, const std::string & markingmultips,
401 const Observer & obs = kNullObserver);
403
404
405 LabelList(const LabelList & oth);
408 LabelList & operator=(const LabelList & oth);
411
412 virtual ~LabelList(void) {}
414
416 virtual LabelList * clone(void) const { return(new LabelList{*this}); }
418
420 void checkMarking(unsigned marking) const;
423 void checkIndex(size_t who) const;
426 size_t size(void) const noexcept;
428
432 bool empty(void) const noexcept { return(size() == 0); }
435 CharArea areaForEntireList(void) const;
437
441 const Observer & observer(void) const noexcept { return(obs_); }
444 void changeObserver(const Observer & obs) { obs_ = obs; }
446
452 Iterator begin(uint8_t conditions = Iterator::IT_ALL,
453 unsigned marking = 0) const;
457 Iterator end(void) const { return(Iterator{}); }
459
460 size_t sizeByIterator(Iterator it) const noexcept;
462
465 size_t longestLabel(Iterator it) const noexcept;
467
472 virtual std::string labelText(size_t who) const;
474
477 Label & label(size_t who);
479
483 bool marked(size_t who, unsigned marking = 0) const;
487 bool visible(size_t who) const;
489
490 LabelList sublist(const Indexes & inds) const;
492
497 bool mark(size_t who, unsigned marking = 0);
499
502 bool markAll(unsigned marking = 0);
506 bool unmark(size_t who, unsigned marking = 0);
508
511 bool unmarkAll(unsigned marking = 0);
513
516 void toggle(size_t who, unsigned marking = 0);
520 void toggleAll(unsigned marking = 0);
522
525 virtual void setVisible(size_t who);
527
528 virtual void setInvisible(size_t who);
530
531 virtual void toggleVisible(size_t who);
534
535 virtual void clear(void);
537
538 size_t push_back(const Label & l) { return(insert(l,size())); }
540
546 void push_back(const Label::Vector & v)
548 { for (const auto & l: v) push_back(l); }
549
550 virtual size_t insert(const Label & l, size_t beforewho);
555 void insert(const Label::Vector & v, size_t beforewho)
557 { for (const auto & l: v) { insert(l,beforewho); ++beforewho; } }
558
559 virtual void erase(size_t who);
564 bool eraseMarked(unsigned marking = 0);
569 void append(const LabelList & oth);
571
572 void append(LabelList && oth);
574
575 virtual void sort(char mode = 'A', std::vector<size_t> * order = nullptr);
577
583 void fillWithFiles(const std::filesystem::path & path = {},
584 char mode = 'T', bool onlyfiles = false,
585 std::vector<std::string> * entries = nullptr);
587
602 virtual std::string to_string(void) const;
604
605
606 protected:
607
609 class IndsRange
610 {
611 public:
612
614
615 IndsRange(void) { clear(); }
616
617 IndsRange(size_t b, size_t e):begin_{b},end_{e}
618 { if (b > e) RUNTIMEEXCEP("Invalid index range for labellist"); }
619
620 IndsRange(const IntervalType & i)
621 { if (i.empty()) clear();
622 else { begin_ = i.minimum(); end_ = i.maximum() + 1; } }
623
624
625 size_t begin(void) const noexcept { return(begin_); }
626 size_t end(void) const noexcept { return(end_); }
627
628 bool empty(void) const noexcept { return(begin_ == end_); }
629 size_t length(void) const noexcept
630 { return(empty() ? 0 : end_ - begin_); }
631
632 size_t first(void) const
633 { if (empty()) RUNTIMEEXCEP("Empty labellist range has no first");
634 return(begin_); }
635 size_t last(void) const
636 { if (empty()) RUNTIMEEXCEP("Empty labellist range has no last");
637 return(end_ - 1); }
638 size_t nth(size_t offset) const
639 { size_t i{first() + offset};
640 if (i > last())
641 RUNTIMEEXCEP("Invalid offset within a labellist range");
642 return(i); }
643
644 void clear(void) { begin_ = 0; end_ = 0; }
645
646 void expand(size_t l)
647 { if (l == 0) return;
648 if (empty()) RUNTIMEEXCEP("Cannot expand empty labellist range");
649 end_ += l; }
650
651 void contract(size_t l)
652 { if (l == 0) return;
653 if (l > length())
654 RUNTIMEEXCEP("Cannot contract labellist range so much");
655 end_ -= l; }
656
657 Indexes toIndexes(void) const
658 { Indexes res;
659 if (!empty())
660 for (size_t f = begin_; f < end_; ++f) res.push_back(f);
661 return(res); }
662
663 IntervalType toInterval(void) const
664 { return(empty() ? IntervalType{0,0,IntervalCl::OPENED} :
665 IntervalType{first(),last()}); }
666
667 std::string to_string(void) const
668 { return("labellist-range(" +
669 (empty() ? "empty)" : std::to_string(first()) + " to " +
670 std::to_string(last()) + "; " +
671 std::to_string(length()) +
672 " label(s))")); }
673
674 private:
675
676 size_t begin_,end_;
677 };
678
679 using Marks = std::vector<bool>;
681
682 Observer obs_;
683 bool owner_;
684 Label::Vector labels_;
685 std::vector<Marks> markings_;
686 Marks visible_;
687 LabelList * sect_;
688 IndsRange sectrange_;
689
690 void copyFrom(const LabelList & oth);
691 void moveFrom(LabelList && oth);
692
693 private:
694
695 size_t actualPos(size_t p) const noexcept
696 { return(owner_ ? p : sectrange_.nth(p)); }
697 void checkOtherCompatibility(const LabelList & oth) const;
698 void checkMultiple(unsigned marking = 0) const;
699
700 void overwriteElement(const LabelList & oth, size_t pos, size_t dest);
701 void overwriteSection(const LabelList & oth);
702};
703
704
705/*****************************************************************************
706*
707* Class: LabelTree
708*
709*******************************************************************************/
710
712
719class LabelTree: public LabelList
720{
721 public:
722
724
727 {
728 public:
729
730 DepthFirstInserter(LabelTree & lt, size_t parentpos = 0):
731 tree_{lt},
732 parent_{parentpos},
733 lastadded_{lt.size()} {}
735
739 size_t add(const Label & l);
741
748 void add(const Label::Vector & v) { for (const auto & l: v) add(l); }
751 void openSubtree(void);
754 void closeSubtree(void);
756
759 private:
760
761 LabelTree & tree_;
762 size_t parent_;
763 size_t lastadded_;
764 };
765
766
767 LabelTree(const std::string & markingmultips,
768 const Observer & obs = kNullObserver);
770
773 LabelTree(const LabelTree & oth);
774 LabelTree(LabelTree && oth);
775 LabelTree & operator=(const LabelTree & oth);
776 LabelTree & operator=(LabelTree && oth);
777
778 LabelList * clone(void) const override { return(new LabelTree{*this}); }
779
780 const std::string & preffixChars(void) const noexcept { return(chars_); }
782
783 void changePreffixChars(const std::string & preffixchars);
785
794 virtual std::string preffixForLabel(size_t who,
795 size_t * posdeploy = nullptr) const;
797
800 std::string labelText(size_t who) const override
802
810 { return(preffixForLabel(who) + LabelList::labelText(who)); }
811
812 size_t depth(size_t pos) const;
814
815 size_t depth(void) const;
817
820 bool hasChildren(size_t parent) const
822
823 { checkIndex(parent); return(!subtreeRange(parent,false).empty()); }
824
825 Indexes firstBorn(size_t parent) const;
827
830 LabelTree subtree(size_t parent, bool withparent = false,
831 Indexes * indexmap = nullptr) const;
833
837 size_t insert(const Label & l, size_t beforewho) override;
839
846 virtual size_t insert_child(const Label & l, size_t parent);
848
850 void erase(size_t who) override;
852
854 virtual void erase_children(size_t who);
856
857 void setVisible(size_t who) override
859
860 { changeSubtreeVisible(who,true,true); }
861
862 void setInvisible(size_t who) override
864
865 { changeSubtreeVisible(who,false,true); }
866
867 void toggleVisible(size_t who) override
869
870 { toggleSubtreeVisible(who,true); }
871
872 virtual void changeVisibilityDepth(size_t fromdepth, bool visib);
874
875 virtual void toggleFolding(size_t who);
877
878 void sort(char mode = 'A',
879 std::vector<size_t> * order = nullptr) override;
881
882
883 void clear(void) override;
884 std::string to_string(void) const override;
885
886
887 protected:
888
889 std::string chars_;
890 std::vector<size_t> depths_;
891
892 Observer skipObserver(void);
893 void retrieveObserver(const Observer & obs, char reason);
894
895 IndsRange subtreeRange(size_t pos, bool withparent = true) const;
896 size_t parent(size_t pos) const;
897 size_t prevSibling(size_t pos) const;
898 size_t nextSibling(size_t pos) const;
899 size_t lastRoot(void) const;
900
901
902 private:
903
904 void copyFrom(const LabelTree & oth);
905 void moveFrom(LabelTree && oth);
906
907 void toggleSubtreeVisible(size_t root, bool withroot);
908 void changeSubtreeVisible(size_t root, bool visi, bool withroot);
909};
910
911
912/*****************************************************************************
913*
914* Class: LabelDirBrowser
915*
916*******************************************************************************/
917
919
922{
923 public:
924
925 LabelDirBrowser(const std::string & markingmultips,
926 const Observer & obs = kNullObserver);
928
931 LabelDirBrowser(const LabelDirBrowser & oth);
933 LabelDirBrowser & operator=(const LabelDirBrowser & oth);
934 LabelDirBrowser & operator=(LabelDirBrowser && oth);
935
936 LabelList * clone(void) const override {return(new LabelDirBrowser{*this});}
937
938 void clear(void);
940
941 size_t readStartingPath(const std::filesystem::path & p);
943
952 std::string preffixForLabel(size_t who,
953 size_t * posdeploy = nullptr) const override;
955
958 std::filesystem::path absolutePath(size_t who) const;
960
961 bool isParent(size_t who) const;
963
964 void toggleFolding(size_t who) override;
966
970 private:
971
972 std::string getlastdirname(const std::filesystem::path & path);
973
974 std::vector<std::string> entries_;
975 std::vector<bool> explored_;
976
977 void copyFrom(const LabelDirBrowser & oth);
978 void moveFrom(LabelDirBrowser && oth);
979
980 void insert_children(size_t p);
981 void erase_children(size_t p) override;
982
983 // Change to private (from a virtual reference, the base methods will still
984 // be visible; they are only private for this derived class used as such).
985 using LabelTree::insert;
986 using LabelTree::insert_child;
987 using LabelTree::erase;
988 using LabelTree::setVisible;
989 using LabelTree::setInvisible;
990 using LabelTree::toggleVisible;
991 using LabelTree::changeVisibilityDepth;
992 using LabelTree::sort;
993};
994
995
996
997} // end namespace gui
998} // end namespace zxeco
999
1000#endif
1001 // ZXWindows
1003
ELEMTYPE maximum(void) const noexcept
Return the maximum value.
Definition: CppAddons.h:499
ELEMTYPE minimum(void) const noexcept
Return the minimum value.
Definition: CppAddons.h:496
bool empty(void) const noexcept
Return true if the interval is empty.
Definition: CppAddons.h:515
An interval, typically numeric, either closed, opened or semi-closed.
Definition: CppAddons.h:470
#define RUNTIMEEXCEP(txt)
Raise a runtime exception with the given std::string TXT + additional info.
Definition: CppAddons.h:93
Iterator & operator++(void) noexcept
Prefix increment for the iterator.
std::string preffixForLabel(size_t who, size_t *posdeploy=nullptr) const override
Return the preffix corresponding to that label (see LabelTree).
void clear(void)
Clear the entire content of the tree.
TypingZone(void)
Default constructor.
Definition: ZXGUIGeneral.h:148
BasicColor maindisink
For the ink of main disabled elements.
Definition: ZXGUIGeneral.h:62
bool hasChildren(size_t parent) const
< Return whether the given element has any children.
Definition: ZXGUIGeneral.h:820
void setBackgroundColorsFor(Screen &scr) const
< Put the background colors in SCR.
Definition: ZXGUIGeneral.h:84
const size_t kNumOfMarkings
Number of independent markings for labels.
Definition: ZXGUIGeneral.h:380
const std::string & get(void) const noexcept
Get the current label text.
Definition: ZXGUIGeneral.h:203
LabelList * clone(void) const override
Clone operation for being overriden in derived classes to return them.
Definition: ZXGUIGeneral.h:936
void set(const std::string &label)
Set the label text to LABEL.
size_t depth(void) const
Return the depth of the tree, i.e., the maximum depth in it.
Iterator(const Iterator &oth, uint8_t newconds, unsigned newmarking=0) noexcept
Construct iterator to the same label as OTH but with another view.
uint8_t conditions(void) const noexcept
Return the conditions for which the iterator was created.
Definition: ZXGUIGeneral.h:312
Iterator(void)
Default constructor: end iterator.
const std::string kMarkingMultips
Multiple selection mode of markings.
Definition: ZXGUIGeneral.h:379
size_t operator*(void) const
Return the actual position of the label in the label list.
BrightColor typingmarkpaper
For marking some part of the typing areas.
Definition: ZXGUIGeneral.h:67
size_t advance(size_t n) noexcept
Advance the iterator N steps; return the no. of steps not advanced.
void set(const char *label)
Set the label text to LABEL.
const CharRect & get(void) const noexcept
Return the current typing zone (updated by derived classes).
Definition: ZXGUIGeneral.h:154
LabelList(const std::string &markingmultips, const Observer &obs=kNullObserver)
Constructor: empty list and marks.
LabelList(const Label::Vector &labels, const std::string &markingmultips, const Observer &obs=kNullObserver)
Constructor from a vector of labels.
size_t depth(size_t pos) const
Return the depth of the given element in the tree (from 0 for root).
void toggleVisible(size_t who) override
< Toggle visibility for WHO and all its children.
Definition: ZXGUIGeneral.h:867
BrightColor typingpaper
For the paper of typing areas.
Definition: ZXGUIGeneral.h:65
void setMainColorsFor(Screen &scr, bool enabled) const
< Put the main colors in SCR.
Definition: ZXGUIGeneral.h:90
bool isParent(size_t who) const
Return TRUE if the given index is the parent directory of the tree.
@ BEGIN
One that points to the first index in view.
Definition: ZXGUIGeneral.h:271
size_t readStartingPath(const std::filesystem::path &p)
Clear the content of the list and fill it with the 1st level dirs in P.
LabelList * clone(void) const override
Clone operation for being overriden in derived classes to return them.
Definition: ZXGUIGeneral.h:778
void append(LabelList &&oth)
Move the content of OTH to the end of this.
void clear(Screen &globscr, const WinColors &wincols, bool enabled)
Draw an empty typing zone in the current zone within GLOBSCR.
virtual void changeVisibilityDepth(size_t fromdepth, bool visib)
Set visibility to VISIB for all elements with depth >= FROMDEPTH.
BrightColor backpaper
For the background paper and bright.
Definition: ZXGUIGeneral.h:60
std::vector< size_t > Indexes
A set of unique absolute indexes on the list.
Definition: ZXGUIGeneral.h:242
size_t insert(const Label &l, size_t beforewho) override
Insert the new label previously to BEFOREWHO, with its same depth.
static const WinColors kDark
Colors for dark background, with bright.
Definition: ZXGUIGeneral.h:56
std::string to_string(void) const
< Return textual information about the colors.
Definition: ZXGUIGeneral.h:116
Label(const std::string &initlabel)
Constructor from string.
Definition: ZXGUIGeneral.h:189
AttrColors title
For paper, ink, bright of title (flash ignored)
Definition: ZXGUIGeneral.h:59
void erase(size_t who) override
Erase WHO and all its children, at all depths.
virtual std::string preffixForLabel(size_t who, size_t *posdeploy=nullptr) const
Return the preffix corresponding to that label.
Iterator & operator--(void) noexcept
Prefix decrement for the iterator.
bool operator==(const Iterator &oth) const
Return TRUE if both iterators are end or point to the same element.
Label(const char *initlabel)
Constructor from char array.
Definition: ZXGUIGeneral.h:192
std::function< void(char)> Observer
Definition: ZXGUIGeneral.h:239
void setVisible(size_t who) override
< Set visibility for WHO and all its children.
Definition: ZXGUIGeneral.h:857
uint8_t attrForBackground(void) const
< Return an attribute suitable for filling a background attrmap.
Definition: ZXGUIGeneral.h:72
void move(IntDist xdiff, IntDist ydiff) noexcept
< Shift typing zone.
Definition: ZXGUIGeneral.h:157
static const Observer kNullObserver
An observer that does nothing.
Definition: ZXGUIGeneral.h:373
bool operator!=(const Iterator &oth) const
Return TRUE if any of them is not end or point to diffrnt elements.
static bool labelSatisfiesCondition(uint8_t conditions, const LabelList &l, size_t who, unsigned marking=0)
Test whether that label satisfies the given conditions.
DepthFirstInserter(LabelTree &lt, size_t parentpos=0)
Constructor to insert elements as subtree of PARENTPOS in LT.
Definition: ZXGUIGeneral.h:730
std::string to_string(void) const
Return a text describing the iterator.
LabelList(LabelList &&oth)
Move constructor eaves OTH in undefined state if OTH has no ownership.
void setTitleColorsFor(Screen &scr, bool forborder=false) const
< Put the title colors in SCR.
Definition: ZXGUIGeneral.h:77
int operator-(const Iterator &rhs) const
Return the distance from OTH to THIS (negative if OTH comes before)
std::filesystem::path absolutePath(size_t who) const
Return the absolute path in the disk corresponding to the WHO label.
AttrColors cursor
For a cursor marking something.
Definition: ZXGUIGeneral.h:68
std::vector< Label > Vector
A vector of labels.
Definition: ZXGUIGeneral.h:183
virtual ~LabelList(void)
Destructor.
Definition: ZXGUIGeneral.h:412
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.
BasicColor decdisink
For the ink of disabled decorations.
Definition: ZXGUIGeneral.h:64
std::string to_string(void) const override
Return a (potentially long) text with all entries of the list and mrkrs.
const std::string & preffixChars(void) const noexcept
Return the current preffixes used by labelText();.
Definition: ZXGUIGeneral.h:780
unsigned marking(void) const noexcept
Return the marking for which the iterator was created.
Definition: ZXGUIGeneral.h:315
void setInvisible(size_t who) override
< Unset visibility for WHO and all its children.
Definition: ZXGUIGeneral.h:862
LabelTree(const std::string &markingmultips, const Observer &obs=kNullObserver)
Constructor: empty tree.
void setTypingColorsFor(Screen &scr, bool enabled) const
< Put the colors for a typing area in SCR.
Definition: ZXGUIGeneral.h:104
void setDecorColorsFor(Screen &scr, bool enabled) const
< Put the decorations colors in SCR.
Definition: ZXGUIGeneral.h:97
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.
AttrColors tooltip
Colors for the tooltip.
Definition: ZXGUIGeneral.h:69
size_t retreat(size_t n) noexcept
Retreat the iterator N steps; return the no. of steps not retreatd.
BrightColor typingdispaper
For the paper of disabled typing areas.
Definition: ZXGUIGeneral.h:66
BasicColor decink
For the ink of enabled decorations.
Definition: ZXGUIGeneral.h:63
static const WinColors kLight
Colors for light background, with bright.
Definition: ZXGUIGeneral.h:55
virtual void erase_children(size_t who)
Erase all children of WHO, at all depths, if any.
LabelList & operator=(LabelList &&oth)
Move copy leaves OTH in undefined state if OTH has no ownership.
virtual void toggleFolding(size_t who)
Toggle visibility of children of WHO for folding/unfolding it.
Indexes firstBorn(size_t parent) const
Return the set of indexes (ordered) for the firstborns of PARENT.
void changePreffixChars(const std::string &preffixchars)
Set the chars used as preffixes by labelText().
void set(const CharRect &zone) noexcept
Change current typing zone.
Definition: ZXGUIGeneral.h:151
void setCursorColorsFor(Screen &scr) const
< Put the cursor colors in SCR.
Definition: ZXGUIGeneral.h:111
Label(void)
Default constructor: empty label.
Definition: ZXGUIGeneral.h:186
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.
void clear(void) override
Clear the content of the entire list, markings and visibilities.
BasicColor mainink
For the ink of main enabled elements.
Definition: ZXGUIGeneral.h:61
void toggleFolding(size_t who) override
Fold or unfold the given parent directory.
LabelList(LabelList &oth, size_t begin, size_t length, const Observer &obs=kNullObserver) noexcept
Constructor: sublist taken from indexes [begin,begin+length) from OTH.
LabelDirBrowser(const std::string &markingmultips, const Observer &obs=kNullObserver)
Constructor. Empty directory.
virtual size_t insert_child(const Label &l, size_t parent)
Insert the new label as the last child of PARENT, that must exist.
std::string labelText(size_t who) const override
< Return the label of the text including a preffix indicating the tree.
Definition: ZXGUIGeneral.h:800
A non-empty label for a widget.
Definition: ZXGUIGeneral.h:179
A tree of labels that correspond to the entries in a directory tree.
Definition: ZXGUIGeneral.h:922
A list of labels to be displayed vertically, with possible marks on them.
Definition: ZXGUIGeneral.h:231
A range of indexes covering some part of the list.
Definition: ZXGUIGeneral.h:607
Bidirectional iterator to scan indexes in the list under a given view.
Definition: ZXGUIGeneral.h:246
A tree of labels based on LabelList.
Definition: ZXGUIGeneral.h:720
Inserter of elements into the tree structure.
Definition: ZXGUIGeneral.h:727
A zone of a widget where the user can type.
Definition: ZXGUIGeneral.h:145
Colors used in a GUI window.
Definition: ZXGUIGeneral.h:53
std::string to_string(bool shorttxt=false) const
Return a descriptive text of this color specification.
std::string to_string(void) const
Return the name for this color.
bool bright(void) const noexcept
Get the bright level.
Definition: ZXColors.h:226
BasicColor color(void) const noexcept
Get the basic color.
Definition: ZXColors.h:223
std::string to_string(void) const
Return a descriptive string for this color.
BasicColor contrasting(void) const noexcept
Return the basic color that contrasts with this one.
Definition: ZXColors.h:170
Complete color specification for an attr (character) cell on the zx screen.
Definition: ZXColors.h:315
One of the 8 basic colors of the ZX, not considering bright or flash.
Definition: ZXColors.h:154
A value of bright that is different to the same value of flash, inv or over.
Definition: ZXColors.h:100
A basic color plus a bright level (on / off).
Definition: ZXColors.h:195
A value of flash that is different to the same value of bright, inv or over.
Definition: ZXColors.h:83
A printcolor for ink as a different type from a color for paper.
Definition: ZXColors.h:302
A value of inv that is different to the same value of flash, bright or over.
Definition: ZXColors.h:117
A value of over that is different to the same value of flash, bright or inv.
Definition: ZXColors.h:134
A printcolor for paper as a different type from a color for ink.
Definition: ZXColors.h:293
int16_t IntDist
Positive and negative distances on screen.
Definition: ZXGraphics.h:99
Colors & colors(void) noexcept
Get reference to the current colors that can be used to write and read.
Definition: ZXScreen.h:405
The class that provides the main support for managing the ZX screen.
Definition: ZXScreen.h:89
The main namespace of the library, that spans across all the zx modules.
Definition: ZXChars.h:31