Class: Reflex::Menu

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Xot::Hookable, Xot::Setter
Defined in:
lib/reflex/menu.rb

Instance Method Summary collapse

Constructor Details

#initialize(label = nil, **options, &block) ⇒ Menu

Returns a new instance of Menu.



20
21
22
23
24
25
# File 'lib/reflex/menu.rb', line 20

def initialize(label = nil, **options, &block)
  super()
  self.label = label if label
  set **options unless options.empty?
  Xot::BlockUtil.instance_eval_or_block_call self, &block if block
end

Instance Method Details

#add_child(child, index: nil) ⇒ Object Also known as: add



27
28
29
# File 'lib/reflex/menu.rb', line 27

def add_child(child, index: nil)
  add_child! child, index
end

#check(bool = true) ⇒ Object



42
43
44
# File 'lib/reflex/menu.rb', line 42

def check(bool = true)
  check! bool
end

#childrenObject



65
66
67
# File 'lib/reflex/menu.rb', line 65

def children()
  to_a
end

#disableObject



38
39
40
# File 'lib/reflex/menu.rb', line 38

def disable()
  enable! false
end

#each(&block) ⇒ Object



60
61
62
63
# File 'lib/reflex/menu.rb', line 60

def each(&block)
  return enum_for :each unless block
  each!(&block)
end

#enable(bool = true) ⇒ Object



34
35
36
# File 'lib/reflex/menu.rb', line 34

def enable(bool = true)
  enable! bool
end

#inspectObject



69
70
71
# File 'lib/reflex/menu.rb', line 69

def inspect()
  "#<Reflex::Menu label:#{label.inspect} size:#{size}>"
end

#shortcut=(key_and_modifiers) ⇒ Object



50
51
52
53
54
# File 'lib/reflex/menu.rb', line 50

def shortcut=(key_and_modifiers)
  key, *mods = key_and_modifiers
  self.shortcut_key       = key
  self.shortcut_modifiers = mods
end

#uncheckObject



46
47
48
# File 'lib/reflex/menu.rb', line 46

def uncheck()
  check! false
end