ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/MenuList.hpp
Revision: 47
Committed: 2008-03-07T03:08:31-08:00 (17 years, 3 months ago) by douglas
File size: 3043 byte(s)
Log Message:
Progress, needs moar workz.

File Contents

# User Rev Content
1 douglas 42 // Menu List
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #ifndef _MenuList_hpp_
8     #define _MenuList_hpp_
9    
10     #include <vector>
11    
12     #include <Audacious.hpp>
13 douglas 47 #include <MusicLibrary.hpp>
14 douglas 42
15     #include "Display.hpp"
16 douglas 47 #include "Filter.hpp"
17 douglas 42
18     struct MenuList
19     {
20     protected:
21     static MenuList *previous;
22    
23     private:
24     MenuList *parent;
25     Display &display;
26 douglas 44 size_t cursor;
27 douglas 42
28     struct State
29     {
30 douglas 44 size_t item, top, bottom;
31 douglas 42
32 douglas 44 State() : item(0), top(0), bottom(4) {}
33 douglas 42
34     bool operator !=(const State &state) const
35     {
36     return top != state.top;
37     }
38     } state, old;
39    
40     public:
41     struct MenuItem
42     {
43     protected:
44     MenuList *list;
45    
46     public:
47     MenuItem(MenuList *list);
48    
49     virtual MenuList *Select() = 0;
50     virtual operator std::string() const = 0;
51     };
52    
53     struct BoolItem
54     {
55     virtual operator bool() const = 0;
56     };
57    
58     struct SubItem {};
59    
60     protected:
61     std::vector<MenuItem *> list;
62    
63     public:
64 douglas 47 MenuList(MenuList *parent, Display &display, size_t size);
65     MenuList(MenuList *parent);
66 douglas 42 virtual ~MenuList();
67    
68     MenuList *Enter();
69     MenuList *Left();
70     MenuList *Right();
71     void Render();
72     MenuList &operator ++();
73     MenuList &operator --();
74     };
75    
76     struct TopList : public MenuList
77     {
78     class AppendItem : public MenuItem, public BoolItem
79     {
80     bool &append;
81    
82     public:
83     AppendItem(MenuList *list, bool &append);
84    
85     virtual MenuList *Select();
86     virtual operator std::string() const;
87     virtual operator bool() const;
88     };
89    
90     class ShuffleItem : public MenuItem, public BoolItem
91     {
92     Audacious::Audacious &audacious;
93    
94     public:
95     ShuffleItem(MenuList *list, Audacious::Audacious &audacious);
96    
97     virtual MenuList *Select();
98     virtual operator std::string() const;
99     virtual operator bool() const;
100     };
101    
102 douglas 43 class MusicItem : public MenuItem, public SubItem
103     {
104     Audacious::Audacious &audacious;
105 douglas 47 bool &append;
106     MusicLibrary::Library &library;
107 douglas 43
108     public:
109 douglas 47 MusicItem(MenuList *list, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library);
110 douglas 43
111     virtual MenuList *Select();
112     virtual operator std::string() const;
113     };
114    
115 douglas 47 TopList(Display &display, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library);
116 douglas 42 };
117    
118     struct ArtistList : public MenuList
119     {
120 douglas 47 class AllItem : public MenuItem
121 douglas 42 {
122 douglas 47 Audacious::Audacious &audacious;
123     bool &append;
124     MusicLibrary::Library &library;
125    
126     public:
127     AllItem(MenuList *list, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library);
128    
129     virtual MenuList *Select();
130     virtual operator std::string() const;
131 douglas 42 };
132    
133 douglas 47 /*class ArtistItem : public MenuItem, public SubItem
134 douglas 42 {
135     };*/
136    
137 douglas 47 ArtistList(MenuList *parent, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library);
138 douglas 42 };
139    
140     struct AlbumList : public MenuList
141     {
142     /*class AllItem : public MenuItem
143     {
144     };
145    
146 douglas 43 class AlbumItem : public MenuItem, public SubItem
147 douglas 42 {
148     };*/
149    
150 douglas 47 AlbumList(MenuList *parent, Audacious::Audacious &audacious, bool &append);
151 douglas 42 };
152    
153     struct SongList : public MenuList
154     {
155     /*class AllItem : public MenuItem
156     {
157     };
158    
159     class SongItem : public MenuItem
160     {
161     };*/
162    
163 douglas 47 SongList(MenuList *parent, Audacious::Audacious &audacious, bool &append);
164 douglas 42 };
165    
166     #endif//_MenuList_hpp_

Properties

Name Value
svn:keywords Id