allow BufferPane to turn off its status bar

This commit is contained in:
Josh Holtrop 2017-01-17 09:09:38 -05:00
parent 837380c3ca
commit 30290e86f5
2 changed files with 16 additions and 2 deletions

View File

@ -8,13 +8,19 @@ BufferPane::BufferPane(Window * window, std::shared_ptr<Buffer> buffer)
m_iterator = buffer->add_cursor();
m_target_column = 0;
m_cursor_virtual_column = 0;
m_show_status_bar = true;
}
void BufferPane::resize(int width, int height)
{
Pane::resize(width, height);
m_columns = std::max(1, m_width / m_window->font()->get_advance());
m_rows = std::max(1, (m_height - m_window->font()->get_line_height() - 1) / m_window->font()->get_line_height());
int height_subtract = 0;
if (m_show_status_bar)
{
height_subtract = m_window->font()->get_line_height() + 1;
}
m_rows = std::max(1, (m_height - height_subtract) / m_window->font()->get_line_height());
}
void BufferPane::walk_line(const Buffer::Iterator & start_of_line, std::function<void(int, int, int, int, const Buffer::Iterator &)> callback)
@ -288,7 +294,10 @@ void BufferPane::draw()
{
draw_cursor(col_x(0), row_y(0));
}
draw_status_bar();
if (m_show_status_bar)
{
draw_status_bar();
}
}
int BufferPane::draw_buffer_line(int screen_row, const Buffer::Iterator & start_of_line)

View File

@ -25,6 +25,10 @@ public:
void scroll_window_down(Window::ScrollMode scroll_mode);
void undo();
void redo();
void set_show_status_bar(bool show_status_bar)
{
m_show_status_bar = show_status_bar;
}
protected:
int effective_scroll_offset()
@ -72,6 +76,7 @@ protected:
std::shared_ptr<Buffer::Iterator> m_iterator;
std::list<std::pair<int, Buffer::Iterator>> m_screen_lines;
int m_target_column;
bool m_show_status_bar;
};
#endif