menu: get rid of a few List functions

This commit is contained in:
Andrzej Rybczak
2012-08-31 13:05:48 +02:00
parent 1596c8ed40
commit f1625c920a
2 changed files with 6 additions and 21 deletions

View File

@@ -514,10 +514,10 @@ void ScrollUpArtist::Run()
while (pos > 0) while (pos > 0)
{ {
s = myScreen->GetSong(--pos); s = myScreen->GetSong(--pos);
myScreen->Scroll(wUp);
if (!s || s->getArtist() != artist) if (!s || s->getArtist() != artist)
break; break;
} }
mList->Highlight(pos);
} }
} }
@@ -533,10 +533,10 @@ void ScrollUpAlbum::Run()
while (pos > 0) while (pos > 0)
{ {
s = myScreen->GetSong(--pos); s = myScreen->GetSong(--pos);
myScreen->Scroll(wUp);
if (!s || s->getAlbum() != album) if (!s || s->getAlbum() != album)
break; break;
} }
mList->Highlight(pos);
} }
} }
@@ -552,10 +552,10 @@ void ScrollDownArtist::Run()
while (pos < mList->Size() - 1) while (pos < mList->Size() - 1)
{ {
s = myScreen->GetSong(++pos); s = myScreen->GetSong(++pos);
myScreen->Scroll(wDown);
if (!s || s->getArtist() != artist) if (!s || s->getArtist() != artist)
break; break;
} }
mList->Highlight(pos);
} }
} }
@@ -571,10 +571,10 @@ void ScrollDownAlbum::Run()
while (pos < mList->Size() - 1) while (pos < mList->Size() - 1)
{ {
s = myScreen->GetSong(++pos); s = myScreen->GetSong(++pos);
myScreen->Scroll(wDown);
if (!s || s->getAlbum() != album) if (!s || s->getAlbum() != album)
break; break;
} }
mList->Highlight(pos);
} }
} }
@@ -1806,8 +1806,6 @@ void DeselectItems::Run()
{ {
// FIXME // FIXME
/*List *mList = myScreen->GetList(); /*List *mList = myScreen->GetList();
if (!mList->hasSelected())
return;
for (size_t i = 0; i < mList->Size(); ++i) for (size_t i = 0; i < mList->Size(); ++i)
mList->Select(i, 0); mList->Select(i, 0);
ShowMessage("Items deselected");*/ ShowMessage("Items deselected");*/

View File

@@ -37,19 +37,6 @@ namespace NCurses {
/// ///
struct List struct List
{ {
/// @see Menu::hasSelected()
///
virtual bool hasSelected() const = 0;
/// @see Menu::GetSelected()
///
virtual void GetSelected(std::vector<size_t> &v) const = 0;
/// Highlights given position
/// @param pos position to be highlighted
///
virtual void Highlight(size_t pos) = 0;
/// @return currently highlighted position /// @return currently highlighted position
/// ///
virtual size_t Choice() const = 0; virtual size_t Choice() const = 0;
@@ -314,12 +301,12 @@ template <typename T> struct Menu : public Window, public List
/// Checks whether list contains selected positions /// Checks whether list contains selected positions
/// @return true if it contains them, false otherwise /// @return true if it contains them, false otherwise
/// ///
virtual bool hasSelected() const; bool hasSelected() const;
/// Gets positions of items that are selected /// Gets positions of items that are selected
/// @param v vector to be filled with selected positions numbers /// @param v vector to be filled with selected positions numbers
/// ///
virtual void GetSelected(std::vector<size_t> &v) const; void GetSelected(std::vector<size_t> &v) const;
/// Reverses selection of all items in list /// Reverses selection of all items in list
/// @param beginning beginning of range that has to be reversed /// @param beginning beginning of range that has to be reversed