GTK编程:小部件打包与按钮控件详解
1. 小部件打包基础
在GTK编程中,小部件的打包是构建用户界面的重要环节。以下是一个简单的小部件打包示例代码:
/* pack the quitbox into the vbox (box1) */ gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, FALSE, 0); /* Pack the vbox (box1) which now contains all our widgets, into the * main window. */ gtk_container_add (GTK_CONTAINER (window), box1); /* And show everything left */ gtk_widget_show (button); gtk_widget_show (quitbox); gtk_widget_show (box1); /* Showing the window last so everything pops up at once. */ gtk_widget_show (window); /* And of course, our main function. */ gtk_main (); /* Control returns here when gtk_main_quit() is called, but not when * gtk_exit is used. */ return(0);这段代码的操作步骤如下:
1. 使用gtk_box_pack_st