Class: VRMenu
Overview
Menu
Constant Summary collapse
- SEPARATOR =
["sep","_vrmenusep",0x800]
Instance Attribute Summary collapse
-
#menu ⇒ Object
readonly
VRMenu Menu.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #append(*arg) ⇒ Object
- #count(*arg) ⇒ Object
- #delete(id) ⇒ Object
-
#initialize(menu, parent) ⇒ VRMenu
constructor
A new instance of VRMenu.
- #insert(ptr, *arg) ⇒ Object
- #set(sarr) ⇒ Object
Constructor Details
#initialize(menu, parent) ⇒ VRMenu
Returns a new instance of VRMenu.
867 868 869 870 |
# File 'lib/vr/vrcontrol.rb', line 867 def initialize(,parent) @menu= @parent=parent end |
Instance Attribute Details
#menu ⇒ Object (readonly)
VRMenu
Menu.
Methods
— append(caption,state)
Adds a new menu item at the last with the caption of ((|caption|)) and
the state of ((|state|)). See ((<state=>)) about ((|state|)).
— insert(ptr,caption,name,state)
Inserts new item at ((|ptr|)).
— delete(id)
Deletes menu. ((|id|)) can be a instance of VRMenuItem or a menu-id integer.
— count
Counts the menu items.
— set(sarr)
Sets the menu according to the ((|sarr|)) which is a structured array
of strings such like
(({ [ ["&File", [["&Open","open"],["E&xit","exit"]], }))
(({ ["&Edit",["&Copy","copy]] }))
(({ ] ] }))
Caption : TEXT
Name : TEXT
Menu : [Caption, Name|Menu]
When a menu is clicked, ((|Name|))_clicked method is fired.
862 863 864 |
# File 'lib/vr/vrcontrol.rb', line 862 def @menu end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
863 864 865 |
# File 'lib/vr/vrcontrol.rb', line 863 def parent @parent end |
Instance Method Details
#append(*arg) ⇒ Object
872 873 874 875 876 877 878 879 880 881 882 |
# File 'lib/vr/vrcontrol.rb', line 872 def append (*arg) m=VRMenuItem.new(@menu) id=@parent.newControlID if arg[2] then @menu.append arg[0],id,arg[2] else @menu.append arg[0],id end @parent.registerMenu(m,arg[1],id,arg[0]) m end |
#count(*arg) ⇒ Object
901 902 903 |
# File 'lib/vr/vrcontrol.rb', line 901 def count (*arg) @menu.count(*arg) end |
#delete(id) ⇒ Object
894 895 896 897 898 899 900 |
# File 'lib/vr/vrcontrol.rb', line 894 def delete (id) if id.is_a?(VRMenuItem) then @menu.delete id.etc else @menu.delete id end end |
#insert(ptr, *arg) ⇒ Object
883 884 885 886 887 888 889 890 891 892 893 |
# File 'lib/vr/vrcontrol.rb', line 883 def insert (ptr,*arg) m=VRMenuItem.new(@menu) id=@parent.newControlID if arg.size>2 then @menu.insert arg[0],id,ptr,arg[2] else @menu.insert arg[0],id,ptr end @parent.registerMenu(m,arg[1],id,arg[0]) m end |
#set(sarr) ⇒ Object
905 906 907 908 909 910 911 912 913 914 915 916 917 918 |
# File 'lib/vr/vrcontrol.rb', line 905 def set(sarr) sarr.each do |item| if item[1].is_a?(Array) then m=@parent.newMenu(true) m.set(item[1]) @menu.append item[0],m.,item[2] elsif item[1].is_a?(VRMenu) then @menu.append item[0],item[1].,item[2] else append(*item) end end self end |