[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-treev-parts

アーカイブの一覧に戻る

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 19日 (水) 10:15:06 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-parts
-------------------------
@@ -20,23 +20,18 @@
 
 It should be clear, that Gtk::TreeModel itself only provides a way to query the characteristics of a data store and to retrieve existing data, but it does not provide a way to remove or add rows to the store. This is done using the specific store's methods.
 
+Based on the titles of this chapter (Tree View) and this paragraph as well as its introduction discussing the Gtk::TreeModel one may conclude that the fundamental data structure of both view and the model classes is that of a tree. This is only partially true, since the simplest form of a tree is a single branch or in computer parlance a list. Due to the fact that a list is also a tree, little or no effort has been made to separate the two, at least in the introductory paragraphs into this topic. Nevertheless, please keep in mind that our first program examples are about the one dimensional lists, and that unfortunately, we can nod avoid using word tree, when it comes to tree view or tree model for that matter. This situation is somewhat alleviated by the fact that Gtk+ comes with two built-in data stores or models, namely, Gtk::ListStore and Gtk::TreeStore. As the names imply, Gtk::ListStore is used for simple lists of data items where items have no hierarchical parent-chil
 d relationships, and the Gtk::TreeStore which is used for tree-like data structures, where items can have parent-child relationships.
+
+
+
 :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.
 
 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 these 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.
-
-#########################################################
-##:((<Tree View Look and Feel|tut-treeview-view-look>)) (Matthew Berg's Tutorial):
-
-:((<Models for Data Storage|tut-treeview-model>)) (Matthew Berg's Tutorial):
-    It is important to realise what Gtk::TreeModel is and what it is not. Gtk::TreeModel is basically just an 'interface' to the data store, meaning that it is a standardised set of methods that allows a Gtk::TreeView widget (and the application programmer) to query certain characteristics of a data store, for example how many rows there are, which rows have children, and how many children a particular row has. It also provides methods for retrieving data from the data store, and tell the tree view what type of data is stored in the model. Every data store must implement the Gtk::TreeModel interface and provide these methods. Gtk::TreeModel itself only provides a way to query a data store's characteristics and to retrieve existing data, it does not provide a way to remove or add rows to the store. This is done using the specific store's methods.
 
-    Gtk+ comes with two built-in data stores (models): Gtk::ListStore and Gtk::TreeStore. As the names imply, Gtk::ListStore is used for simple lists of data items where items have no hierarchical parent-child relationships, and Gtk::TreeStore is used for tree-like data structures, where items can have parent-child relationships. A list of files in a directory would be an example of a simple list structure, whereas a directory tree is an example for a tree structure. A list is basically just a special case of a tree with none of the items having any children, so one could use a tree store to maintain a simple list of items as well. The only reason Gtk::ListStore exists is in order to provide an easier interface that does not need to cater for child-parent relationships, and because a simple list model can be optimised for the special case where no children exist, which makes it faster and more efficient.
 
-    Tree model implementations like Gtk::ListStore and Gtk::TreeStore will take care of the view side for you once you have configured the Gtk::TreeView to display what you want. If you change data in the store, the model will notify the tree view and your data display will be updated. If you add or remove rows, the model will also notify the store, and your row will appear in or disappear from the view as well.
-#########################################################
 
 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. Basically, Gtk::ListStore is 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.
 




ruby-gnome2-cvs メーリングリストの案内
アーカイブの一覧に戻る