分类: C/C++
2010-01-19 21:44:45
A frequently asked question is how you can add columns to a GtkTreeView in . The answer is basically that you don't, and that you can't. The only thing glade/libglade can do for you is to create the GtkTreeView for you with nothing in it. You will need to look up the tree view widget at the start of your application (after the interface has been created of course), and connect your list store or tree store to it. Then you will need to add GtkTreeViewColumns and cell renderers to display the information from the model as you want it to be displayed. You will need to do all that from within your application.
An alternative approach is to derive your own special widget from GtkTreeView
that sets up everything as you want it to, and then use the 'custom widget' function in glade.
Of course this still means that you have to write all the code to fill in the columns and
cell renderers and to create the model yourself.
大意:
GtkTreeView里的列不能在glade里加入,必须手写,
glade/libglade只创建了一个GtkTreeView,里面什么也没有
自己连接store,加入列/render等等一切
另一种方法是自己自定义空间,但是这还是免不了自己写代码