summaryrefslogtreecommitdiffstats
path: root/src/statusview_curses.hh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
commit207df6fc406e81bfeebdff7f404bd242ff3f099f (patch)
treea1a796b056909dd0a04ffec163db9363a8757808 /src/statusview_curses.hh
parentReleasing progress-linux version 0.11.2-1~progress7.99u1. (diff)
downloadlnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz
lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/statusview_curses.hh')
-rw-r--r--src/statusview_curses.hh26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/statusview_curses.hh b/src/statusview_curses.hh
index c9c5916..ff2bc93 100644
--- a/src/statusview_curses.hh
+++ b/src/statusview_curses.hh
@@ -42,6 +42,8 @@
*/
class status_field {
public:
+ using action = std::function<void(status_field&)>;
+
/**
* @param width The maximum width of the field in characters.
* @param role The color role for this field, defaults to VCR_STATUS.
@@ -121,6 +123,10 @@ public:
int get_share() const { return this->sf_share; }
+ static void no_op_action(status_field&);
+
+ action on_click{no_op_action};
+
protected:
ssize_t sf_width; /*< The maximum display width, in chars. */
ssize_t sf_min_width{0}; /*< The minimum display width, in chars. */
@@ -162,9 +168,6 @@ public:
void set_data_source(status_data_source* src) { this->sc_source = src; }
status_data_source* get_data_source() { return this->sc_source; }
- void set_top(int top) { this->sc_top = top; }
- int get_top() const { return this->sc_top; }
-
void set_window(WINDOW* win) { this->sc_window = win; }
WINDOW* get_window() { return this->sc_window; }
@@ -176,14 +179,27 @@ public:
void window_change();
- void do_update() override;
+ bool do_update() override;
+
+ bool handle_mouse(mouse_event& me) override;
private:
status_data_source* sc_source{nullptr};
WINDOW* sc_window{nullptr};
- int sc_top{0};
bool sc_enabled{true};
role_t sc_default_role{role_t::VCR_STATUS};
+
+ struct displayed_field {
+ displayed_field(line_range lr, size_t field_index)
+ : df_range(lr), df_field_index(field_index)
+ {
+ }
+
+ line_range df_range;
+ size_t df_field_index;
+ };
+
+ std::vector<displayed_field> sc_displayed_fields;
};
#endif