Class: Iup::SubMenu
Overview
A menu item that, when selected, opens another menu. Apart from its text label, a menu item may include an optional image.
Example
The following line associates the ‘File’ name with its menu, ready to place into a parent menu:
file_submenu = Iup::SubMenu.new('File', file_menu))
See also Menu, MenuItem, Separator
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#image ⇒ Object
–.
-
#image=(val) ⇒ Object
:nodoc:.
-
#initialize(title, child_menu) {|_self| ... } ⇒ SubMenu
constructor
Creates instance of a submenu.
-
#title ⇒ Object
:attr: title String to show on menu.
-
#wid ⇒ Object
:attr_reader: wid Native widget identifier.
Methods inherited from Widget
#active, #assign_handle, #bgcolor, #destroy, #enterwindow_cb=, #fgcolor, #font, #getfocus_cb=, #help_cb=, #k_any=, #killfocus_cb=, #leavewindow_cb=, #map_cb=, #maxsize, #minsize, #open_controls, #size, #unmap_cb=, #visible, #zorder
Methods included from AttributeBuilders
#define_attribute, #define_id_attribute, #define_id_reader, #define_id_writer, #define_property_attribute, #define_property_reader, #define_property_writer, #define_reader, #define_writer
Methods included from CallbackSetter
Constructor Details
#initialize(title, child_menu) {|_self| ... } ⇒ SubMenu
Creates instance of a submenu. If a block is given, the new instance is yielded to it.
-
title- displayed name of menu -
child_menu- child menu to open
24 25 26 27 28 29 |
# File 'lib/wrapped/submenu.rb', line 24 def initialize title, @handle = IupLib.IupSubmenu(title, .handle) # run any provided block on instance, to set up further attributes yield self if block_given? end |
Instance Method Details
#image ⇒ Object
–
40 41 42 |
# File 'lib/wrapped/submenu.rb', line 40 def image attribute_reference('IMAGE', ImageWidget, nil) end |
#image=(val) ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/wrapped/submenu.rb', line 44 def image= val # :nodoc: attribute_reference('IMAGE', ImageWidget, val) end |
#title ⇒ Object
:attr: title String to show on menu.
51 |
# File 'lib/wrapped/submenu.rb', line 51 define_attribute :title |
#wid ⇒ Object
:attr_reader: wid Native widget identifier.
56 |
# File 'lib/wrapped/submenu.rb', line 56 define_reader :wid |