44 size_t start_idx = cursor;
52 std::vector<std::pair<std::string, NodeData>> nodes;
54 nodes.push_back(node);
57 bool selection_visible =
false;
59 auto name = nodes[i + start_idx].first;
61 selection_visible =
true;
67 if (!selection_visible) {
72 const auto& node_data = nodes[i + start_idx].second;
73 auto name = nodes[i + start_idx].first;
75 bool selected = !node_data.exclude;
77 std::string text = name +
": " + std::to_string(node_data.count);
89 if (
shift_ >= text.size()) {
102 mvwprintw(
window_, i + 1, 1, text.c_str());
113 mvwprintw(
window_, i + 1, 1,
" ");
115 mvwprintw(
window_, i + 1, 1,
"<");
136 if (key ==
ctrl(
'a')) {
141 else if (key ==
ctrl(
'i')) {
156 if (event.bstate & BUTTON1_PRESSED) {
157 int row =
event.y - (
y_ + 1);
159 size_t start_idx = cursor;
167 size_t index = start_idx + row;
172 std::vector<std::pair<std::string, NodeData>> nodes;
174 nodes.push_back(node);
199 int64_t offset =
static_cast<int64_t
>(index) - cursor;
206 std::vector<std::pair<std::string, NodeData>> nodes;
207 int64_t selection = -1;
210 nodes.push_back(node);
217 if (selection < 0 || index == 0) {
222 selection = std::max(static_cast<int64_t>(0), std::min(static_cast<int64_t>(
getContentSize()) - 1, selection));
226 size_t start_idx = cursor;
234 if (selection < start_idx) {
virtual bool encloses(int y, int x)
virtual int width() const
void toggleNode(const std::string &node)
const std::map< std::string, NodeData > & nodes() const
virtual bool hidden() const
virtual size_t getContentSize() const
virtual int getContentWidth() const
virtual bool handleMouse(const MEVENT &event)
virtual int getContentHeight() const
virtual void moveTo(size_t index)
virtual void follow(bool enable)
virtual bool handleKey(int key)
virtual void drawScrollBar(size_t count, int height, int y, int x)
virtual int64_t getCursor() const