81 lines
1.6 KiB
C++
81 lines
1.6 KiB
C++
|
|
#include <list>
|
|
using namespace std;
|
|
|
|
#include <ocarina/button.h>
|
|
#include <libsaria/libsaria.h>
|
|
|
|
static list<GtkWidget *> play_buttons;
|
|
static list<GtkWidget *> pause_buttons;
|
|
|
|
static list<GtkWidget *> *get_buttons(button_list_t bttn_list)
|
|
{
|
|
switch(bttn_list) {
|
|
case PLAY_BUTTON_LIST:
|
|
return &play_buttons;
|
|
default:
|
|
return &pause_buttons;
|
|
}
|
|
}
|
|
|
|
void show_button_list(button_list_t bttn_list)
|
|
{
|
|
list<GtkWidget *>::iterator it;
|
|
list<GtkWidget *> *buttons = get_buttons(bttn_list);
|
|
for (it = buttons->begin(); it != buttons->end(); it++)
|
|
gtk_widget_show(*it);
|
|
}
|
|
|
|
void hide_button_list(button_list_t bttn_list)
|
|
{
|
|
list<GtkWidget *>::iterator it;
|
|
list<GtkWidget *> *buttons = get_buttons(bttn_list);
|
|
for (it = buttons->begin(); it != buttons->end(); it++)
|
|
gtk_widget_hide(*it);
|
|
}
|
|
|
|
static void on_click_play(GtkWidget *b, GdkEvent *e, gpointer d)
|
|
{
|
|
libsaria_get()->play();
|
|
}
|
|
|
|
GtkWidget *make_play_button(GtkIconSize size)
|
|
{
|
|
GtkWidget *b = make_button(GTK_STOCK_MEDIA_PLAY,
|
|
size,
|
|
on_click_play,
|
|
true);
|
|
play_buttons.push_back(b);
|
|
return b;
|
|
}
|
|
|
|
static void on_click_pause(GtkWidget *b, GdkEvent *e, gpointer d)
|
|
{
|
|
libsaria_get()->pause();
|
|
}
|
|
|
|
GtkWidget *make_pause_button(GtkIconSize size)
|
|
{
|
|
GtkWidget *b = make_button(GTK_STOCK_MEDIA_PAUSE,
|
|
size,
|
|
on_click_pause,
|
|
false);
|
|
pause_buttons.push_back(b);
|
|
return b;
|
|
}
|
|
|
|
static void on_click_stop(GtkWidget *b, GdkEvent *e, gpointer d)
|
|
{
|
|
libsaria_get()->stop();
|
|
}
|
|
|
|
GtkWidget *make_stop_button(GtkIconSize size)
|
|
{
|
|
return make_button(GTK_STOCK_MEDIA_STOP,
|
|
size,
|
|
on_click_stop,
|
|
true);
|
|
}
|
|
|
|
|