71 bool key_used =
false;
72 if (val < 256 && isprint(val)) {
84 if (input_loc_ == -1 || input_loc_ >=
input_text_.size()) {
93 else if (!
input_text_.empty() && val == KEY_DC && input_loc_ != -1) {
100 else if (input_loc_ != 0 && val == KEY_LEFT) {
101 if (input_loc_ == -1) {
107 else if (input_loc_ != -1 && val == KEY_RIGHT) {
133 bool key_used =
false;
134 if (key == KEY_NPAGE) {
138 else if (key == KEY_PPAGE) {
142 else if (key == KEY_UP) {
146 else if (key == KEY_DOWN) {
150 else if (key == KEY_END) {
154 else if (key == KEY_HOME) {
158 else if (key == KEY_LEFT) {
162 else if (key == KEY_RIGHT) {
182 return y >=
y_ && y < y_ + height_ && x >=
x_ && x <
x_ +
width_;
231 if (count <= height) {
235 mvwvline(
window_, y, x, 0, height);
242 if (count >= 2 * height) {
243 float percent = std::max(0.0
f, static_cast<float>((cursor - height)) / (count - height));
244 int scroll_loc = std::round(percent * (height - 1));
247 mvwprintw(
window_, y + scroll_loc, x,
" ");
251 int size = 2 * height - count;
252 cursor = std::max(static_cast<int64_t>(0), cursor - height);
255 for (
size_t i = cursor; i < cursor + size; i++) {
256 mvwprintw(
window_, y + i, x,
" ");
331 int64_t dst = std::max(static_cast<int64_t>(0), cursor + step);
343 if (index < view_size) {
354 shift = std::max(0, shift);
virtual void forceRefresh()
virtual bool handleInput(int key)
virtual int getContentHeight() const
virtual bool scrollbar() const
virtual bool encloses(int y, int x)
virtual int width() const
virtual void resize(int height, int width, int y, int x)
virtual int inputOffset() const
virtual ~PanelInterface()
virtual int getContentWidth() const
virtual void moveTo(size_t index)
virtual bool canSelect() const
size_t last_content_size_
virtual bool hidden() const
virtual void hide(bool enable)
virtual void move(int step)
virtual bool canFocus() const
virtual bool setFocus(bool enable)
virtual bool canNavigate() const
virtual void shift(int cols)
virtual bool visible() const
virtual bool handleNavigation(int key)
virtual void activate(bool enable)
virtual size_t getContentSize() const
virtual int64_t getCursor() const
PanelInterface(int height, int width, int y, int x)
virtual int height() const
virtual void drawScrollBar(size_t count, int height, int y, int x)
virtual bool focus() const
virtual bool canInput() const
virtual void follow(bool enable)