scrollpad: explicitely include iostream
[ncmpcpp.git] / src / playlist_editor.h
blob803cfe6f7f6a0a808701ab81f5e51022ba827126
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_PLAYLIST_EDITOR_H
22 #define NCMPCPP_PLAYLIST_EDITOR_H
24 #include <boost/date_time/posix_time/posix_time_types.hpp>
26 #include "interfaces.h"
27 #include "screen.h"
29 struct PlaylistEditor: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Searchable, Tabbable
31 PlaylistEditor();
33 virtual void switchTo() OVERRIDE;
34 virtual void resize() OVERRIDE;
36 virtual std::wstring title() OVERRIDE;
37 virtual ScreenType type() OVERRIDE { return ScreenType::PlaylistEditor; }
39 virtual void refresh() OVERRIDE;
40 virtual void update() OVERRIDE;
42 virtual int windowTimeout() OVERRIDE;
44 virtual void enterPressed() OVERRIDE;
45 virtual void spacePressed() OVERRIDE;
46 virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
48 virtual bool isMergable() OVERRIDE { return true; }
50 // Filterable implementation
51 virtual bool allowsFiltering() OVERRIDE;
52 virtual std::string currentFilter() OVERRIDE;
53 virtual void applyFilter(const std::string &filter) OVERRIDE;
55 // Searchable implementation
56 virtual bool allowsSearching() OVERRIDE;
57 virtual bool search(const std::string &constraint) OVERRIDE;
58 virtual void nextFound(bool wrap) OVERRIDE;
59 virtual void prevFound(bool wrap) OVERRIDE;
61 // HasSongs implementation
62 virtual ProxySongList proxySongList() OVERRIDE;
64 virtual bool allowsSelection() OVERRIDE;
65 virtual void reverseSelection() OVERRIDE;
66 virtual MPD::SongList getSelectedSongs() OVERRIDE;
68 // HasColumns implementation
69 virtual bool previousColumnAvailable() OVERRIDE;
70 virtual void previousColumn() OVERRIDE;
72 virtual bool nextColumnAvailable() OVERRIDE;
73 virtual void nextColumn() OVERRIDE;
75 // private members
76 void updateTimer();
78 void requestPlaylistsUpdate() { m_playlists_update_requested = true; }
79 void requestContentsUpdate() { m_content_update_requested = true; }
81 virtual void Locate(const std::string &);
82 bool isContentFiltered();
83 ProxySongList contentProxyList();
85 NC::Menu<std::string> Playlists;
86 NC::Menu<MPD::Song> Content;
88 protected:
89 virtual bool isLockable() OVERRIDE { return true; }
91 private:
92 void AddToPlaylist(bool);
94 bool m_playlists_update_requested;
95 bool m_content_update_requested;
97 boost::posix_time::ptime m_timer;
100 extern PlaylistEditor *myPlaylistEditor;
102 #endif // NCMPCPP_PLAYLIST_EDITOR_H