diff options
Diffstat (limited to '')
-rw-r--r-- | src/statusview_curses.hh | 26 |
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 |