From 1eb000371416ad1defec39cdcc3a711833a7b7c7 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 5 Oct 2012 21:25:22 +0200 Subject: window: rename Where to Scroll and make it enum class --- src/menu.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/menu.h') diff --git a/src/menu.h b/src/menu.h index b34985db..ab1a9f7e 100644 --- a/src/menu.h +++ b/src/menu.h @@ -284,7 +284,7 @@ public: /// Scrolls by given amount of lines /// @param where indicated where exactly one wants to go /// @see Window::scroll() - virtual void scroll(Where where) OVERRIDE; + virtual void scroll(Scroll where) OVERRIDE; /// Cleares all options, used filters etc. It doesn't reset highlighted position though. /// @see reset() @@ -609,9 +609,9 @@ template void Menu::refresh() if (!isHighlightable(m_highlight)) { - scroll(wUp); + scroll(Scroll::Up); if (!isHighlightable(m_highlight)) - scroll(wDown); + scroll(Scroll::Down); } size_t line = 0; @@ -655,7 +655,7 @@ template void Menu::refresh() Window::refresh(); } -template void Menu::scroll(Where where) +template void Menu::scroll(Scroll where) { if (m_options_ptr->empty()) return; @@ -664,42 +664,42 @@ template void Menu::scroll(Where where) size_t max_visible_highlight = m_beginning+m_height-1; switch (where) { - case wUp: + case Scroll::Up: { if (m_highlight <= m_beginning && m_highlight > 0) --m_beginning; if (m_highlight == 0) { if (m_cyclic_scroll_enabled) - return scroll(wEnd); + return scroll(Scroll::End); break; } else --m_highlight; if (!isHighlightable(m_highlight)) - scroll(m_highlight == 0 && !m_cyclic_scroll_enabled ? wDown : wUp); + scroll(m_highlight == 0 && !m_cyclic_scroll_enabled ? Scroll::Down : Scroll::Up); break; } - case wDown: + case Scroll::Down: { if (m_highlight >= max_visible_highlight && m_highlight < max_highlight) ++m_beginning; if (m_highlight == max_highlight) { if (m_cyclic_scroll_enabled) - return scroll(wHome); + return scroll(Scroll::Home); break; } else ++m_highlight; if (!isHighlightable(m_highlight)) - scroll(m_highlight == max_highlight && !m_cyclic_scroll_enabled ? wUp : wDown); + scroll(m_highlight == max_highlight && !m_cyclic_scroll_enabled ? Scroll::Up : Scroll::Down); break; } - case wPageUp: + case Scroll::PageUp: { if (m_cyclic_scroll_enabled && m_highlight == 0) - return scroll(wEnd); + return scroll(Scroll::End); if (m_highlight < m_height) m_highlight = 0; else @@ -709,35 +709,35 @@ template void Menu::scroll(Where where) else m_beginning -= m_height; if (!isHighlightable(m_highlight)) - scroll(m_highlight == 0 && !m_cyclic_scroll_enabled ? wDown : wUp); + scroll(m_highlight == 0 && !m_cyclic_scroll_enabled ? Scroll::Down : Scroll::Up); break; } - case wPageDown: + case Scroll::PageDown: { if (m_cyclic_scroll_enabled && m_highlight == max_highlight) - return scroll(wHome); + return scroll(Scroll::Home); m_highlight += m_height; m_beginning += m_height; m_beginning = std::min(m_beginning, max_beginning); m_highlight = std::min(m_highlight, max_highlight); if (!isHighlightable(m_highlight)) - scroll(m_highlight == max_highlight && !m_cyclic_scroll_enabled ? wUp : wDown); + scroll(m_highlight == max_highlight && !m_cyclic_scroll_enabled ? Scroll::Up : Scroll::Down); break; } - case wHome: + case Scroll::Home: { m_highlight = 0; m_beginning = 0; if (!isHighlightable(m_highlight)) - scroll(wDown); + scroll(Scroll::Down); break; } - case wEnd: + case Scroll::End: { m_highlight = max_highlight; m_beginning = max_beginning; if (!isHighlightable(m_highlight)) - scroll(wUp); + scroll(Scroll::Up); break; } } -- cgit v1.2.3