1 /*******************************************************************************
2 *                         Goggles Music Manager                                *
3 ********************************************************************************
4 *           Copyright (C) 2009-2021 by Sander Jansen. All Rights Reserved      *
5 *                               ---                                            *
6 * This program is free software: you can redistribute it and/or modify         *
7 * it under the terms of the GNU General Public License as published by         *
8 * the Free Software Foundation, either version 3 of the License, or            *
9 * (at your option) any later version.                                          *
10 *                                                                              *
11 * This program is distributed in the hope that it will be useful,              *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of               *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                *
14 * GNU General Public License for more details.                                 *
15 *                                                                              *
16 * You should have received a copy of the GNU General Public License            *
17 * along with this program.  If not, see http://www.gnu.org/licenses.           *
18 ********************************************************************************/
19 #ifndef GMPLAYQUEUE_H
20 #define GMPLAYQUEUE_H
21 
22 class GMPlayListSource;
23 
24 class GMPlayQueue : public GMPlayListSource {
25 FXDECLARE(GMPlayQueue)
26 protected:
27   FXIntMap tracks;
28   FXint   ntracks  = 0;
29   FXbool  poptrack = false;
30 protected:
GMPlayQueue()31   GMPlayQueue(){}
32   void updateTrackHash();
33 private:
34   GMPlayQueue(const GMPlayQueue&);
35   GMPlayQueue& operator=(const GMPlayQueue&);
36 public:
37   long onCmdRemoveInPlaylist(FXObject*,FXSelector,void*);
38   long onCmdClear(FXObject*,FXSelector,void*);
39 public:
40   enum {
41     ID_CLEAR = GMPlayListSource::ID_LAST,
42     ID_LAST
43     };
44 public:
45   GMPlayQueue(GMTrackDatabase * db);
46 
47   void configure(GMColumnList& list) override;
48 
49   FXbool canPlaySource(GMSource * src) const;
50 
51   FXbool findCurrent(GMTrackList * tracklist,GMSource * src) override;
52 
53   FXint getNumTracks() const override;
54 
canBrowse()55   FXbool canBrowse() const override { return false; }
56 
57   FXbool source_context_menu(FXMenuPane * pane) override;
58 
59   FXbool track_context_menu(FXMenuPane * pane) override;
60 
61   FXString getName() const override;
62 
63   void addTracks(GMSource * src,const FXIntList & tracks) override;
64 
65   using GMSource::hasTrack;
66 
67   FXbool hasTrack(FXint id) const;
68 
69   FXint getCurrent();
70 
71   FXint getNext();
72 
getType()73   FXint getType() const override { return SOURCE_PLAYQUEUE; }
74 
75   virtual ~GMPlayQueue();
76   };
77 #endif
78