ocarina/include/gui/queue.h

53 lines
1.3 KiB
C

/*
* Copyright 2016 (c) Anna Schumaker.
*/
#ifndef OCARINA_GUI_QUEUE_H
#define OCARINA_GUI_QUEUE_H
#include <core/queue.h>
#include <gui/model.h>
enum gui_queue_flags {
GQ_CAN_RANDOM = (1 << 0), /* Random button can be clicked. */
};
struct gui_queue {
unsigned int gq_flags;
unsigned int gq_active;
gchar *gq_text;
gchar **gq_search;
struct playlist *gq_playlist;
struct queue *gq_queue;
};
/* Called to initialize the gui_queue code. */
void gui_queue_init(void);
/* Called to allocate a new struct gui_queue. */
struct gui_queue *gui_queue_alloc(struct playlist *, struct queue *,
const gchar *, unsigned int);
/* Called to free a struct gui_queue. */
void gui_queue_free(struct queue *);
/* Called to access a the struct gui_queue attached to a queue. */
static inline struct gui_queue *gui_queue(struct queue *queue)
{
return queue ? (struct gui_queue *)queue->q_private : NULL;
}
/* Called to ask the struct gui_queue if it can change random flag. */
static inline bool gui_queue_can_random(struct gui_queue *gq)
{
if (gq)
return (gq->gq_flags & GQ_CAN_RANDOM) == GQ_CAN_RANDOM;
return false;
}
/* Called to set the correct state of the random and repeat buttons. */
void gui_queue_show(struct gui_queue *);
#endif /* OCARINA_GUI_QUEUE_H */