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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2009年 2月 17日 (火) 14:05:18 JST


-------------------------
REMOTE_ADDR = 74.15.84.244
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-cdf
-------------------------
@@ -26,10 +26,17 @@
    column.set_cell_data_func(renderer) do |tvc, cell, model, iter|
      # Get the color string stored by the column and make
      # it the background color, make foreground white, unless
-     # bg is also white.
-     cell.background = model.get_value(iter, 0)
-     cell.foreground = model.get_value(iter, 0) == "#FFFFFF" ?
-          "#000000" : "#ffffff"
+     # bg is very bright.
+     color_v = model.get_value(iter, 0)
+     cell.background = color_v
+     color = Gdk::Color.parse(color_v)
+     if (color.red > 88 && color.green > 88)
+       cell.foreground = "#000000"
+       cell.weight = Pango::FontDescription::WEIGHT_NORMAL
+     else
+       cell.foreground = "#ffffff"
+       cell.weight = Pango::FontDescription::WEIGHT_ULTRABOLD
+     end
    end
  end
  




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