help_panel.h
Go to the documentation of this file.
1 
28 #ifndef LOG_VIEW_HELP_PANEL_H_
29 #define LOG_VIEW_HELP_PANEL_H_
30 
31 #include <string>
32 #include <vector>
33 
35 
36 namespace log_view {
37 
38 struct HelpText {
39  int line;
40  std::string key;
41  std::string description;
42 };
43 
44 class HelpPanel : public PanelInterface {
45  public:
46  HelpPanel(int height, int width, int y, int x);
47  virtual ~HelpPanel() {}
48  virtual void refresh();
49  virtual void resize(int height, int width, int y, int x);
50  virtual bool handleMouse(const MEVENT& event) { return !hidden(); }
51  virtual bool handleKey(int key);
52 
53  protected:
54  virtual bool canNavigate() const { return !hidden(); }
55 
56  void printKeybinding(const HelpText& text);
57 
58  std::vector<HelpText> keys_;
59  size_t longest_key_ = 0;
60  size_t longest_line_ = 0;
61 };
62 typedef std::shared_ptr<HelpPanel> HelpPanelPtr;
63 
64 } // namespace log_view
65 
66 #endif // LOG_VIEW_HELP_PANEL_H_
std::string key
Definition: help_panel.h:40
virtual ~HelpPanel()
Definition: help_panel.h:47
std::vector< HelpText > keys_
Definition: help_panel.h:58
std::shared_ptr< HelpPanel > HelpPanelPtr
Definition: help_panel.h:62
virtual bool canNavigate() const
Definition: help_panel.h:54
std::string description
Definition: help_panel.h:41
virtual bool handleMouse(const MEVENT &event)
Definition: help_panel.h:50


log_view
Author(s): Marc Alban
autogenerated on Thu Mar 4 2021 03:21:52