Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ItemSelector widget for NCurses #81

Merged
merged 10 commits into from
Sep 26, 2019
Merged

New ItemSelector widget for NCurses #81

merged 10 commits into from
Sep 26, 2019

Conversation

shundhammer
Copy link
Contributor

@shundhammer shundhammer commented Sep 25, 2019

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

nc-ItemSelector1

nc-SingleItemSelector2-icons

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 or const 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.

@shundhammer shundhammer changed the title WIP: New ItemSelector widget for NCurses New ItemSelector widget for NCurses Sep 26, 2019
Copy link
Member

@aschnell aschnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shundhammer shundhammer merged commit 682242f into libyui:master Sep 26, 2019
@shundhammer shundhammer deleted the huha-item-selector-1 branch September 26, 2019 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants