Class: Gtk2AppLib::Widgets::Menu

Inherits:
Gtk::Menu
  • Object
show all
Includes:
Gtk2AppLib::Widgets
Defined in:
lib/gtk2applib/widgets/menu.rb

Overview

I'm a menu!

Direct Known Subclasses

AppMenu, DockMenu

Constant Summary

Constant Summary

Constants included from Missing

Missing::REQUIRES

Instance Attribute Summary

Attributes included from Gtk2AppLib::Widgets

#hold, #is, #options

Instance Method Summary (collapse)

Methods included from Gtk2AppLib::Widgets

_each, autoloads, autoloads_buttons, autoloads_others, autoloads_texts, #class_symbol, #common, #connect, define, define_composite, define_evented, execute, #execute, get_options, #initialize, #initialize_image, method_missing, pack, #pack, #set_options, #set_signals, symbol_check, widgets

Methods included from Missing

missing

Instance Method Details

- (Object) append_menu_item(item, key = item)



8
9
10
11
12
13
14
# File 'lib/gtk2applib/widgets/menu.rb', line 8

def append_menu_item(item, key=item)
  item = Gtk::MenuItem.new(item) if item.class == String
  self.append(item)
  item.signal_connect('activate') { yield(key) } if block_given?
  item.show
  return item
end

- (Object) append_menu_items(keys, &block)



16
17
18
19
20
21
22
23
# File 'lib/gtk2applib/widgets/menu.rb', line 16

def append_menu_items(keys, &block)
  keys = [keys] unless keys.kind_of?(Array)
  items = []
  keys.each do |key, item|
    items.push(self.append_menu_item((item || key), key, &block))
  end
  return items
end