ruby-****@sourc*****
ruby-****@sourc*****
2010年 1月 20日 (水) 17:38:32 JST
------------------------- REMOTE_ADDR = 121.102.113.105 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/ja/hiki.cgi?Gtk%3A%3AAccelGroup ------------------------- TITLE = KscVrgoEGXlnJoz -> Gtk::AccelGroup KEYWORD = gEzxJR <a href="http://mnpiiudqfhlj.com/">mnpiiudqfhlj</a>, [url=http://ljbgpbwsgksw.com/]ljbgpbwsgksw[/url], [link=http://rknvtkakaisy.com/]rknvtkakaisy[/link], http://wveqckyuhyyc.com/ -> ------------------------- @@ -1 +1,128 @@ -gEzxJR <a href="http://mnpiiudqfhlj.com/">mnpiiudqfhlj</a>, [url=http://ljbgpbwsgksw.com/]ljbgpbwsgksw[/url], [link=http://rknvtkakaisy.com/]rknvtkakaisy[/link], http://wveqckyuhyyc.com/ += class Gtk::AccelGroup +A Gtk::AccelGroup represents a group of keyboard accelerators, typically attached to a toplevel Gtk::Window (with Gtk::Window#add_accel_group. Usually you won't need to create a Gtk::AccelGroup directly; instead, when using Gtk::ItemFactory, Ruby/GTK2 automatically sets up the accelerators for your menus in the item factory's Gtk::AccelGroup. + +((*Note*)) +that accelerators are different from mnemonics. Accelerators are shortcuts for activating a menu item; they appear alongside the menu item they're a shortcut for. For example "Ctrl+Q" might appear alongside the "Quit" menu item. Mnemonics are shortcuts for GUI elements such as text entries or buttons; they appear as underlined characters. See Gtk::Label.new. Menu items can have both accelerators and mnemonics, of course. + +=== Example 1. Hello World with Ctrl + 'A' + require 'gtk2' + + ag = Gtk::AccelGroup.new + ag.connect(Gdk::Keyval::GDK_A, Gdk::Window::CONTROL_MASK, + Gtk::ACCEL_VISIBLE) { + p "Hello World." + } + + win = Gtk::Window.new.add_accel_group(ag).show_all + Gtk.main + +=== Example 2. Hello World with 'B' (Using accel path) + require 'gtk2' + + AccelMap.add_entry("<TEST Application>/test", Gdk::Keyval::GDK_B, 0) + ag = Gtk::AccelGroup.new + ag.connect("<TEST Application>/test") { + p "Hello World." + } + + win = Gtk::Window.new.add_accel_group(ag).show_all + Gtk.main + +== Object Hierarchy +* Object + * GLib::Instantiatable + * GLib::Object + * Gtk::AccelGroup + +== Class Methods +--- Gtk::AccelGroup.new + Creates a new Gtk::AccelGroup. + * Returns: a new Gtk::AccelGroup + +--- Gtk::AccelGroup.activate(object, accel_key, accel_mods) + Finds the first accelerator in any Gtk::AccelGroup attached to object that matches accel_key and accel_mods, and activates that accelerator. If an accelerator was activated and handled this keypress, true is returned. + * object: the GLib::Object, usually a Gtk::Window, on which to activate the accelerator. + * accel_key: accelerator keyval from a key event + * accel_mods: keyboard state mask from a key event (((<GdkModifierType|Gdk::Window#GdkModifierType>))) + * Returns: true if the accelerator was handled, false otherwise + +--- Gtk::AccelGroup.from_accel_closure(closure) + Finds the Gtk::AccelGroup to which closure is connected; see Gtk::AccelGroup#connect. + * closure: a GLib::Closure + * Returns: the Gtk::AccelGroup to which closure is connected, or nil + +--- Gtk::AccelGroup.from_object(object) + Gets an array of all accel groups which are attached to object. + * object: a GLib::Object, usually a Gtk::Window + * Returns: an Array of all accel groups which are attached to object + +== Instance Methods +--- connect(accel_key, accel_mods, accel_flags, closure) +--- connect(accel_key, accel_mods, accel_flags) {...} + Installs an accelerator in this group. When accel_group is being activated in response to a call to Gtk::AccelGroup.activate, closure or block will be invoked if the accel_key and accel_mods from Gtk::AccelGroup.activate match those of this connection. + Note that, due to implementation details, a single closure can only be connected to one accelerator group. + * accel_key: key value of the accelerator(the constants are in Gdk::Keyval) + * accel_mods: modifier combination of the accelerator(((<GdkModifierType|Gdk::Window#GdkModifierType>))) + * accel_flags: a flag mask to configure this accelerator(((<GtkAccelFlags|Gtk#GtkAccelFlags>))) + * closure: GLib::Closure to be executed upon accelerator activation + * {...}: if closure = nil and a block is given, the block will be invoked if the accel_key and accel_mods from Gtk::AccelGroup.activate match those of this connection. + * Returns: self + +--- connect(accel_path, closure) +--- connect(accel_path) {...} + Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (see Gtk::AccelMap#add_entry). When accel_group is being activated in response to a call to Gtk::AccelGroup.activate, closure or block will be invoked if the accel_key and accel_mods from Gtk::AccelGroup.activate match the key and modifiers for the path. + * accel_path : path used for determining key and modifiers. + * closure: GLib::Closure to be executed upon accelerator activation + * {...}: if closure = nil and a block is given, the block will be invoked if the accel_key and accel_mods from Gtk::AccelGroup.activate match those of this connection. + * Returns: self + +--- disconnect(closure) + Removes an accelerator previously installed through Gtk::AccelGroup#connect. + * closure: the GLib::Closure to remove from this accelerator group + * Returns: true if the closure was found and got disconnected + +--- disconnect_key(accel_key, accel_mods) + Removes an accelerator previously installed through Gtk::AccelGroup#connect. + * accel_key: key value of the accelerator (Gdk::Keyval) + * accel_mods: modifier combination of the accelerator (((<GdkModifierType|Gdk::Window#GdkModifierType>))) + * Returns: true if there was an accelerator which could be removed, false otherwise + +--- query(accel_key, accel_mods) + Queries an accelerator group for all entries matching accel_key and accel_mods. + * accel_key: key value of the accelerator (Gdk::Keyval) + * accel_mods: modifier combination of the accelerator (((<GdkModifierType|Gdk::Window#GdkModifierType>))) + * Returns: an array of location to return the number of entries(Gtk::AccelGroupEntry) found, or nil. +--- lock +--- lock {...} + Locks the given accelerator group. Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer to Gtk::AccelMap.change_entry about runtime accelerator changes. If called more than once, AccelGroup remains locked until Gtk::AccelGroup#unlock has been called an equivalent number of times. + * {...}: If block is given, it is locked untill the whole of the block. + * Returns: self + +--- unlock + Undoes the last call to Gtk::AccelGroup#lock on this accel_group. + * Returns: self + +--- find {...} + Finds the first entry in an accelerator group for which block returns true and returns its Gtk::AccelKey. + * {...}: a block to filter the entries of accel_group with + * Returns: the key of the first entry passing find_func. The key is owned by GTK+ and must not be freed. + + +== Signals +--- accel-activate: self, arg1, accel_key, accel_mods + * self: Gtk::AccelGroup + * arg1: GLib::Object + * accel_key: Key code constants of Gdk::Keyval + * accel_mods: ((<GdkModifierType|Gdk::Window#GdkModifierType>)) + +--- accel-changed: self, accel_key, accel_mods + * self: Gtk::AccelGroup + * accel_key: Key code constants of Gdk::Keyval + * accel_mods: ((<GdkModifierType|Gdk::Window#GdkModifierType>)). + +== See Also +Gtk::Window#add_accel_group, Gtk::AccelMap#change_entry, Gtk::ItemFactory.new, Gtk::Label.new + +* 2003-05-07 ((<Masao>)): Modified. +* 2003-04-24 ((<Masao>)): Moved from The RWiki and modified. +* 2003-04-23 ((<TAMURA>))