Program Listing for File node_panel.h

Return to documentation for file (/tmp/ws/src/log_view/include/log_view/panels/node_panel.h)

#ifndef LOG_VIEW_NODE_PANEL_H_
#define LOG_VIEW_NODE_PANEL_H_

#include <log_view/log_filter.h>
#include <log_view/panel_interface.h>

namespace log_view {

class NodePanel : public PanelInterface {
  public:
  NodePanel(int height, int width, int y, int x, LogFilter& filter) : PanelInterface(height, width, y, x), filter_(filter) {}
  virtual ~NodePanel() {}
  virtual void refresh();
  virtual bool handleMouse(const MEVENT& event);
  virtual bool handleKey(int key);

  protected:
  virtual bool canFocus() const { return true; }
  virtual bool canNavigate() const { return true; }
  virtual bool canSelect() const { return true; }
  virtual size_t getContentSize() const { return filter_.nodes().size(); }
  virtual int getContentHeight() const { return height_ - 2; }
  virtual int getContentWidth() const;
  virtual void follow(bool enable);
  virtual void moveTo(size_t index);
  virtual void setCursor(int64_t cursor) { cursor_ = cursor; }
  virtual int64_t getCursor() const { return cursor_; }
  virtual void select();

  size_t cursor_ = 0;
  std::string selected_;

  LogFilter& filter_;
};
typedef std::shared_ptr<NodePanel> NodePanelPtr;

}  // namespace log_view

#endif  // LOG_VIEW_NODE_PANEL_H_