2016-01-12 08:19:05 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2016 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#ifndef OCARINA_GUI_QUEUE_H
|
|
|
|
#define OCARINA_GUI_QUEUE_H
|
|
|
|
|
|
|
|
#include <core/queue.h>
|
|
|
|
|
2016-01-14 08:00:04 -05:00
|
|
|
enum gui_queue_flags {
|
2016-01-15 12:12:12 -05:00
|
|
|
GQ_CAN_RANDOM = (1 << 0), /* Random button can be clicked. */
|
|
|
|
GQ_CAN_REPEAT = (1 << 1), /* Repeat button can be clicked. */
|
|
|
|
GQ_CAN_DISABLE = (1 << 2), /* Disable switch can be clicked. */
|
2016-01-14 08:00:04 -05:00
|
|
|
};
|
|
|
|
|
2016-01-12 08:19:05 -05:00
|
|
|
struct gui_queue {
|
2016-01-14 08:00:04 -05:00
|
|
|
unsigned int gq_flags;
|
2016-01-13 16:48:43 -05:00
|
|
|
gchar *gq_text;
|
2016-01-14 08:00:04 -05:00
|
|
|
|
|
|
|
struct queue *gq_queue;
|
2016-01-12 08:19:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Called to allocate a new struct gui_queue. */
|
2016-01-14 08:00:04 -05:00
|
|
|
struct gui_queue *gui_queue_alloc(struct queue *, const gchar *, unsigned int);
|
2016-01-12 08:19:05 -05:00
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
2016-01-13 09:37:05 -05:00
|
|
|
return (struct gui_queue *)queue->q_private;
|
2016-01-12 08:19:05 -05:00
|
|
|
}
|
|
|
|
|
2016-01-14 08:00:04 -05:00
|
|
|
/* 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 ask the struct gui_queue if it can change repeat flag. */
|
|
|
|
static inline bool gui_queue_can_repeat(struct gui_queue *gq)
|
|
|
|
{
|
|
|
|
if (gq)
|
|
|
|
return (gq->gq_flags & GQ_CAN_REPEAT) == GQ_CAN_REPEAT;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-15 12:12:12 -05:00
|
|
|
/* Called to ask the struct gui_queue if it can change enabled flag. */
|
|
|
|
static inline bool gui_queue_can_disable(struct gui_queue *gq)
|
|
|
|
{
|
|
|
|
if (gq)
|
|
|
|
return (gq->gq_flags & GQ_CAN_DISABLE) == GQ_CAN_DISABLE;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-14 08:59:26 -05:00
|
|
|
/* Called to set the correct state of the random and repeat buttons. */
|
|
|
|
void gui_queue_show(struct gui_queue *);
|
|
|
|
|
2016-01-12 08:19:05 -05:00
|
|
|
#endif /* OCARINA_GUI_QUEUE_H */
|