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, 7 months ago) by douglas
File size: 2536 byte(s)
Log Message:
Cleanup!

File Contents

# Content
1 // 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 size_t cursor;
25
26 struct State
27 {
28 size_t item, top, bottom;
29
30 State() : item(0), top(0), bottom(4) {}
31
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 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 TopList(Display &display, Audacious::Audacious &audacious, bool &append);
111 };
112
113 struct ArtistList : public MenuList
114 {
115 /*class AllItem : public MenuItem
116 {
117 };
118
119 class ArtistItem : public MenuItem, public SubItem
120 {
121 };*/
122
123 ArtistList(Display &display, Audacious::Audacious &audacious, bool &append);
124 };
125
126 struct AlbumList : public MenuList
127 {
128 /*class AllItem : public MenuItem
129 {
130 };
131
132 class AlbumItem : public MenuItem, public SubItem
133 {
134 };*/
135
136 AlbumList(Display &display, Audacious::Audacious &audacious, bool &append);
137 };
138
139 struct SongList : public MenuList
140 {
141 /*class AllItem : public MenuItem
142 {
143 };
144
145 class SongItem : public MenuItem
146 {
147 };*/
148
149 SongList(Display &display, Audacious::Audacious &audacious, bool &append);
150 };
151
152 #endif//_MenuList_hpp_

Properties

Name Value
svn:keywords Id