Class: Palette
- Inherits:
-
Object
- Object
- Palette
- Defined in:
- ext/ae-rad/ae-rad-palette.rb
Overview
< ArcadiaExt
Instance Attribute Summary collapse
-
#buttons ⇒ Object
readonly
Returns the value of attribute buttons.
-
#rad ⇒ Object
readonly
Returns the value of attribute rad.
-
#selected_wrapper ⇒ Object
readonly
Returns the value of attribute selected_wrapper.
Instance Method Summary collapse
-
#build ⇒ Object
def on_before_build(_event) ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event) ArcadiaContractListener.new(self, PaletteContract, :do_palette_event) end.
- #create_palettes ⇒ Object
- #do_inspector_event(_event) ⇒ Object
- #do_palette_event(_event) ⇒ Object
- #eval_file(_filename) ⇒ Object
- #eval_form_file(_filename) ⇒ Object
- #give_me_code ⇒ Object
- #give_me_obj(_owner) ⇒ Object
-
#initialize(_rad) ⇒ Palette
constructor
A new instance of Palette.
- #on_after_build(_event) ⇒ Object
Constructor Details
#initialize(_rad) ⇒ Palette
Returns a new instance of Palette.
17 18 19 20 21 22 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 17 def initialize(_rad) @rad = _rad ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event) ArcadiaContractListener.new(self, PaletteContract, :do_palette_event) build end |
Instance Attribute Details
#buttons ⇒ Object (readonly)
Returns the value of attribute buttons.
14 15 16 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 14 def @buttons end |
#rad ⇒ Object (readonly)
Returns the value of attribute rad.
16 17 18 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 16 def rad @rad end |
#selected_wrapper ⇒ Object (readonly)
Returns the value of attribute selected_wrapper.
15 16 17 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 15 def selected_wrapper @selected_wrapper end |
Instance Method Details
#build ⇒ Object
def on_before_build(_event)
ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event)
ArcadiaContractListener.new(self, PaletteContract, :do_palette_event)
end
29 30 31 32 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 29 def build @buttons = Hash.new create_palettes end |
#create_palettes ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 68 def create_palettes @cc = WrapperContainer.new(self){ border 0 borderwidth 1 } @cc.pack('side' =>'left', 'fill' =>'both', 'anchor'=>'nw', :padx=>2, :pady=>2) @rad.libs.list.each{|lib| @cc.add_palette(lib) } end |
#do_inspector_event(_event) ⇒ Object
37 38 39 40 41 42 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 37 def do_inspector_event(_event) case _event.signature when InspectorContract::SELECT_WRAPPER @selected_wrapper=_event.context.wrapper end end |
#do_palette_event(_event) ⇒ Object
44 45 46 47 48 49 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 44 def do_palette_event(_event) case _event.signature when PaletteContract::MAKE_SELECTED_WRAPPER give_me_obj(_event.context.parent) end end |
#eval_file(_filename) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 58 def eval_file(_filename) cod = ''; begin IO.foreach(_filename) { |line| cod += line } rescue SystemCallError handleException # defined elsewhere end eval(cod) end |
#eval_form_file(_filename) ⇒ Object
51 52 53 54 55 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 51 def eval_form_file(_filename) cod = ''; IO.foreach(_filename) { |line| cod += line }; Revparsel.new(cod, _filename) end |
#give_me_code ⇒ Object
83 84 85 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 83 def give_me_code @cc.new_wrapper_code end |
#give_me_obj(_owner) ⇒ Object
79 80 81 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 79 def give_me_obj(_owner) @cc.new_wrapper(_owner) end |
#on_after_build(_event) ⇒ Object
34 35 |
# File 'ext/ae-rad/ae-rad-palette.rb', line 34 def on_after_build(_event) end |