Class: XRC2Ruby::ObjectTypes::TOOL
- Inherits:
-
Object
- Object
- XRC2Ruby::ObjectTypes::TOOL
- Defined in:
- lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb
Overview
Not a real wxRuby class; individual tools are created by calls to add_tool and friends.
Instance Attribute Summary collapse
-
#bitmap ⇒ Object
Returns the value of attribute bitmap.
-
#bitmap2 ⇒ Object
Returns the value of attribute bitmap2.
-
#help ⇒ Object
Returns the value of attribute help.
-
#label ⇒ Object
Returns the value of attribute label.
-
#longhelp ⇒ Object
Returns the value of attribute longhelp.
-
#radio ⇒ Object
Returns the value of attribute radio.
-
#toggle ⇒ Object
Returns the value of attribute toggle.
-
#toolbar ⇒ Object
readonly
Returns the value of attribute toolbar.
-
#tooltip ⇒ Object
Returns the value of attribute tooltip.
-
#var_name ⇒ Object
readonly
Returns the value of attribute var_name.
Instance Method Summary collapse
-
#initialize(toolbar, an_id) ⇒ TOOL
constructor
A new instance of TOOL.
- #output ⇒ Object
Constructor Details
#initialize(toolbar, an_id) ⇒ TOOL
Returns a new instance of TOOL.
27 28 29 30 31 32 33 34 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 27 def initialize(, an_id) @toolbar = @var_name = an_id.downcase if an_id.sub!(/^wx/, "Wx::") @stock_id = an_id end @toolbar.add_tool(self) end |
Instance Attribute Details
#bitmap ⇒ Object
Returns the value of attribute bitmap.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def bitmap @bitmap end |
#bitmap2 ⇒ Object
Returns the value of attribute bitmap2.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def bitmap2 @bitmap2 end |
#help ⇒ Object
Returns the value of attribute help.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def help @help end |
#label ⇒ Object
Returns the value of attribute label.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def label @label end |
#longhelp ⇒ Object
Returns the value of attribute longhelp.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def longhelp @longhelp end |
#radio ⇒ Object
Returns the value of attribute radio.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def radio @radio end |
#toggle ⇒ Object
Returns the value of attribute toggle.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def toggle @toggle end |
#toolbar ⇒ Object (readonly)
Returns the value of attribute toolbar.
22 23 24 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 22 def @toolbar end |
#tooltip ⇒ Object
Returns the value of attribute tooltip.
23 24 25 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 23 def tooltip @tooltip end |
#var_name ⇒ Object (readonly)
Returns the value of attribute var_name.
22 23 24 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 22 def var_name @var_name end |
Instance Method Details
#output ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/wx_sugar/xrc/xrc2ruby_types/toolbar.rb', line 36 def output @label ||= '' @help ||= '' @longhelp ||= '' # Normal bitmap if bitmap bmp1 = "Wx::Bitmap.new(#{self.bitmap.inspect}, Wx::BITMAP_TYPE_PNG)" else bmp1 = "Wx::NULL_BITMAP" end # Disabled bitmap if bitmap2 bmp2 = "Wx::Bitmap.new(#{self.bitmap2.inspect}, Wx::BITMAP_TYPE_PNG)" else bmp2 = "Wx::NULL_BITMAP" end # What type of tool? if radio tooltype = "Wx::ITEM_RADIO" elsif toggle tooltype = "Wx::ITEM_CHECK" else tooltype = "Wx::ITEM_NORMAL" end if @stock_id the_id = @stock_id else the_id = "Wx::ID_ANY" end # This is the most general form of add_tool "#{var_name} = #{.var_name}.add_tool(#{the_id}, #{label.inspect}, #{bmp1}, #{bmp2}, #{tooltype}, #{help.inspect}, #{longhelp.inspect})\n" end |