ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/MenuList.hpp
Revision: 43
Committed: 2008-03-06T13:34:03-08:00 (14 years, 9 months ago) by douglas
File size: 2497 byte(s)
Log Message:
The top menu should be complete, unless I add something else.

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

Properties

Name Value
svn:keywords Id