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 bool hidden() const
virtual int width() const
virtual int getContentHeight() const
virtual bool encloses(int y, int x)
virtual bool canNavigate() const
virtual void resize(int height, int width, int y, int x)
virtual int inputOffset() const
virtual ~PanelInterface()
virtual bool canInput() const
virtual bool canSelect() const
virtual void moveTo(size_t index)
virtual bool scrollbar() const
virtual bool canFocus() const
virtual int64_t getCursor() const
size_t last_content_size_
virtual int height() const
virtual int getContentWidth() const
virtual void hide(bool enable)
virtual void move(int step)
virtual bool setFocus(bool enable)
virtual bool focus() const
virtual size_t getContentSize() const
virtual bool visible() const
virtual void shift(int cols)
virtual bool handleNavigation(int key)
virtual void activate(bool enable)
PanelInterface(int height, int width, int y, int x)
virtual void drawScrollBar(size_t count, int height, int y, int x)
virtual void follow(bool enable)