41 lines
1018 B
C++
41 lines
1018 B
C++
|
|
#include <ocarina/button.h>
|
|
#include <libsaria/audio.h>
|
|
#include <libsaria/libsaria.h>
|
|
|
|
#define ls_on_click(func) \
|
|
static void on_click_##func(GtkWidget *button, GdkEvent *event, gpointer data)\
|
|
{ \
|
|
libsaria_get()->func(); \
|
|
}
|
|
|
|
#define on_click(func) \
|
|
on_click_##func
|
|
|
|
GtkWidget *make_button(const gchar *stockid, GtkIconSize size)
|
|
{
|
|
GtkWidget *button = gtk_button_new();
|
|
GtkWidget *box = gtk_hbox_new(FALSE, 0);
|
|
GtkWidget *image = gtk_image_new_from_stock(stockid, size);
|
|
box_pack_start(box, image, FALSE, FALSE, 0);
|
|
container_add(button, box);
|
|
gtk_widget_show_all(button);
|
|
return button;
|
|
}
|
|
|
|
ls_on_click(play);
|
|
GtkWidget *make_play_button(GtkIconSize size)
|
|
{
|
|
GtkWidget *button = make_button(GTK_STOCK_MEDIA_PLAY, size);
|
|
GTK_CONNECT(button, "clicked", on_click(play), NULL);
|
|
return button;
|
|
}
|
|
|
|
ls_on_click(pause);
|
|
GtkWidget *make_pause_button(GtkIconSize size)
|
|
{
|
|
GtkWidget *button = make_button(GTK_STOCK_MEDIA_PAUSE, size);
|
|
GTK_CONNECT(button, "clicked", on_click(pause), NULL);
|
|
return button;
|
|
}
|