#include<gtk/gtk.h>
GtkWidget*
creat_arrow_button(GtkArrowType arrowtype,GtkShadowType shadowtype)
{
GtkWidget *arrow;
GtkWidget *button;
button=gtk_button_new();
arrow=gtk_arrow_new(arrowtype,shadowtype);
gtk_container_add(GTK_CONTAINER(button),arrow);
gtk_widget_show(arrow);
return button;
}
int main(int argc,char *argv[])
{
GtkWidget *window;
GtkWidget *box;
GtkWidget *button1;
GtkWidget *button2;
GtkWidget *button3;
GtkWidget *button4;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"方向按钮");
gtk_container_set_border_width(GTK_CONTAINER(window),20);
g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);
box=gtk_hbox_new(FALSE,0);
gtk_container_add(GTK_CONTAINER(window),box);
gtk_widget_show(box);
button1=creat_arrow_button(GTK_ARROW_LEFT,GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(box),button1,FALSE,FALSE,13);
gtk_widget_show(button1);
button2=creat_arrow_button(GTK_ARROW_RIGHT,GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(box),button2,FALSE,FALSE,12);
gtk_widget_show(button2);
button3=creat_arrow_button(GTK_ARROW_DOWN,GTK_SHADOW_OUT);
gtk_box_pack_start(GTK_BOX(box),button3,FALSE,FALSE,12);
gtk_widget_show(button3);
button4=creat_arrow_button(GTK_ARROW_UP,GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(box),button4,FALSE,FALSE,12);
gtk_widget_show(button4);
gtk_widget_show(window);
gtk_main();
return FALSE;
}
图