/* * Copyright 2016 (c) Anna Schumaker. */ #ifndef OCARINA_GUI_QUEUE_H #define OCARINA_GUI_QUEUE_H #include enum gui_queue_flags { 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. */ }; struct gui_queue { unsigned int gq_flags; gchar *gq_text; struct queue *gq_queue; }; /* Called to allocate a new struct gui_queue. */ struct gui_queue *gui_queue_alloc(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 (struct gui_queue *)queue->q_private; } /* 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; } /* 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; } /* Called to set the correct state of the random and repeat buttons. */ void gui_queue_show(struct gui_queue *); #endif /* OCARINA_GUI_QUEUE_H */