ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/MenuList.hpp
Revision: 42
Committed: 2008-03-06T13:04:20-08:00 (14 years, 9 months ago) by douglas
File size: 2228 byte(s)
Log Message:
Beginnings of a menu?

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 TopList(Audacious::Audacious &audacious, Display &display, bool &append);
99 };
100
101 struct ArtistList : public MenuList
102 {
103 /*class AllItem : public MenuItem
104 {
105 };
106
107 class ArtistItem : public MenuItem
108 {
109 };*/
110
111 ArtistList(Audacious::Audacious &audacious, Display &display);
112 };
113
114 struct AlbumList : public MenuList
115 {
116 /*class AllItem : public MenuItem
117 {
118 };
119
120 class AlbumItem : public MenuItem
121 {
122 };*/
123
124 AlbumList(Audacious::Audacious &audacious, Display &display);
125 };
126
127 struct SongList : public MenuList
128 {
129 /*class AllItem : public MenuItem
130 {
131 };
132
133 class SongItem : public MenuItem
134 {
135 };*/
136
137 SongList(Audacious::Audacious &audacious, Display &display);
138 };
139
140 #endif//_MenuList_hpp_

Properties

Name Value
svn:keywords Id