Module: Wx::Extensions::EasyMenuBar
Instance Attribute Summary collapse
Instance Method Summary
collapse
#clean_name, #internal_name
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
14
15
16
|
# File 'lib/wx_sugar/menu.rb', line 14
def source
@source
end
|
#target ⇒ Object
Returns the value of attribute target.
14
15
16
|
# File 'lib/wx_sugar/menu.rb', line 14
def target
@target
end
|
Instance Method Details
#[](menu_id) ⇒ Object
Return the Menu item corresponding to menu_id
. This can be a zero-based integer specifying the menu’s offset within the MenuBar, or a string title, with or without accelerator key.
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/wx_sugar/menu.rb', line 54
def []()
case
when Integer
index =
when String
index = ()
raise RuntimeError, "No menu called #{}" if index == Wx::NOT_FOUND
else
raise ArgumentError, "Bad menu specifier #{.inspect}"
end
(index)
end
|
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/wx_sugar/menu.rb', line 21
def (title)
= Wx::Menu.new()
.target = self.target
.source = self.source
yield
append(, title)
<< internal_name(title)
<<
end
|
#connect(source, target = source) ⇒ Object
15
16
17
18
19
|
# File 'lib/wx_sugar/menu.rb', line 15
def connect(source, target = source)
self.source = source
self.target = target
end
|
only used if find_menu is not available in WxRuby
47
48
49
|
# File 'lib/wx_sugar/menu.rb', line 47
def (str)
.index( internal_name(str) ) || Wx::NOT_FOUND
end
|
42
43
44
|
# File 'lib/wx_sugar/menu.rb', line 42
def (idx)
[idx]
end
|
38
39
40
|
# File 'lib/wx_sugar/menu.rb', line 38
def ()
@menu_labels ||= []
end
|
34
35
36
|
# File 'lib/wx_sugar/menu.rb', line 34
def ()
@menu_menus||= []
end
|