[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-treeview-renderer-renderer

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 8月 13日 (月) 07:04:45 JST


-------------------------
REMOTE_ADDR = 184.145.90.35
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-treeview-renderer-renderer
-------------------------
@@ -8,6 +8,11 @@
 * Gtk::CellRendererToggle displays a boolean value in form of a check box or as a radio button.
 * Gtk::CellEditable is a special cell that implements editable cells (ie. Gtk::Entry or Gtk::SpinButton in a treeview)
 
+We said that model and view have to be connected  (i.e. Gtk::TreeView has to be associated with Gtk::TreeStore or Gtk::ListStore). How the tree data types (strings, numbers and boolean) are handled in Gtk is best seen in the code which indirectly points out to the Gtk::CellRendererText's ability to separate the forementioned data types. Following is the example code (note that a renderer is not even shown here, though it has to be made aware of a column with certain data type):
+
+ store = Gtk::TreeStore.new(String, Integer, TrueClass)
+ treeview = Gtk::TreeView.new(store)
+
 Contrary to what one may think, a cell renderer does not render just one single cell, but is responsible for rendering part or whole of a tree view column for each single row. It basically starts in the first row and renders its part of the column there. Then it proceeds to the next row and renders its part of the column there again. And so on.
 
 How does a cell renderer know what to render? A cell renderer object has certain 'properties' that are documented in the API reference (just like most other objects, and widgets). These properties determine what the cell renderer is going to render and how it is going to be rendered. Whenever the cell renderer is called upon to render a certain cell, it looks at its properties and renders the cell accordingly. This means that whenever you set a property or change a property of the cell renderer, this will affect all rows that are rendered after the change, until you change the property again.




ruby-gnome2-cvs メーリングリストの案内
Back to archive index