ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/MenuList.hpp
Revision: 44
Committed: 2008-03-06T15:21:03-08:00 (14 years, 8 months ago) by douglas
File size: 2536 byte(s)
Log Message:
Cleanup!

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

Properties

Name Value
svn:keywords Id