Added a wrapper function for gtk_box_pack_start()

This will call the conversion macros for packing items into a box.
This commit is contained in:
Bryan Schumaker 2011-08-20 11:32:20 -04:00
parent 467cedf828
commit d75227b6af
4 changed files with 14 additions and 3 deletions

View File

@ -6,7 +6,7 @@ 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);
gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0);
box_pack_start(box, image, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(button), box);
gtk_widget_show_all(button);
return button;

8
gui/gtk.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <ocarina/gtk.h>
void box_pack_start(GtkWidget *box, GtkWidget *child, gboolean expand,
gboolean fill, guint padding)
{
gtk_box_pack_start(GTK_BOX(box), child, expand, fill, padding);
}

View File

@ -1,4 +1,5 @@
#include <ocarina/gtk.h>
#include <ocarina/button.h>
#include <ocarina/window.h>
#include <libsaria/libsaria.h>
@ -16,8 +17,8 @@ void ocarina_init(int argc, char **argv)
play = make_play_button(GTK_ICON_SIZE_MENU);
pause = make_pause_button(GTK_ICON_SIZE_MENU);
gtk_box_pack_start(GTK_BOX(hbox), play, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), pause, FALSE, FALSE, 0);
box_pack_start(hbox, play, FALSE, FALSE, 0);
box_pack_start(hbox, pause, FALSE, FALSE, 0);
gtk_widget_show(hbox);
window_add(hbox);
gtk_main();

View File

@ -5,4 +5,6 @@ extern "C" {
#include <gtk/gtk.h>
}
void box_pack_start(GtkWidget *, GtkWidget *, gboolean, gboolean, guint);
#endif