Class: WrapperContainer
- Inherits:
-
TkFrame
- Object
- TkFrame
- WrapperContainer
- Defined in:
- ext/ae-palette/ae-palette.rb,
ext/ae-rad/ae-rad-palette.rb
Instance Method Summary collapse
- #add_palette(_lib_obj) ⇒ Object
- #class_image(_class = nil) ⇒ Object
- #fill(_b, _class, _require, _class_obj = nil) ⇒ Object
-
#initialize(_owner) ⇒ WrapperContainer
constructor
A new instance of WrapperContainer.
- #new_wrapper(_parent = nil, _obj = nil) ⇒ Object
- #new_wrapper_code ⇒ Object
- #unfill ⇒ Object
Constructor Details
#initialize(_owner) ⇒ WrapperContainer
Returns a new instance of WrapperContainer.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'ext/ae-palette/ae-palette.rb', line 84 def initialize(_owner) super(_owner.frame) @owner = _owner _self = self frame = TkFrame.new(self).pack('side' =>'left', 'anchor'=>'n', :padx=>2, :pady=>2) @button_u = Tk::BWidget::Button.new(frame){ image TkPhotoImage.new('dat' => CURSOR_GIF) helptext 'Select' text 'C' foreground 'blue' command proc{_self.unfill} relief 'groove' pack('side' =>'top', 'anchor'=>'n',:padx=>2, :pady=>2) } @button_m = Tk::BWidget::Button.new(frame){ _command = proc{ require 'tk/clipboard' _code = AG.active.renderer.class_code.to_s if AG.active TkClipboard::set(_code) eval(_code) _self.fill( self, _owner.selected_wrapper.class, nil, _owner.selected_wrapper.getInstanceClass ) _self.new_wrapper if _owner.selected_wrapper.class.is_top } image TkPhotoImage.new('dat' => WIDGET_COPY_GIF) helptext 'Copy current selected' text 'C' foreground 'blue' command _command relief 'groove' pack('side' =>'left','anchor'=>'n', :padx=>2, :pady=>2) } @familyts = Tk::BWidget::NoteBook.new(self){ tabbevelsize 0 internalborderwidth 1 activeforeground 'orange' font $arcadia['conf']['main.font'] pack('side' =>'left','expand'=>'yes','fill'=>'both', :padx=>2, :pady=>2) } @objCollections = Array.new end |
Instance Method Details
#add_palette(_lib_obj) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'ext/ae-palette/ae-palette.rb', line 192 def add_palette(_lib_obj) _name = _lib_obj.arcadia_lib_params.name _file = _lib_obj.arcadia_lib_params.require _img = nil @objCollections << { 'name'=>_name, 'collection'=>_lib_obj, 'file'=>_file, 'img'=>_img } @classes_panel = @familyts.insert('end',_name, 'text'=>_name#, ) _background = @classes_panel.cget('background') @tpanel = TkText.new(@classes_panel){ relief 'flat' background _background }.pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2) _lib_obj.classes.each{|value| _self = self _image = self.class_image(value) ewin = TkTextWindow.new(@tpanel, 'end', 'window'=> Tk::BWidget::Button.new(@tpanel){ _command = proc{ _self.fill(self, value, _file) _self.new_wrapper if value.is_top } text value.class_wrapped.to_s helptext value.class_wrapped.to_s image TkPhotoImage.new( 'dat' => _image ) foreground 'blue' command _command font $arcadia['conf']['main.component.font'] relief 'groove' height 25 width 25 #pack('side' =>'left', 'anchor'=>'nw', :padx=>2, :pady=>2) } ) } if @objCollections.length == 1 @familyts.raise(_name) end end |
#class_image(_class = nil) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'ext/ae-palette/ae-palette.rb', line 243 def class_image(_class=nil) _current_class = _class _found = false if _class _dir = File.dirname(_class.library.arcadia_lib_params.source) end while _current_class != nil && !_found if defined?(_current_class.library) _dir = File.dirname(_current_class.library.arcadia_lib_params.source) end _img = (_current_class.to_s+"_gif").upcase _data = eval(_img + ' if defined?('+_img+')' ) #_file = _dir+"/res/"+_current_class.to_s+".gif" if _data #if FileTest.exist?(_file) _found = true else _current_class = _current_class.superclass end end return (_found)?_data:A_WIDGET_GIF end |
#fill(_b, _class, _require, _class_obj = nil) ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'ext/ae-palette/ae-palette.rb', line 167 def fill(_b, _class, _require, _class_obj = nil) _b.configure('relief'=>'sunken') if @selected_button != nil @selected_button.configure('relief'=>'groove') end @selected_button = _b @selected_class = _class @selected_require = _require @selected_class_obj = _class_obj @owner.frame_title(_class.class_wrapped) #Arcadia.instance.layout.domain(Arcadia.instance['conf']['palette.frame'])['root'].top_text(_class.class_wrapped) end |
#new_wrapper(_parent = nil, _obj = nil) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'ext/ae-palette/ae-palette.rb', line 145 def new_wrapper(_parent = nil, _obj = nil) if @selected_button == nil return end # copy obj if @selected_class_obj != nil && _obj == nil _obj = eval(@selected_class_obj).new(_parent == nil ?nil:_parent.obj) end w = @selected_class.new(_parent, _obj) #$arcadia['objic'].active.select_last(true) if @selected_class_obj != nil #$arcadia.objects('objic').active.addRequire(@selected_require) if @selected_require != nil w.select.activate if @selected_class_obj != nil w.add_require([@selected_require]) if @selected_require != nil @selected_button.configure('relief'=>'groove') @selected_button = @selected_class = @selected_require = nil end |
#new_wrapper_code ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 |
# File 'ext/ae-palette/ae-palette.rb', line 132 def new_wrapper_code _code = '' if @selected_button != nil && @selected_class_obj != nil #objiinfo = @owner.ae_inspector_talker.info #_code = objiinfo.active_wrapper.renderer.class_code.to_s _code = AG.active.renderer.class_code.to_s @selected_button.configure('relief'=>'groove') @selected_button = @selected_class = @selected_require = nil end return _code end |
#unfill ⇒ Object
181 182 183 184 185 186 187 188 189 190 |
# File 'ext/ae-palette/ae-palette.rb', line 181 def unfill if @selected_button != nil @selected_button.configure('relief'=>'groove') end @selected_button = nil @selected_class = nil @selected_require = nil @selected_class_obj = nil Arcadia.instance.layout.domain(Arcadia.instance['conf']['palette.frame'])['root'].top_text('') end |