深入了解Tree Widget
1. 引言
Tree Widget主要用于展示具有层次结构的数据。GtkTree 是一种垂直容器,用于存放 GtkTreeItem 类型的小部件。它与 GtkList 有相似之处,二者都直接继承自 GtkContainer,GtkContainer 的方法在这两种小部件上的工作方式相同。但不同的是,GtkTree 可以嵌套在其他 GtkTree 中。
2. 按钮设置示例
以下是一段创建按钮并连接回调函数的示例代码:
button_add = gtk_button_new_with_label("Add List"); button_clear = gtk_button_new_with_label("Clear List"); button_hide_show = gtk_button_new_with_label("Hide/Show titles"); gtk_box_pack_start(GTK_BOX(hbox), button_add, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), button_clear, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), button_hide_show, TRUE, TRUE, 0); /* Connect our callbacks to the three buttons */ gtk_signal_connect_object(GTK_OBJECT(button_add), "clicked", GTK_SIGNAL