change version to 0.7.3
[ncmpcpp.git] / src / sel_items_adder.h
blob4b27ba65514baf2b155fd6e3b3a121d38168a0e4
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 implemenetation
53 virtual bool actionRunnable() OVERRIDE;
54 virtual void runAction() OVERRIDE;
56 // Searchable implementation
57 virtual bool allowsSearching() OVERRIDE;
58 virtual void setSearchConstraint(const std::string &constraint) OVERRIDE;
59 virtual void clearConstraint() OVERRIDE;
60 virtual bool find(SearchDirection direction, bool wrap, bool skip_current) OVERRIDE;
62 private:
63 void populatePlaylistSelector(BaseScreen *screen);
65 void addToCurrentPlaylist();
66 void addToNewPlaylist() const;
67 void addToExistingPlaylist(const std::string &playlist) const;
68 void addAtTheEndOfPlaylist() const;
69 void addAtTheBeginningOfPlaylist() const;
70 void addAfterCurrentSong() const;
71 void addAfterCurrentAlbum() const;
72 void addAfterHighlightedSong() const;
73 void cancel();
74 void exitSuccessfully(bool success) const;
76 void setDimensions();
78 size_t m_playlist_selector_width;
79 size_t m_playlist_selector_height;
81 size_t m_position_selector_width;
82 size_t m_position_selector_height;
84 Component m_playlist_selector;
85 Component m_position_selector;
87 std::vector<MPD::Song> m_selected_items;
89 Regex::ItemFilter<Entry> m_search_predicate;
92 extern SelectedItemsAdder *mySelectedItemsAdder;
94 #endif // NCMPCPP_SEL_ITEMS_ADDER_H