New ItemSelector widget for NCurses #81
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trello
https://trello.com/c/7qI1AAvN/1300-5-libyui-1-of-n-selection-widget-ysingleitemselector-ymultiitemselector
Description
This implements the new ItemSelector widget for the NCurses UI.
Screenshots
The
@
and^@
artifacts appear to be a constant thing on my machine with the NCurses UI; they were there before I even started working on this. To be clarified what that is all about.Implementation Details
Large parts of this are a copy of the NCMultiSelectionBox widget.
That NCMultSelectionBox creates a scrollable NCTablePad (which inherits NCPad) with two columns: a NCTableTag for the
[x]
indicator which also holds a pointer to the corresponding YItem and a NCTableCol for the text.This NCItemSelector also does that, but after that line for the item's label, it also adds a line for each line of the description text. Those lines have an empty NCTableCol for column 0 and another NCTableCol with one line of description text in column 1.
That of course means that the mapping of lines to the corresponding YItem is no longer so easy; the currentItem() method has to check if there is an NCTableTag in column 0, and only in that case fetch the YItem pointer (because all the description lines and also the separator line between the items don't have an NCTableTag in that column that would store that pointer.
Other Changes
Lots of nonsensical function parameters were changed to sensible types: It does not make any sense to pass
const bool
orconst int
as a parameter because C++ always passes parameters by value unless a non-const reference or a pointer is explicitly passed.const enum &
also does not make any sense. But in other cases classes were passed directly as parameters; many of them are now passed as const reference for performance.