[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - Gtk::CellRendererAccel

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 10月 15日 (月) 08:30:51 JST


-------------------------
REMOTE_ADDR = 184.145.82.7
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ACellRendererAccel
-------------------------
@@ -1,9 +1,55 @@
 = class Gtk::CellRendererAccel
 
 Gtk::CellRendererAccel displays a keyboard accelerator (i.e. a key combination like <Control>-a). If the cell renderer is editable, the accelerator can be changed by simply typing the new combination.
 
 The Gtk::CellRendererAccel cell renderer was added in GTK+ 2.10.
 
+
+((*------------- FIXME, FIXME, FIXME, FIXME, FIXME, FIXME ---------- (start) ------**))
+:Related to Gtk::CellRendererAccel is not fatal but annoying bug:
+
+    If you wish to display a combined or or'ed together modifier mask which you initially stored in the model the Gtk::CellRendererAccel renderer fails to render the string of modifier keys in front of the modified key. However, it does work for single modifier. You can find the example program on hiki in ((<"Ruby/GTK2 Tutorial"|tut-gtk>)) in section 8.7.5 ((<Keyboard Accelerator Renderers|tut-gtk2-treev-kbda>)). The program name is((*'accelerators.rb'.*)) For your convenience I include here the code segment with the offending code from 'accelerators.rb' program.
+
+     
+     class Accl
+       attr_accessor :action, :mask, :value
+       def initialize(a, m, v); @action, @mask, @value = a, m, v; end
+     end
+     ACTION_COLUMN = 0; MASK_COLUMN = 1; VALUE_COLUMN = 2
+     list = [
+       Accl.new("Cut",   Gdk::Window::CONTROL_MASK, Gdk::Keyval::GDK_X),
+       Accl.new("Copy",  Gdk::Window::CONTROL_MASK, Gdk::Keyval::GDK_C),
+       Accl.new("Paste", Gdk::Window::CONTROL_MASK, Gdk::Keyval::GDK_V),
+       Accl.new("New",   Gdk::Window::CONTROL_MASK, Gdk::Keyval::GDK_N),
+       Accl.new("Open",  Gdk::Window::CONTROL_MASK, Gdk::Keyval::GDK_O),
+       Accl.new("Print", Gdk::Window::CONTROL_MASK, Gdk::Keyval::GDK_P),
+     ]
+     
+     ### -- There's a BUG in {{ Gtk::CellRendererAccel }}
+     ### ------------------------------------------------
+     ### All the above definitions of modifier keys when "single" modifier is used
+     ### work, however, if you added the line ad the end of this comment to the list 
+     ### above, it would not be rendered properly because more modifier keys are OR'ed 
+     ### together. Following would not work correctly:
+     ### 
+     ### Accl.new("Purge", Gdk::Window::CONTROL_MASK & Gdk::Window::MOD1_MASK, Gdk::Keyval::GDK_P),
+     
+     treeview = Gtk::TreeView.new(store = Gtk::ListStore.new(String, Integer, Integer))
+     setup_tree_view(treeview)
+     
+     # Add all of the products to the GtkListStore.
+     list.each_with_index do |e, i|
+         iter = store.append
+         iter[ACTION_COLUMN] = list[i].action
+         iter[MASK_COLUMN]   = list[i].mask	# see: BUG in {{ Gtk::CellRendererAccel }} above
+         iter[VALUE_COLUMN]  = list[i].value
+         iter.next!
+     end
+
+((*------------- FIXME, FIXME, FIXME, FIXME, FIXME, FIXME ---------- (end) ------*))
+
+
+
 == Object Hierarchy
 
 * Object




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