Program Listing for File help_panel.h
↰ Return to documentation for file (/tmp/ws/src/log_view/include/log_view/panels/help_panel.h
)
#ifndef LOG_VIEW_HELP_PANEL_H_
#define LOG_VIEW_HELP_PANEL_H_
#include <string>
#include <vector>
#include <log_view/panel_interface.h>
namespace log_view {
struct HelpText {
int line;
std::string key;
std::string description;
};
class HelpPanel : public PanelInterface {
public:
HelpPanel(int height, int width, int y, int x);
virtual ~HelpPanel() {}
virtual void refresh();
virtual void resize(int height, int width, int y, int x);
virtual bool handleMouse(const MEVENT& event) { return !hidden(); }
virtual bool handleKey(int key);
protected:
virtual bool canNavigate() const { return !hidden(); }
void printKeybinding(const HelpText& text);
std::vector<HelpText> keys_;
size_t longest_key_ = 0;
size_t longest_line_ = 0;
};
typedef std::shared_ptr<HelpPanel> HelpPanelPtr;
} // namespace log_view
#endif // LOG_VIEW_HELP_PANEL_H_