|
|
|
@ -30,13 +30,12 @@ |
|
|
|
#include "window.h" |
|
|
|
#include "window.h" |
|
|
|
#include "strbuffer.h" |
|
|
|
#include "strbuffer.h" |
|
|
|
|
|
|
|
|
|
|
|
namespace NCurses |
|
|
|
namespace NCurses { |
|
|
|
{ |
|
|
|
|
|
|
|
/// List class is an interface for Menu class
|
|
|
|
/// List class is an interface for Menu class
|
|
|
|
///
|
|
|
|
///
|
|
|
|
class List |
|
|
|
struct List |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
|
|
|
|
/// @see Menu::Select()
|
|
|
|
/// @see Menu::Select()
|
|
|
|
///
|
|
|
|
///
|
|
|
|
virtual void Select(int pos, bool state) = 0; |
|
|
|
virtual void Select(int pos, bool state) = 0; |
|
|
|
@ -604,9 +603,8 @@ namespace NCurses |
|
|
|
/// that if strings are stored, we don't need extra function to convert
|
|
|
|
/// that if strings are stored, we don't need extra function to convert
|
|
|
|
/// them to strings by default
|
|
|
|
/// them to strings by default
|
|
|
|
template <> std::string Menu<std::string>::GetItem(size_t pos); |
|
|
|
template <> std::string Menu<std::string>::GetItem(size_t pos); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T> NCurses::Menu<T>::Menu(size_t startx, |
|
|
|
template <typename T> Menu<T>::Menu(size_t startx, |
|
|
|
size_t starty, |
|
|
|
size_t starty, |
|
|
|
size_t width, |
|
|
|
size_t width, |
|
|
|
size_t height, |
|
|
|
size_t height, |
|
|
|
@ -628,7 +626,7 @@ template <typename T> NCurses::Menu<T>::Menu(size_t startx, |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> NCurses::Menu<T>::Menu(const Menu &m) : Window(m), |
|
|
|
template <typename T> Menu<T>::Menu(const Menu &m) : Window(m), |
|
|
|
m_item_displayer(m.m_item_displayer), |
|
|
|
m_item_displayer(m.m_item_displayer), |
|
|
|
m_get_string_helper(m.m_get_string_helper), |
|
|
|
m_get_string_helper(m.m_get_string_helper), |
|
|
|
m_options_ptr(m.m_options_ptr), |
|
|
|
m_options_ptr(m.m_options_ptr), |
|
|
|
@ -646,18 +644,18 @@ template <typename T> NCurses::Menu<T>::Menu(const Menu &m) : Window(m), |
|
|
|
m_options.push_back(new Item(**it)); |
|
|
|
m_options.push_back(new Item(**it)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> NCurses::Menu<T>::~Menu() |
|
|
|
template <typename T> Menu<T>::~Menu() |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (auto it = m_options.begin(); it != m_options.end(); ++it) |
|
|
|
for (auto it = m_options.begin(); it != m_options.end(); ++it) |
|
|
|
delete *it; |
|
|
|
delete *it; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Reserve(size_t size) |
|
|
|
template <typename T> void Menu<T>::Reserve(size_t size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_options.reserve(size); |
|
|
|
m_options.reserve(size); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::ResizeList(size_t size) |
|
|
|
template <typename T> void Menu<T>::ResizeList(size_t size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (size > m_options.size()) |
|
|
|
if (size > m_options.size()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -674,27 +672,27 @@ template <typename T> void NCurses::Menu<T>::ResizeList(size_t size) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::AddItem(const T &item, bool is_bold, bool is_static) |
|
|
|
template <typename T> void Menu<T>::AddItem(const T &item, bool is_bold, bool is_static) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_options.push_back(new Item(item, is_bold, is_static)); |
|
|
|
m_options.push_back(new Item(item, is_bold, is_static)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::AddSeparator() |
|
|
|
template <typename T> void Menu<T>::AddSeparator() |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_options.push_back(static_cast<Item *>(0)); |
|
|
|
m_options.push_back(static_cast<Item *>(0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::InsertItem(size_t pos, const T &item, bool is_bold, bool is_static) |
|
|
|
template <typename T> void Menu<T>::InsertItem(size_t pos, const T &item, bool is_bold, bool is_static) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_options.insert(m_options.begin()+pos, new Item(item, is_bold, is_static)); |
|
|
|
m_options.insert(m_options.begin()+pos, new Item(item, is_bold, is_static)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::InsertSeparator(size_t pos) |
|
|
|
template <typename T> void Menu<T>::InsertSeparator(size_t pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_options.insert(m_options.begin()+pos, 0); |
|
|
|
m_options.insert(m_options.begin()+pos, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::DeleteItem(size_t pos) |
|
|
|
template <typename T> void Menu<T>::DeleteItem(size_t pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_options_ptr->empty()) |
|
|
|
if (m_options_ptr->empty()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -717,25 +715,25 @@ template <typename T> void NCurses::Menu<T>::DeleteItem(size_t pos) |
|
|
|
Window::Clear(); |
|
|
|
Window::Clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::IntoSeparator(size_t pos) |
|
|
|
template <typename T> void Menu<T>::IntoSeparator(size_t pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
delete m_options_ptr->at(pos); |
|
|
|
delete m_options_ptr->at(pos); |
|
|
|
(*m_options_ptr)[pos] = 0; |
|
|
|
(*m_options_ptr)[pos] = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Bold(int pos, bool state) |
|
|
|
template <typename T> void Menu<T>::Bold(int pos, bool state) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
(*m_options_ptr)[pos]->isBold = state; |
|
|
|
(*m_options_ptr)[pos]->isBold = state; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Swap(size_t one, size_t two) |
|
|
|
template <typename T> void Menu<T>::Swap(size_t one, size_t two) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::swap(m_options.at(one), m_options.at(two)); |
|
|
|
std::swap(m_options.at(one), m_options.at(two)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Move(size_t from, size_t to) |
|
|
|
template <typename T> void Menu<T>::Move(size_t from, size_t to) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int diff = from-to; |
|
|
|
int diff = from-to; |
|
|
|
if (diff > 0) |
|
|
|
if (diff > 0) |
|
|
|
@ -750,7 +748,7 @@ template <typename T> void NCurses::Menu<T>::Move(size_t from, size_t to) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> bool NCurses::Menu<T>::Goto(size_t y) |
|
|
|
template <typename T> bool Menu<T>::Goto(size_t y) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->at(itsBeginning+y) || m_options_ptr->at(itsBeginning+y)->isStatic) |
|
|
|
if (!m_options_ptr->at(itsBeginning+y) || m_options_ptr->at(itsBeginning+y)->isStatic) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
@ -758,7 +756,7 @@ template <typename T> bool NCurses::Menu<T>::Goto(size_t y) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Refresh() |
|
|
|
template <typename T> void Menu<T>::Refresh() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_options_ptr->empty()) |
|
|
|
if (m_options_ptr->empty()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -826,7 +824,7 @@ template <typename T> void NCurses::Menu<T>::Refresh() |
|
|
|
Window::Refresh(); |
|
|
|
Window::Refresh(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Scroll(Where where) |
|
|
|
template <typename T> void Menu<T>::Scroll(Where where) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_options_ptr->empty()) |
|
|
|
if (m_options_ptr->empty()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -940,20 +938,20 @@ template <typename T> void NCurses::Menu<T>::Scroll(Where where) |
|
|
|
Highlight(itsHighlight); |
|
|
|
Highlight(itsHighlight); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Reset() |
|
|
|
template <typename T> void Menu<T>::Reset() |
|
|
|
{ |
|
|
|
{ |
|
|
|
itsHighlight = 0; |
|
|
|
itsHighlight = 0; |
|
|
|
itsBeginning = 0; |
|
|
|
itsBeginning = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::ClearFiltered() |
|
|
|
template <typename T> void Menu<T>::ClearFiltered() |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_filtered_options.clear(); |
|
|
|
m_filtered_options.clear(); |
|
|
|
m_filtered_positions.clear(); |
|
|
|
m_filtered_positions.clear(); |
|
|
|
m_options_ptr = &m_options; |
|
|
|
m_options_ptr = &m_options; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Clear() |
|
|
|
template <typename T> void Menu<T>::Clear() |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (auto it = m_options.begin(); it != m_options.end(); ++it) |
|
|
|
for (auto it = m_options.begin(); it != m_options.end(); ++it) |
|
|
|
delete *it; |
|
|
|
delete *it; |
|
|
|
@ -965,7 +963,7 @@ template <typename T> void NCurses::Menu<T>::Clear() |
|
|
|
Window::Clear(); |
|
|
|
Window::Clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> bool NCurses::Menu<T>::isBold(int pos) |
|
|
|
template <typename T> bool Menu<T>::isBold(int pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
@ -973,21 +971,21 @@ template <typename T> bool NCurses::Menu<T>::isBold(int pos) |
|
|
|
return (*m_options_ptr)[pos]->isBold; |
|
|
|
return (*m_options_ptr)[pos]->isBold; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Select(int pos, bool state) |
|
|
|
template <typename T> void Menu<T>::Select(int pos, bool state) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
(*m_options_ptr)[pos]->isSelected = state; |
|
|
|
(*m_options_ptr)[pos]->isSelected = state; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Static(int pos, bool state) |
|
|
|
template <typename T> void Menu<T>::Static(int pos, bool state) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
(*m_options_ptr)[pos]->isStatic = state; |
|
|
|
(*m_options_ptr)[pos]->isStatic = state; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> bool NCurses::Menu<T>::isSelected(int pos) const |
|
|
|
template <typename T> bool Menu<T>::isSelected(int pos) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
@ -995,7 +993,7 @@ template <typename T> bool NCurses::Menu<T>::isSelected(int pos) const |
|
|
|
return (*m_options_ptr)[pos]->isSelected; |
|
|
|
return (*m_options_ptr)[pos]->isSelected; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> bool NCurses::Menu<T>::isStatic(int pos) const |
|
|
|
template <typename T> bool Menu<T>::isStatic(int pos) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
@ -1003,13 +1001,13 @@ template <typename T> bool NCurses::Menu<T>::isStatic(int pos) const |
|
|
|
return (*m_options_ptr)[pos]->isStatic; |
|
|
|
return (*m_options_ptr)[pos]->isStatic; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> bool NCurses::Menu<T>::isSeparator(int pos) const |
|
|
|
template <typename T> bool Menu<T>::isSeparator(int pos) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
pos = pos == -1 ? itsHighlight : pos; |
|
|
|
return !m_options_ptr->at(pos); |
|
|
|
return !m_options_ptr->at(pos); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> bool NCurses::Menu<T>::hasSelected() const |
|
|
|
template <typename T> bool Menu<T>::hasSelected() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (auto it = m_options_ptr->begin(); it != m_options_ptr->end(); ++it) |
|
|
|
for (auto it = m_options_ptr->begin(); it != m_options_ptr->end(); ++it) |
|
|
|
if (*it && (*it)->isSelected) |
|
|
|
if (*it && (*it)->isSelected) |
|
|
|
@ -1017,30 +1015,30 @@ template <typename T> bool NCurses::Menu<T>::hasSelected() const |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::GetSelected(std::vector<size_t> &v) const |
|
|
|
template <typename T> void Menu<T>::GetSelected(std::vector<size_t> &v) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (size_t i = 0; i < m_options_ptr->size(); ++i) |
|
|
|
for (size_t i = 0; i < m_options_ptr->size(); ++i) |
|
|
|
if ((*m_options_ptr)[i] && (*m_options_ptr)[i]->isSelected) |
|
|
|
if ((*m_options_ptr)[i] && (*m_options_ptr)[i]->isSelected) |
|
|
|
v.push_back(i); |
|
|
|
v.push_back(i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::Highlight(size_t pos) |
|
|
|
template <typename T> void Menu<T>::Highlight(size_t pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
itsHighlight = pos; |
|
|
|
itsHighlight = pos; |
|
|
|
itsBeginning = pos-itsHeight/2; |
|
|
|
itsBeginning = pos-itsHeight/2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> size_t NCurses::Menu<T>::Size() const |
|
|
|
template <typename T> size_t Menu<T>::Size() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return m_options_ptr->size(); |
|
|
|
return m_options_ptr->size(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> size_t NCurses::Menu<T>::Choice() const |
|
|
|
template <typename T> size_t Menu<T>::Choice() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return itsHighlight; |
|
|
|
return itsHighlight; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> size_t NCurses::Menu<T>::RealChoice() const |
|
|
|
template <typename T> size_t Menu<T>::RealChoice() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t result = 0; |
|
|
|
size_t result = 0; |
|
|
|
for (auto it = m_options_ptr->begin(); it != m_options_ptr->begin()+itsHighlight; ++it) |
|
|
|
for (auto it = m_options_ptr->begin(); it != m_options_ptr->begin()+itsHighlight; ++it) |
|
|
|
@ -1049,7 +1047,7 @@ template <typename T> size_t NCurses::Menu<T>::RealChoice() const |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::ReverseSelection(size_t beginning) |
|
|
|
template <typename T> void Menu<T>::ReverseSelection(size_t beginning) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto it = m_options_ptr->begin()+beginning; |
|
|
|
auto it = m_options_ptr->begin()+beginning; |
|
|
|
for (size_t i = beginning; i < Size(); ++i, ++it) |
|
|
|
for (size_t i = beginning; i < Size(); ++i, ++it) |
|
|
|
@ -1057,7 +1055,7 @@ template <typename T> void NCurses::Menu<T>::ReverseSelection(size_t beginning) |
|
|
|
(*it)->isSelected = !(*it)->isSelected && !(*it)->isStatic; |
|
|
|
(*it)->isSelected = !(*it)->isSelected && !(*it)->isStatic; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> bool NCurses::Menu<T>::Search(const std::string &constraint, size_t beginning, int flags) |
|
|
|
template <typename T> bool Menu<T>::Search(const std::string &constraint, size_t beginning, int flags) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_found_positions.clear(); |
|
|
|
m_found_positions.clear(); |
|
|
|
m_search_constraint.clear(); |
|
|
|
m_search_constraint.clear(); |
|
|
|
@ -1077,7 +1075,7 @@ template <typename T> bool NCurses::Menu<T>::Search(const std::string &constrain |
|
|
|
return !m_found_positions.empty(); |
|
|
|
return !m_found_positions.empty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::NextFound(bool wrap) |
|
|
|
template <typename T> void Menu<T>::NextFound(bool wrap) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_found_positions.empty()) |
|
|
|
if (m_found_positions.empty()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -1088,7 +1086,7 @@ template <typename T> void NCurses::Menu<T>::NextFound(bool wrap) |
|
|
|
Highlight(*m_found_positions.begin()); |
|
|
|
Highlight(*m_found_positions.begin()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::PrevFound(bool wrap) |
|
|
|
template <typename T> void Menu<T>::PrevFound(bool wrap) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_found_positions.empty()) |
|
|
|
if (m_found_positions.empty()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -1099,7 +1097,7 @@ template <typename T> void NCurses::Menu<T>::PrevFound(bool wrap) |
|
|
|
Highlight(*m_found_positions.rbegin()); |
|
|
|
Highlight(*m_found_positions.rbegin()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> void NCurses::Menu<T>::ApplyFilter(const std::string &filter, size_t beginning, int flags) |
|
|
|
template <typename T> void Menu<T>::ApplyFilter(const std::string &filter, size_t beginning, int flags) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_found_positions.clear(); |
|
|
|
m_found_positions.clear(); |
|
|
|
ClearFiltered(); |
|
|
|
ClearFiltered(); |
|
|
|
@ -1129,12 +1127,12 @@ template <typename T> void NCurses::Menu<T>::ApplyFilter(const std::string &filt |
|
|
|
Window::Clear(); |
|
|
|
Window::Clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> const std::string &NCurses::Menu<T>::GetFilter() |
|
|
|
template <typename T> const std::string &Menu<T>::GetFilter() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return m_filter; |
|
|
|
return m_filter; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> std::string NCurses::Menu<T>::GetItem(size_t pos) |
|
|
|
template <typename T> std::string Menu<T>::GetItem(size_t pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_options_ptr->at(pos) && m_get_string_helper) |
|
|
|
if (m_options_ptr->at(pos) && m_get_string_helper) |
|
|
|
return m_get_string_helper((*m_options_ptr)[pos]->Value); |
|
|
|
return m_get_string_helper((*m_options_ptr)[pos]->Value); |
|
|
|
@ -1142,61 +1140,63 @@ template <typename T> std::string NCurses::Menu<T>::GetItem(size_t pos) |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> T &NCurses::Menu<T>::Back() |
|
|
|
template <typename T> T &Menu<T>::Back() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->back()) |
|
|
|
if (!m_options_ptr->back()) |
|
|
|
FatalError("Menu::Back() has requested separator!"); |
|
|
|
FatalError("Menu::Back() has requested separator!"); |
|
|
|
return m_options_ptr->back()->Value; |
|
|
|
return m_options_ptr->back()->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> const T &NCurses::Menu<T>::Back() const |
|
|
|
template <typename T> const T &Menu<T>::Back() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->back()) |
|
|
|
if (!m_options_ptr->back()) |
|
|
|
FatalError("Menu::Back() has requested separator!"); |
|
|
|
FatalError("Menu::Back() has requested separator!"); |
|
|
|
return m_options_ptr->back()->Value; |
|
|
|
return m_options_ptr->back()->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> T &NCurses::Menu<T>::Current() |
|
|
|
template <typename T> T &Menu<T>::Current() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->at(itsHighlight)) |
|
|
|
if (!m_options_ptr->at(itsHighlight)) |
|
|
|
FatalError("Menu::Current() has requested separator!"); |
|
|
|
FatalError("Menu::Current() has requested separator!"); |
|
|
|
return (*m_options_ptr)[itsHighlight]->Value; |
|
|
|
return (*m_options_ptr)[itsHighlight]->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> const T &NCurses::Menu<T>::Current() const |
|
|
|
template <typename T> const T &Menu<T>::Current() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->at(itsHighlight)) |
|
|
|
if (!m_options_ptr->at(itsHighlight)) |
|
|
|
FatalError("Menu::Current() const has requested separator!"); |
|
|
|
FatalError("Menu::Current() const has requested separator!"); |
|
|
|
return (*m_options_ptr)[itsHighlight]->Value; |
|
|
|
return (*m_options_ptr)[itsHighlight]->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> T &NCurses::Menu<T>::at(size_t pos) |
|
|
|
template <typename T> T &Menu<T>::at(size_t pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
if (!m_options_ptr->at(pos)) |
|
|
|
FatalError("Menu::at() has requested separator!"); |
|
|
|
FatalError("Menu::at() has requested separator!"); |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> const T &NCurses::Menu<T>::at(size_t pos) const |
|
|
|
template <typename T> const T &Menu<T>::at(size_t pos) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_options->at(pos)) |
|
|
|
if (!m_options->at(pos)) |
|
|
|
FatalError("Menu::at() const has requested separator!"); |
|
|
|
FatalError("Menu::at() const has requested separator!"); |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> const T &NCurses::Menu<T>::operator[](size_t pos) const |
|
|
|
template <typename T> const T &Menu<T>::operator[](size_t pos) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!(*m_options_ptr)[pos]) |
|
|
|
if (!(*m_options_ptr)[pos]) |
|
|
|
FatalError("Menu::operator[] const has requested separator!"); |
|
|
|
FatalError("Menu::operator[] const has requested separator!"); |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> T &NCurses::Menu<T>::operator[](size_t pos) |
|
|
|
template <typename T> T &Menu<T>::operator[](size_t pos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!(*m_options_ptr)[pos]) |
|
|
|
if (!(*m_options_ptr)[pos]) |
|
|
|
FatalError("Menu::operator[] has requested separator!"); |
|
|
|
FatalError("Menu::operator[] has requested separator!"); |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
return (*m_options_ptr)[pos]->Value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|