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

Gtk::ItemFactory

Gtk::ItemFactory クラス

メニューに対してのファクトリです。

クラスメソッド

Gtk::ItemFactory.new(container_type, path, accel_group = nil)
新たなGtk::ItemFactoryを生成します。
Gtk::ItemFactory.from_widget(widget)
生成済みのウィジェットからアイテムファクトリを取得します。
  • widget:Gtk::Widget
  • 戻り値:生成済みのウィジェットからのアイテムファクトリ、またはnil
Gtk::ItemFactory.path_from_widget(widget)
If widget has been created by an item factory, returns the full path to it. (The full path of a widget is the concatenation of the factory path specified in Gtk::ItemFactory.new with the path specified in the array from which the widget was created.)
  • widget: a Gtk::Widget
  • Returns: the full path to widget if it has been created by an item factory, nil otherwise. This value is owned by GTK+ and must not be modified or freed.
  • Returns: self

インスタンスメソッド

construct(container_type, path, accel_group = nil)
Initializes an item factory.
get_item(path)
Obtains the menu item which corresponds to path. If the widget corresponding to path is a menu item which opens a submenu, then the item is returned. If you are interested in the submenu, use Gtk::ItemFactory#get_widget instead.
  • path: the path to the menu item
  • Returns: the menu item for the given path, or nil if path doesn't lead to a menu item
get_widget(path)
Obtains the widget which corresponds to path. If the widget corresponding to path is a menu item which opens a submenu, then the submenu is returned. If you are interested in the menu item, use Gtk::ItemFactory#get_item instead.
  • path: the path to the widget
  • Returns: the widget for the given path, or nil if path doesn't lead to a widget
create_item(path, item_type = nil, accelerator = nil, extdata = nil, data = nil){|data, item| ... }
Creates an item for entry.
  • path: the path to the menu item
  • item_type: GtkItemType?. A simple item when nil is given. If it is set path, it is for a radio item to link against.
  • accelerator: the accelerator for the item or nil. e.g. "<Control>q", "<Shift>s". See Gtk::Accelerator.parse for more details.
  • extdata: extra data for some item types:
    • Gtk::ItemFactroy::IMAGE_ITEM? -> Gdk::Pixbuf
    • Gtk::ItemFactroy::STOCK_ITEM? -> Stock item(constants of Gtk::Stock)
  • data: the data passed to the block.
  • {|data, item| ... }: the callback block.
  • Returns: self
create_items(entries)
Creates the menu items from the entries.
  • entries: array of item entries([item1, item2, ... ]). an item is [path, item_type = nil, accelerator = nil, extdata = nil, proc = nil, data = nil]
    • path: the path to the menu item
    • item_type: GtkItemType?. A simple item when nil is given. If it is set path, it is for a radio item to link against.
    • accelerator: the accelerator for the item or nil. e.g. "<Control>q", "<Shift>s". See Gtk::Accelerator.parse for more details.
    • extdata: extra data for some item types:
      • Gtk::ItemFactroy::IMAGE_ITEM? -> Gdk::Pixbuf
      • Gtk::ItemFactroy::STOCK_ITEM? -> Stock item(constants of Gtk::Stock)
    • proc: the callback block.
    • data: the data passed to the block.
  • Returns: self
delete_item(path)
Deletes the menu item which was created for path by the given item factory.
  • path: a path
  • Returns: self
popup(x, y, mouse_button, time)
Pops up the menu constructed from the item factory at (x, y). This method is for Gtk::ItemFactory::TYPE_MENU only.
  • x: the x position(Number)
  • y: the y position(Number)
  • mouse_button: the mouse button which was pressed to initiate this action(Number)
  • time: a timestamp for this action(Number)
  • Returns: self

定数

GtkItemType

GtkItemTypes are original constants for Ruby/GTK2.

TITLE
<Title> - a title item.
ITEM
<Item> - a simple item.
IMAGE_ITEM
<ImageItem> - an item holding an image(Gdk::Pixbuf)
STOCK_ITEM
<StockItem> - an item holding a stock image
CHECK_ITEM
<CheckItem> - a check item
TOGGLE_ITEM
<ToggleItem> - a toggle item
RADIO_ITEM
<RadioItem> - a radio item
SEPARATOR
<Separator> - a separator
TEAROFF
<Tearoff> - a tearoff separator
BRANCH
<Branch> - an item to hold sub items
LAST_BRANCH
<LastBranch> - a right justified item to hold sub items You shouldn't use this for "help" menu. See Gtk::MenuItem#right_justified.

GtkContainerType

GtkContainerTypes are original constants for Ruby/GTK2.

TYPE_MENU
As Gtk::Menu
TYPE_MENU_BAR
As Gtk::MenuBar
TYPE_OPTION_MENU
As Gtk::OptionMenu

更新履歴

  • - Masao?