Class: XRC2Ruby::ObjectTypes::MenuItem
- Defined in:
- lib/wx_sugar/xrc/xrc2ruby_types/menu.rb
Instance Attribute Summary collapse
-
#checkable ⇒ Object
Returns the value of attribute checkable.
-
#checked ⇒ Object
Returns the value of attribute checked.
-
#help ⇒ Object
Returns the value of attribute help.
-
#label ⇒ Object
Returns the value of attribute label.
-
#radio ⇒ Object
Returns the value of attribute radio.
-
#submenu ⇒ Object
Returns the value of attribute submenu.
Attributes inherited from Object
#centered, #name, #parent, #sub_class, #win_class
Instance Method Summary collapse
-
#initialize(parent, klass, subclass, name) ⇒ MenuItem
constructor
A new instance of MenuItem.
- #output ⇒ Object
Methods inherited from Object
Constructor Details
#initialize(parent, klass, subclass, name) ⇒ MenuItem
Returns a new instance of MenuItem.
47 48 49 50 51 52 53 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 47 def initialize(parent, klass, subclass, name) super # stock id if name.sub!(/^wx/, "Wx::") @menu_id = name end end |
Instance Attribute Details
#checkable ⇒ Object
Returns the value of attribute checkable.
45 46 47 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 45 def checkable @checkable end |
#checked ⇒ Object
Returns the value of attribute checked.
45 46 47 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 45 def checked @checked end |
#help ⇒ Object
Returns the value of attribute help.
45 46 47 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 45 def help @help end |
#label ⇒ Object
Returns the value of attribute label.
45 46 47 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 45 def label @label end |
#radio ⇒ Object
Returns the value of attribute radio.
45 46 47 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 45 def radio @radio end |
#submenu ⇒ Object
Returns the value of attribute submenu.
45 46 47 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 45 def @submenu end |
Instance Method Details
#output ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/menu.rb', line 55 def output @help ||= '' # What type of menu item? if radio item_type = "Wx::ITEM_RADIO" elsif checkable item_type = "Wx::ITEM_CHECK" else item_type = "Wx::ITEM_NORMAL" end # Using a stock id if @menu_id m_i = "#{var_name} = Wx::MenuItem.new(#{parent.var_name}, #{@menu_id})" else if XRC2Ruby.use_gettext the_label = "_(" + label.inspect + ")" the_help = "_(" + help.inspect + ")" else the_label = label.inspect the_help = help.inspect end = || "nil" m_i = "#{var_name} = Wx::MenuItem.new(#{parent.var_name}, Wx::ID_ANY, #{the_label}, #{the_help}, #{item_type}, #{})" end m_i + "\n" + "#{parent.var_name}.append_item(#{var_name})" end |