新規作成  編集  Ruby-GNOME2 Project Website  ページ一覧  検索  更新履歴  編集履歴  RSS  ログイン

Gtk::AccelLabel

Gtk::AccelLabel クラス

The Gtk::AccelLabel widget is a subclass of Gtk::Label that also displays an accelerator key on the right of the label text, e.g. 'Ctl+S'. It is commonly used in menus to show the keyboard short-cuts for commands.

The accelerator key to display is not set explicitly. Instead, the Gtk::AccelLabel displays the accelerators which have been added to a particular widget. This widget is set by calling Gtk::AccelLabel#accel_widget=.

For example, a Gtk::MenuItem widget may have an accelerator added to emit the "activate" signal when the 'Ctl+S' key combination is pressed. A Gtk::AccelLabel is created and added to the Gtk::MenuItem, and Gtk::AccelLabel#accel_widget= is called with the Gtk::MenuItem as the second argument. The Gtk::AccelLabel will now display 'Ctl+S' after its label.

Note that creating a Gtk::MenuItem with Gtk::MenuItem.new (or one of the similar functions for Gtk::CheckMenuItem and Gtk::RadioMenuItem) automatically adds a Gtk::AccelLabel to the Gtk::MenuItem and calls Gtk::AccelLabel#accel_widget= to set it up for you.

A Gtk::AccelLabel will only display accelerators which have Gtk::ACCEL_VISIBLE set (see GtkAccelFlags). A Gtk::AccelLabel can display multiple accelerators and even signal names, though it is almost always used to display just one accelerator key.

インクルードされているモジュール

  • Gtk::Buildable?
  • Atk::Implementor
  • GLib::Interface?

クラスメソッド

Gtk::AccelLabel.new(string)
Creates a new Gtk::AccelLabel.

インスタンスメソッド

accel_closure
Returns the accel_closure.
  • Returns: the accel_closure(GLib::Closure?, or nil).
accel_closure=(accel_closure)
Sets the closure to be monitored by this accelerator label. The closure must be connected to an accelerator group; see Gtk::AccelGroup#connect
  • accel_closure: the closure(GLib::Closure?) to monitor for accelerator changes.
  • Returns: the accel_closure
set_accel_closure(accel_closure)
Same as Gtk::AccelLabel#accel_closure=.
  • accel_closure: the closure(GLib::Closure?) to monitor for accelerator changes.
  • Returns: self
accel_widget
Fetches the widget monitored by this accelerator label.
  • Returns : the object monitored by the accelerator label, or nil.
accel_widget=(accel_widget)
Sets the widget to be monitored by this accelerator label.
  • accel_widget: the widget to be monitored.
  • Returns: accel_widget
set_accel_widget(accel_widget)
Same as Gtk::AccelLabel#accel_widget=.
  • accel_widget: the widget to be monitored.
  • Returns: self
accel_width
Returns the width needed to display the accelerator key(s). This is used by menus to align all of the Gtk::MenuItem widgets, and shouldn't be needed by applications.
  • Returns: the width needed to display the accelerator key(s).
refetch
Recreates the string representing the accelerator keys. This should not be needed since the string is automatically updated whenever accelerators are added or removed from the associated widget.

プロパティ

accel-closure: GLib::Closure (Read/Write)
The closure to be monitored for accelerator changes
accel-widget: Gtk::Widget (Read/Write)
The widget to be monitored for accelerator changes

関連ページ

Keyboard Accelerators installing and using keyboard short-cuts. Gtk::ItemFactory an easier way to create menus.

更新履歴

  • 2014-06-15 インクルードされているモジュールの項目を追加。 - きたがわ
  • - Masao?
更新日時:2014/06/15 18:36:48
キーワード:
参照:[Ruby/GTK] [Gtk::AccelLabel] [Ruby/GTK Object Hierarchy]