libsaria: Return nth renderer
Useful for switching to a specific list in the UI Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
c953ce6fd4
commit
691f74ee10
|
@ -55,6 +55,7 @@ namespace libsaria
|
|||
Playlist(string, unsigned int, PlaylistType);
|
||||
~Playlist();
|
||||
void set_renderer(PlaylistRenderer *);
|
||||
PlaylistRenderer *get_renderer();
|
||||
|
||||
bool is_static();
|
||||
void prepare_for_removal();
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace libsaria
|
|||
void prev();
|
||||
void init();
|
||||
Playlist *get_recent_plist();
|
||||
PlaylistRenderer *get_nth_renderer(unsigned int);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -66,6 +66,11 @@ namespace libsaria
|
|||
renderer = r;
|
||||
}
|
||||
|
||||
PlaylistRenderer *Playlist::get_renderer()
|
||||
{
|
||||
return renderer;
|
||||
}
|
||||
|
||||
void Playlist::reset_iterator()
|
||||
{
|
||||
cur = plist.begin();
|
||||
|
|
|
@ -127,4 +127,18 @@ namespace libsaria
|
|||
return &recent_plist;
|
||||
}
|
||||
|
||||
PlaylistRenderer *stack::get_nth_renderer(unsigned int n)
|
||||
{
|
||||
list<Playlist *>::iterator it = playlist_stack.begin();
|
||||
unsigned int max = (playlist_stack.size() - num_static);
|
||||
println("n: %u, max: %u", n, max);
|
||||
|
||||
if (n >= max)
|
||||
return NULL;
|
||||
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
it++;
|
||||
return (*it)->get_renderer();
|
||||
}
|
||||
|
||||
}; /* Namespace: libsaria */
|
||||
|
|
Loading…
Reference in New Issue