ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 3日 (水) 07:21:12 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees ------------------------- @@ -271,7 +271,7 @@ :Caution: Make sure you do not use Gtk::TreeViewColumn#set_cell_data_func if you have a large number of rows in your tree model. Cell data functions are invoked on every cell in the column before it is rendered, so they can significantly slow down tree models. -The main part of this mechanism known as 'Cell Data Function' is a block of code that is called for any desired cell renderer in a selected column for each single row before that row is rendered. Since the setting for a cell-renderer's property remains in effect for the entire column from the point (i.e. row) where it was set to the point (row) where it is overridden by a new setting, you need to carefully plan when to set and when to reset them. For instance if you wanted to render a background of each row in a tree view in different colour, you'd have to set the cell renderer's background property for every cell renderer in that row to a desired colour. Which means that there has to be a place that each cell-renderer will consult each time just before it is about to render its data. This place is the code block defined for a Gtk::TreeViewColumn#set_cell_data_func. Every column in a tree view can potentially call this method with an associated code block. In our instance, j ust mentioned in this paragraph above, where we would like to render the background of every row in a different colour, every cell in the tree view would need to invoke "set_cell_data_func" with an appropriate code block. Indeed, many times you would want to render only some particular cell, or perhaps a few cells, with certain cell-renderer's properties set to different values than are set for the rest of the cells in the tree view. Shortly, we will see examples for both of these situations. But let's look at how these features, that allow us to so flexibly modify cell renderer attributes, fit together. +The main part of this mechanism known as 'Cell Data Function' is a block of code that is called for any desired cell renderer in a selected column for each single row before that row is rendered. Since the setting for a cell-renderer's property remains in effect for the entire column from the point (i.e. row) where it was set to the point (row) where it is overridden by a new setting, you need to carefully plan when to set and when to reset them. For instance if you wanted to render a background of each row in a tree view in different colour, you'd have to set the cell renderer's background property for every cell renderer in that row to a desired colour. Which means that there has to be a place that each cell-renderer will consult each time just before it is about to render its data. This place is the code block defined for a Gtk::TreeViewColumn#set_cell_data_func. Every column in a tree view can potentially trigger a call to this method with its associated code block. In o ur instance, just mentioned in this paragraph above, where we would like to render the background of every row in a different colour, every cell in the tree view would need to invoke "set_cell_data_func" with an appropriate code block. Indeed, many times you would want to render only some particular cell, or perhaps a few cells, with certain cell-renderer's properties set to different values than are set for the rest of the cells in the tree view. Shortly, we will see examples for both of these situations. But let's look at how these features, that allow us to so flexibly modify cell renderer attributes, fit together.