configure: require c++14 compatible compiler
[ncmpcpp.git] / src / sel_items_adder.h
blob2bb05ca1da787cf5bd7993d9ffde0ab47471ea15
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_SEL_ITEMS_ADDER_H
22 #define NCMPCPP_SEL_ITEMS_ADDER_H
24 #include "runnable_item.h"
25 #include "interfaces.h"
26 #include "regex_filter.h"
27 #include "screen.h"
28 #include "song.h"
30 struct SelectedItemsAdder: Screen<NC::Menu<RunnableItem<std::string, void()>> *>, HasActions, Searchable, Tabbable
32 typedef SelectedItemsAdder Self;
33 typedef typename std::remove_pointer<WindowType>::type Component;
34 typedef Component::Item::Type Entry;
36 SelectedItemsAdder();
38 virtual void switchTo() override;
39 virtual void resize() override;
40 virtual void refresh() override;
42 virtual std::wstring title() override;
43 virtual ScreenType type() override { return ScreenType::SelectedItemsAdder; }
45 virtual void update() override { }
47 virtual void mouseButtonPressed(MEVENT me) override;
49 virtual bool isLockable() override { return false; }
50 virtual bool isMergable() override { return false; }
52 // HasActions implementation
53 virtual bool actionRunnable() override;
54 virtual void runAction() override;
56 // Searchable implementation
57 virtual bool allowsSearching() override;
58 virtual const std::string &searchConstraint() override;
59 virtual void setSearchConstraint(const std::string &constraint) override;
60 virtual void clearSearchConstraint() override;
61 virtual bool search(SearchDirection direction, bool wrap, bool skip_current) override;
63 private:
64 void populatePlaylistSelector(BaseScreen *screen);
66 void addToCurrentPlaylist();
67 void addToNewPlaylist() const;
68 void addToExistingPlaylist(const std::string &playlist) const;
69 void addAtTheEndOfPlaylist() const;
70 void addAtTheBeginningOfPlaylist() const;
71 void addAfterCurrentSong() const;
72 void addAfterCurrentAlbum() const;
73 void addAfterHighlightedSong() const;
74 void cancel();
75 void exitSuccessfully(bool success) const;
77 void setDimensions();
79 size_t m_playlist_selector_width;
80 size_t m_playlist_selector_height;
82 size_t m_position_selector_width;
83 size_t m_position_selector_height;
85 Component m_playlist_selector;
86 Component m_position_selector;
88 std::vector<MPD::Song> m_selected_items;
90 Regex::ItemFilter<Entry> m_search_predicate;
93 extern SelectedItemsAdder *mySelectedItemsAdder;
95 #endif // NCMPCPP_SEL_ITEMS_ADDER_H