Class: AGTkToplevel
- Inherits:
-
AGTkContainer
- Object
- AG
- AGTk
- AGTkLayoutManaged
- AGTkBaseContainer
- AGTkContainer
- AGTkToplevel
- Defined in:
- ext/ae-rad/lib/tk/al-tk.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from AGTkBaseContainer
Attributes inherited from AGTk
#canvas, #l_manager, #x0, #x3, #y0, #y3
Attributes inherited from AG
#ag_parent, #i_ag, #i_name, #obj, #obj_class, #persistent, #props, #props_def, #props_kinds, #renderer, #sniffer, #sons
Class Method Summary collapse
Instance Method Summary collapse
- #form2code ⇒ Object
-
#get_implementation_new ⇒ Object
overloaded.
-
#initialize(_ag_parent = nil, _object = nil) ⇒ AGTkToplevel
constructor
A new instance of AGTkToplevel.
- #keep_me ⇒ Object
- #new_object ⇒ Object
- #on_close_query ⇒ Object
- #passed_object(_obj) ⇒ Object
- #popup_items(_popup_menu) ⇒ Object
- #properties ⇒ Object
- #rewind_by_property(_name, _val) ⇒ Object
- #set_obj_exit_protocol ⇒ Object
Methods inherited from AGTkContainer
Methods inherited from AGTkLayoutManaged
Methods inherited from AGTk
#activate, #active_move_tab, class_renderer, class_sniffer, #contains_events, #delete, #getFileName, #has_events, #popup, #update_property
Methods inherited from AG
#activate, active, #add_require, #build_sons, class_renderer, class_sniffer, #defaults, #defaults_values, #del_require, #delete, #fill_defaults_value_from_agobj, #getControlClassName, #getFileName, #getInstanceClass, #getObjClass, #getViewClassName, #get_implementation_block, #get_implementation_code, #get_path_i_name, #has_sons, near_class_wrapped, near_class_wrapper, #new_id, #publish, #publish_def, #publish_del, #publish_mod, publish_property, #register, #retrive_values, #select, #start_properties, #update_property
Constructor Details
#initialize(_ag_parent = nil, _object = nil) ⇒ AGTkToplevel
Returns a new instance of AGTkToplevel.
2362 2363 2364 2365 2366 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2362 def initialize(_ag_parent=nil, _object = nil) super(_ag_parent, _object) @l_manager.util_bind end |
Class Method Details
.class_wrapped ⇒ Object
2368 2369 2370 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2368 def AGTkToplevel.class_wrapped TkToplevel end |
Instance Method Details
#form2code ⇒ Object
2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2372 def form2code _title = @i_name+'.rb' _text = @renderer.class_code.to_s Arcadia.process_event(OpenBufferEvent.new(self,'title'=>_title, 'text'=>_text)) meditor = $arcadia['editor'] if meditor _editor = meditor.raised code2form = proc{ Revparsel.new(_editor.text_value) meditor.close_editor(_editor, false) InspectorContract.instance.(meditor) } _editor.('end', :command, :label=>'View as form', :hidemargin => false, :command=> code2form ) end #EditorContract.instance.open_text(self, 'title'=>_title, 'text'=>_text) self.delete end |
#get_implementation_new ⇒ Object
overloaded
2543 2544 2545 2546 2547 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2543 def get_implementation_new #overloaded result = '@',@i_name,' = ', getInstanceClass ,".new\n" result = result,'@', @i_ag," = ",self.class, '.new(nil,','@',@i_name,", $arcadia.objects('objic').create(", "self,'", $arcadia.objects('objic').active.filename,"'))" end |
#keep_me ⇒ Object
2396 2397 2398 2399 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2396 def keep_me $arcadia['buffers.code.in_memory'][@i_name]=@renderer.class_code.to_s self.delete end |
#new_object ⇒ Object
2429 2430 2431 2432 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2429 def new_object super set_obj_exit_protocol end |
#on_close_query ⇒ Object
2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2413 def on_close_query ans = Tk.('icon' => 'question', 'type' => 'yesnocancel', 'title' => 'Exit', 'parent' => @obj, 'message' => "Do you want shift to code view?") if ans =='yes' form2code elsif ans =='no' keep_me end end |
#passed_object(_obj) ⇒ Object
2435 2436 2437 2438 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2435 def passed_object(_obj) super(_obj) set_obj_exit_protocol end |
#popup_items(_popup_menu) ⇒ Object
2401 2402 2403 2404 2405 2406 2407 2408 2409 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2401 def popup_items() super() .insert('end', :command, :label=>'View as code', :hidemargin => false, :command=> proc{form2code} ) end |
#properties ⇒ Object
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2457 def properties super publish_mod('layout_man','name'=>'manager', 'default'=> 'none', 'get'=> proc{'none'}, 'set'=> proc{}, 'def'=> proc{""}, 'type'=> '' ) publish_del('place') publish_del('pack') publish_del('property','state') publish('property','name'=>'geometry', 'get'=> proc{ TkWinfo.geometry(@obj)}, 'set'=> proc{|g| Tk.tk_call('wm', 'geometry', @obj, g )}, 'def'=> proc{|x| "Tk.tk_call('wm', 'geometry', self, #{x} )"}, 'start'=> '245x180+300+230' ) publish('property','name'=>'icon', 'get'=> proc{Tk.tk_call('wm', 'iconbitmap', @obj, nil)}, 'set'=> proc{|i| Tk.tk_call('wm', 'iconbitmap', @obj, i )}, 'def'=> proc{|x| "Tk.tk_call('wm', 'iconbitmap', self, #{x} )"}, 'type'=> TkType::TkagFile ) publish('property','name'=>'title', 'get'=> proc{ Tk.tk_call('wm', 'title', @obj)}, 'set'=> proc{|t| Tk.tk_call('wm', 'title', @obj, t )}, 'def'=> proc{|x| "Tk.tk_call('wm', 'title', self, #{x} )"}, 'start'=>'...hello' ) publish('property',TkProperties::container(@obj)) publish('property',TkProperties::borderwidth(@obj)) publish('property',TkProperties::cursor(@obj)) publish('property',TkProperties::highlightbackground(@obj)) publish('property',TkProperties::highlightcolor(@obj)) publish('property',TkProperties::highlightthickness(@obj)) publish('property',TkProperties::relief(@obj)) publish('property',TkProperties::takefocus(@obj)) publish('property',TkProperties::padx(@obj)) publish('property',TkProperties::pady(@obj)) publish('property',TkProperties::height(@obj)) publish('property',TkProperties::width(@obj)) publish('property','name'=>'class', 'get'=> proc{@obj.cget('class')}, 'set'=> proc{ |r| rewind_by_property('class',r) }, 'kind'=>'on-create' ) publish('property','name'=>'colormap', 'get'=> proc{@obj.cget('colormap')}, 'set'=> proc{|t| @obj.configure('colormap'=>t)}, 'def'=> "" ) publish('property','name'=>'menu', 'get'=> proc{@obj.cget('menu')}, 'set'=> proc{|t| @obj.configure('menu'=>t)}, 'def'=> "" ) publish('property','name'=>'screen', 'get'=> proc{@obj.cget('screen')}, 'set'=> proc{|t| rewind_by_property('screen',t) }, 'def'=> "", 'kind'=>'on-create' ) publish('property','name'=>'use', 'get'=> proc{@obj.cget('use')}, 'set'=> proc{ |r| rewind_by_property('use',r) }, 'kind'=>'on-create' ) publish('property','name'=>'visual', 'get'=> proc{@obj.cget('visual')}, 'set'=> proc{|r| rewind_by_property('visual',r) }, 'def'=> "", 'kind'=>'on-create', 'type'=> EnumType.new('','best', 'directcolor', 'grayscale','greyscale', 'pseudocolor', 'staticcolor', 'staticgray', 'staticgrey', 'truecolor', 'default') ) publish('winfo','name'=>'server','get'=> proc{TkWinfo.server(@obj)}, 'def'=> 'nodef') publish('winfo','name'=>'screen','get'=> proc{TkWinfo.screen(@obj)}, 'def'=> 'nodef') end |
#rewind_by_property(_name, _val) ⇒ Object
2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2440 def rewind_by_property(_name, _val) msg = "To modify "+_name+" must create new Toplevel: do you want to procede ?" if Tk.('icon' => 'warning', 'type' => 'okcancel', 'title' => '(Arcadia) '+_name, 'message' => msg) == 'cancel' return end _rewind_code = @renderer.class_code(2,_name=> _val).to_s begin Revparsel.new(_rewind_code) #$arcadia.objects('objic').del(@object_inspector) rescue => exc _editor = $arcadia.objects('editor').open_tab(@i_name) _editor.text_insert('end', _rewind_code) raise end end |
#set_obj_exit_protocol ⇒ Object
2425 2426 2427 |
# File 'ext/ae-rad/lib/tk/al-tk.rb', line 2425 def set_obj_exit_protocol @obj.protocol( "WM_DELETE_WINDOW", proc{on_close_query}) end |