option parser: make assign_default_once work with non-copyable types
[ncmpcpp.git] / src / interfaces.h
blob797849bd5607cf65c6237dca6b4d962a96580dc6
1 /***************************************************************************
2 * Copyright (C) 2008-2014 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef NCMPCPP_INTERFACES_H
22 #define NCMPCPP_INTERFACES_H
24 #include <string>
25 #include "gcc.h"
26 #include "screen.h"
27 #include "song.h"
28 #include "proxy_song_list.h"
30 struct Filterable
32 virtual bool allowsFiltering() = 0;
33 virtual std::string currentFilter() = 0;
34 virtual void applyFilter(const std::string &filter) = 0;
37 struct Searchable
39 virtual bool allowsSearching() = 0;
40 virtual bool search(const std::string &constraint) = 0;
41 virtual void nextFound(bool wrap) = 0;
42 virtual void prevFound(bool wrap) = 0;
45 struct HasSongs
47 virtual ProxySongList proxySongList() = 0;
49 virtual bool allowsSelection() = 0;
50 virtual void reverseSelection() = 0;
51 virtual MPD::SongList getSelectedSongs() = 0;
54 struct HasColumns
56 virtual bool previousColumnAvailable() = 0;
57 virtual void previousColumn() = 0;
59 virtual bool nextColumnAvailable() = 0;
60 virtual void nextColumn() = 0;
63 struct Tabbable
65 Tabbable() : m_previous_screen(0) { }
67 void switchToPreviousScreen() const {
68 if (m_previous_screen)
69 m_previous_screen->switchTo();
71 void setPreviousScreen(BaseScreen *screen) {
72 m_previous_screen = screen;
74 BaseScreen *previousScreen() const {
75 return m_previous_screen;
78 private:
79 BaseScreen *m_previous_screen;
82 #endif // NCMPCPP_INTERFACES_H