ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 20日 (木) 02:13:07 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-parts ------------------------- @@ -31,9 +31,18 @@ :Note: Models, renderers, and columns are referred to as objects rather than widgets, even though they are a part of GTK+ library. This distinction is important because it emphasizes the fact that they are not derived from Gtk::Widget, hence they do not inherit Gtk::Widget's behaviour, properties nor signals. -The model is represented as a hierarchical tree of strongly-typed, columnar data. In other words, the model can be seen as a tree where every node has different values depending on which column is being queried. The type of data found in a column is determined by using Ruby Class (ie. Object, Integer, Float, String, Hash, Gdk::Pixbuf, etc.). The types are homogeneous per column across all nodes. +We can read the following intro to the Gtk::TreeModel the API: -In order to make life simpler for programmers who do not need to write their own specialized model (which is ((<not possible in Ruby|URL:http://www.ruby-forum.com/topic/114021>)) as of ruby-gnome2 version 0.19.3), two generic models are provided - the Gtk::TreeStore and the Gtk::ListStore. To use these, the developer simply pushes data into models as necessary. These models provide the data structure as well as all appropriate tree interfaces. As a result, implementing drag and drop, sorting, and storing data is trivial. For the vast majority of trees and lists, these two models are sufficient. +# API ------ /module Gtk::TreeModel/ --- (start) #1 --- + +:Module Gtk::TreeModel + The Gtk::TreeModel interface defines a generic tree interface for use by the Gtk::TreeView widget. It is an abstract interface, and is designed to be usable with any appropriate data structure. + + The model is represented as a hierarchical tree of strongly-typed, columnar data. In other words, the model can be seen as a tree where every node has different values depending on which column is being queried. The type of data found in a column is determined by using Ruby Class (ie. Object, Integer, Float, String, Hash, Gdk::Pixbuf, etc.). The types are homogeneous per column across all nodes. + + In order to make life simpler for programmers who do not need to write their own specialized model (which is ((<not possible in Ruby|URL:http://www.ruby-forum.com/topic/114021>)) as of ruby-gnome2 version 0.19.3), two generic models are provided - the Gtk::TreeStore and the Gtk::ListStore. To use these, the developer simply pushes data into models as necessary. These models provide the data structure as well as all appropriate tree interfaces. As a result, implementing drag and drop, sorting, and storing data is trivial. For the vast majority of trees and lists, these two models are sufficient. + +# API ------ /module Gtk::TreeModel/ --- (end) #1 --- Gtk::ListStore allows you to create a list of elements with multiple columns. Each row is a child of the root node, so only one level of rows is displayed. But as already mentioned Gtk::ListStore is basically a tree structure that has no hierarchy. It is only provided because faster algorithms exist for interacting with the models that do not have any children items.