Class: TkWidgetFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/a-tkcommons.rb

Defined Under Namespace

Modules: WidgetEnhancer

Instance Method Summary collapse

Constructor Details

#initializeTkWidgetFactory

Returns a new instance of TkWidgetFactory.



2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
# File 'lib/a-tkcommons.rb', line 2218

def initialize
  if Arcadia.conf('tile.theme')
    @use_tile = true
    begin
      require 'tkextlib/tile'
      if Tk::Tile::Style.theme_names.include?(Arcadia.conf('tile.theme'))
        Tk::Tile::Style.theme_use(Arcadia.conf('tile.theme'))
      end
    rescue
      @use_tile = false
    end
    initialize_tile_widgets if @use_tile
  end
end

Instance Method Details

#button(_parent, _args = {}, &b) ⇒ Object



2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
# File 'lib/a-tkcommons.rb', line 2579

def button(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Button.new(_parent,{:style=>"Arcadia.TButton"}.update(_args), &b)
    else
      obj = TkButton.new(_parent,Arcadia.style('button').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#checkbutton(_parent, _args = {}, &b) ⇒ Object



2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
# File 'lib/a-tkcommons.rb', line 2698

def checkbutton(_parent, _args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Checkbutton.new(_parent,{:style=>"Arcadia.TCheckbutton"}.update(_args), &b)
    else
      obj = TkCheckbutton.new(_parent,Arcadia.style('checkbox').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#combobox(_parent, _args = {}, &b) ⇒ Object



2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
# File 'lib/a-tkcommons.rb', line 2647

def combobox(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Combobox.new(_parent,{:style=>"Arcadia.TCombobox"}.update(_args), &b)
    else
      obj = Tk::BWidget::ComboBox.new(_parent, Arcadia.style('combobox').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#entry(_parent, _args = {}, &b) ⇒ Object



2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
# File 'lib/a-tkcommons.rb', line 2545

def entry(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::TEntry.new(_parent,{:style=>"Arcadia.TEntry"}.update(_args), &b)
    else
      obj = TkEntry.new(_parent,Arcadia.style('edit').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#frame(_parent, _args = {}, &b) ⇒ Object



2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
# File 'lib/a-tkcommons.rb', line 2510

def frame(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::TFrame.new(_parent,{:style=>"Arcadia.TFrame"}.update(_args), &b)
    else
      obj = TkFrame.new(_parent,Arcadia.style('panel').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#initialize_tile_widgetsObject



2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
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
# File 'lib/a-tkcommons.rb', line 2233

def initialize_tile_widgets

  #Widget state flags include:
  #active,disabled,focus,pressed,selected,background,readonly,alternate,invalid,hover

	 # Workaround for #1100117:
  # Actually, on Aqua we probably shouldn't stipple images in
  # disabled buttons even if it did work...
  # don't work with Cocoa
  Tk.tk_call("eval","ttk::style configure . -stipple {}") if OS.mac?

  #TScrollbar
  Tk::Tile::Style.configure("Arcadia.TScrollbar", Arcadia.style('scrollbar'))
  Tk::Tile::Style.map("Arcadia.TScrollbar",
  :background=>[:pressed, Arcadia.style('scrollbar')['activebackground'], :disabled, Arcadia.style('scrollbar')['background'], :active, Arcadia.style('scrollbar')['activebackground']],
  :arrowcolor=>[:pressed, Arcadia.style('scrollbar')['background'], :disabled, Arcadia.style('scrollbar')['highlightbackground'], :active, Arcadia.style('scrollbar')['background']],
  :relief=>[:pressed, :sunken])

  Tk::Tile::Style.layout(Tk::Tile.style('Vertical', "Arcadia.TScrollbar"),
  ["Scrollbar.trough",{:sticky=>"nsew", :children=>[
    "Scrollbar.uparrow",{:side=>:top, :sticky=>"we"},
    "Scrollbar.downarrow", {:side=>:bottom, :sticky=>"we"},
  "Scrollbar.thumb", {:sticky=>"nswe",:side=>:top, :border =>1, :expand=>true}]}])

  Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', "Arcadia.TScrollbar"),
  ['Scrollbar.trough', {:children=>[
    'Scrollbar.leftarrow',   {:side=>:left},
    'Scrollbar.rightarrow', {:side=>:right},
  'Scrollbar.thumb',  {:side=>:left, :expand=>true}]}])

  #TFrame
  #Tk::Tile::Style.configure(Tk::Tile::TFrame, Arcadia.style('panel'))

  #TPaned
  #Tk::Tile::Style.configure(Tk::Tile::TPaned, Arcadia.style('panel'))

  #TEntry
  #Tk::Tile::Style.configure(Tk::Tile::TEntry, Arcadia.style('edit'))

  #TCombobox
  #Tk::Tile::Style.configure(Tk::Tile::TCombobox, Arcadia.style('combobox'))

  #TLabel
  #Tk::Tile::Style.configure(Tk::Tile::TLabel, Arcadia.style('label'))


  #Treeview
  #Tk::Tile::Style.configure(Tk::Tile::Treeview, Arcadia.style('treepanel'))

  #TMenubutton
  Tk::Tile::Style.element_create('Arcadia.Menubutton.indicator', 
                                 :image, Arcadia.image_res(DROP_DOWN_ARROW_GIF),
                                 :sticky=>:w)    

  Tk::Tile::Style.configure("Arcadia.TMenubutton", Arcadia.style('menubutton').update(
    'padding'=>"0 0 0 0", 
    'width'=>0
    )
  )

  Tk::Tile::Style.map("Arcadia.TMenubutton",
  :background=>[:pressed, Arcadia.style('menubutton')['activebackground'], :disabled, Arcadia.style('menubutton')['background'], :active, Arcadia.style('menubutton')['activebackground']],
  :arrowcolor=>[:pressed, Arcadia.style('menubutton')['background'], :disabled, Arcadia.style('menubutton')['highlightbackground'], :active, Arcadia.style('menubutton')['background']],
  :relief=>[:pressed, :flat])
  Tk::Tile::Style.layout('Arcadia.TMenubutton', [
      'Menubutton.border', {:children=>[
           'Menubutton.padding', {:children=>[
                'Arcadia.Menubutton.indicator', {:side=>:right}, 
                'Menubutton.focus', {:side=>:left, :children=>['Menubutton.label']}
           ]}
      ]}
  ])

  #Title.TMenubutton
  # 
  Tk::Tile::Style.configure("Arcadia.Title.TMenubutton", Arcadia.style('titlelabel').update(
    'padding'=>"0 0 0 0", 
    'font'=>Arcadia.conf('titlelabel.font'), 
    'width'=>0,
    'foreground' => Arcadia.conf('titlelabel.foreground'),
    )
  )
  Tk::Tile::Style.map("Arcadia.Title.TMenubutton",
  :background=>[:pressed, Arcadia.style('titlelabel')['activebackground'], :disabled, Arcadia.style('titlelabel')['background'], :active, Arcadia.style('titlelabel')['activebackground']],
  :arrowcolor=>[:pressed, Arcadia.style('titlelabel')['background'], :disabled, Arcadia.style('titlelabel')['highlightbackground'], :active, Arcadia.style('titlelabel')['background']],
  :relief=>[:pressed, :flat])
  Tk::Tile::Style.layout('Arcadia.Title.TMenubutton', [
      'Menubutton.border', {:children=>[
           'Menubutton.padding', {:children=>[
                'Arcadia.Menubutton.indicator', {:side=>:right}, 
                'Menubutton.focus', {:side=>:left, :children=>['Menubutton.label']}
           ]}
      ]}
  ])

  #Title.Context.TMenubutton
  # 
  Tk::Tile::Style.configure("Arcadia.Title.Context.TMenubutton", Arcadia.style('titlelabel').update(
    'padding'=>"0 0 0 0", 
    'font'=>"#{Arcadia.conf('titlelabel.font')} italic", 
    'width'=>0,
    'foreground' => Arcadia.conf('titlecontext.foreground'),
    )
  )
  Tk::Tile::Style.map("Arcadia.Title.Context.TMenubutton",
  :background=>[:pressed, Arcadia.style('titlelabel')['activebackground'], :disabled, Arcadia.style('titlelabel')['background'], :active, Arcadia.style('titlelabel')['activebackground']],
  :arrowcolor=>[:pressed, Arcadia.style('titlelabel')['background'], :disabled, Arcadia.style('titlelabel')['highlightbackground'], :active, Arcadia.style('titlelabel')['background']],
  :relief=>[:pressed, :flat])
  Tk::Tile::Style.layout('Arcadia.Title.Context.TMenubutton', [
      'Menubutton.border', {:children=>[
           'Menubutton.padding', {:children=>[
                'Arcadia.Menubutton.indicator', {:side=>:right}, 
                'Menubutton.focus', {:side=>:left, :children=>['Menubutton.label']}
           ]}
      ]}
  ])
  
  
  #TCheckbutton, 

  Tk::Tile::Style.element_create('Arcadia.Checkbutton.indicator', 
                                 :image, Arcadia.image_res(CHECKBOX_0_DARK_GIF),
                                 :map=>[
                                   [:pressed, :selected],Arcadia.image_res(CHECKBOX_1_DARK_GIF),
                                   :pressed,             Arcadia.image_res(CHECKBOX_0_DARK_GIF),
                                   [:active, :selected], Arcadia.image_res(CHECKBOX_2_DARK_GIF),
                                   :active,              Arcadia.image_res(CHECKBOX_0_DARK_GIF),
                                   :selected,            Arcadia.image_res(CHECKBOX_1_DARK_GIF),
                                 ], :sticky=>:w)  

  Tk::Tile::Style.configure("Arcadia.TCheckbutton", Arcadia.style('checkbox').update(
      'padding'=>"0 0 0 0", 
      'width'=>0
      )
    )
  
  Tk::Tile::Style.layout('Arcadia.TCheckbutton', [
      'Checkbutton.background', # this is not needed in tile 0.5 or later
      'Checkbutton.border', {:children=>[
           'Checkbutton.padding', {:children=>[
                'Arcadia.Checkbutton.indicator', {:side=>:left}, 
                'Checkbutton.focus', {:side=>:left, :children=>[
                    'Checkbutton.label'
                ]}
           ]}
      ]}
  ])    

                                 
  Tk::Tile::Style.configure("Arcadia.Title.TCheckbutton", Arcadia.style('titlelabel').update(
      'padding'=>"0 0 0 0", 
      'width'=>0
      )
    )
  
  Tk::Tile::Style.layout('Arcadia.Title.TCheckbutton', [
      'Checkbutton.background', # this is not needed in tile 0.5 or later
      'Checkbutton.border', {:children=>[
           'Checkbutton.padding', {:children=>[
                'Arcadia.Checkbutton.indicator', {:side=>:left}, 
                'Checkbutton.focus', {:side=>:left, :children=>[
                    'Checkbutton.label'
                ]}
           ]}
      ]}
  ])    
  
  #Combobox
  

  Tk::Tile::Style.element_create('Arcadia.Combobox.indicator', 
                                 :image, Arcadia.image_res(DROP_DOWN_ARROW_GIF),
                                 :sticky=>:w)    

  Tk::Tile::Style.configure("Arcadia.TCombobox", Arcadia.style('combobox').update(
    'padding'=>"0 0 0 0", 
    'width'=>0
   # 'borderwidth'=>1,
   # 'relief'=>'groove'      
    )
  )

#    Tk::Tile::Style.map("Arcadia.TCombobox",
#    :relief=>[:pressed, :flat])
  
  Tk::Tile::Style.layout('Arcadia.TCombobox', [
      'Combobox.border', {:children=>[
           'Combobox.padding', {:children=>[
                'Arcadia.Combobox.indicator', {:side=>:right}, 
                'Combobox.focus', {:side=>:left, :children=>['Combobox.label']}
           ]}
      ]}
  ])


  #TFrame
  Tk::Tile::Style.configure("Arcadia.TFrame", Arcadia.style('panel'))



  #Tk::Tile::Style.configure(Tk::Tile::TLabel, Arcadia.style('label'))
  #TLabel
  Tk::Tile::Style.configure("Arcadia.TLabel", Arcadia.style('label'))


  #TEntry
  Tk::Tile::Style.layout("Arcadia.TEntry", [
      'Entry.border', { :sticky => 'nswe', :border => 1, 
            :children =>  ['Entry.padding',  { :sticky => 'nswe', 
                    :children => [ 'Entry.textarea',  { :sticky => 'nswe' } ] }] } ])
  
  
  Tk::Tile::Style.configure("Arcadia.TEntry", Arcadia.style('edit').update(
       'fieldbackground' => Arcadia.style('edit')['background'],
       'selectbackground' => 'red',
       'selectforeground' => 'yellow'
     )
  )

  #TText
  Tk::Tile::Style.configure("Arcadia.TText", Arcadia.style('text'))


  #TButton
  Tk::Tile::Style.configure("Arcadia.TButton", Arcadia.style('button').update(
    'padding'=>"0 0 0 0"
#      ,
#      'borderwidth'=>1,
#      'relief'=>'groove' 
    )
  )
  Tk::Tile::Style.map("Arcadia.TButton",
  :background=>[:pressed, Arcadia.style('button')['activebackground'], :disabled, Arcadia.style('button')['background'], :active, Arcadia.style('button')['activebackground']],
  :foreground=>[:pressed, Arcadia.style('button')['activeforeground'], :disabled, Arcadia.style('button')['foreground'], :active, Arcadia.style('button')['activeforeground']],
  :relief=>[:pressed, :sunken])

  #Tool.TButton
  Tk::Tile::Style.configure("Arcadia.Tool.TButton", Arcadia.style('toolbarbutton').update(
    'padding'=>"0 0 0 0",
    'anchor'=>'w' 
    )
  )
  Tk::Tile::Style.map("Arcadia.Tool.TButton",
  :background=>[:pressed, Arcadia.style('button')['activebackground'], :disabled, Arcadia.style('toolbarbutton')['background'], :active, Arcadia.style('toolbarbutton')['activebackground']],
  :arrowcolor=>[:pressed, Arcadia.style('button')['background'], :disabled, Arcadia.style('toolbarbutton')['highlightbackground'], :active, Arcadia.style('toolbarbutton')['background']],
  :relief=>[:pressed, :sunken])

  #Title.Tool.TButton
  Tk::Tile::Style.configure("Arcadia.Title.Tool.TButton", Arcadia.style('titletoolbarbutton').update(
    'padding'=>"0 0 0 0" 
    )
  )
  Tk::Tile::Style.map("Arcadia.Title.Tool.TButton",
  :background=>[:pressed, Arcadia.style('button')['activebackground'], :disabled, Arcadia.style('titletoolbarbutton')['background'], :active, Arcadia.style('toolbarbutton')['activebackground']],
  :arrowcolor=>[:pressed, Arcadia.style('button')['background'], :disabled, Arcadia.style('titletoolbarbutton')['highlightbackground'], :active, Arcadia.style('toolbarbutton')['background']],
  :relief=>[:pressed, :sunken])
  
end

#label(_parent, _args = {}, &b) ⇒ Object



2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
# File 'lib/a-tkcommons.rb', line 2528

def label(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::TLabel.new(_parent,{:style=>"Arcadia.TLabel"}.update(_args), &b)
    else
      obj = TkLabel.new(_parent,Arcadia.style('label').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end


2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
# File 'lib/a-tkcommons.rb', line 2732

def menu(_parent,_args={}, &b)
  begin
    obj = TkMenu.new(_parent, &b)
    if !OS.mac?
      obj.configure(Arcadia.style('menu').update(_args))
      obj.extend(TkAutoPostMenu)
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end


2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
# File 'lib/a-tkcommons.rb', line 2630

def menubutton(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Menubutton.new(_parent,{:style=>"Arcadia.TMenubutton"}.update(_args), &b)
    else
      obj = TkMenuButton.new(_parent,Arcadia.style('menubutton').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#scrollbar(_parent, _args = {}, &b) ⇒ Object



2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
# File 'lib/a-tkcommons.rb', line 2494

def scrollbar(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Scrollbar.new(_parent,{:style=>"Arcadia.TScrollbar"}.update(_args), &b)
    else
      obj = TkScrollbar.new(_parent,Arcadia.style('scrollbar').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
  end
end

#text(_parent, _args = {}, &b) ⇒ Object



2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
# File 'lib/a-tkcommons.rb', line 2562

def text(_parent,_args={}, &b)
  begin
#      if @use_tile
#        obj = Tk::Tile::Text.new(_parent,{:style=>"Arcadia.TText"}.update(_args), &b)
#      else
      obj = TkText.new(_parent,Arcadia.style('text').update(_args), &b)
#      end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#titlecontextcheckbutton(_parent, _args = {}, &b) ⇒ Object



2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
# File 'lib/a-tkcommons.rb', line 2715

def titlecontextcheckbutton(_parent, _args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Checkbutton.new(_parent,{:style=>"Arcadia.Title.TCheckbutton"}.update(_args), &b)
    else
      obj = TkCheckbutton.new(_parent,Arcadia.style('checkbox').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#titlecontextmenubutton(_parent, _args = {}, &b) ⇒ Object



2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
# File 'lib/a-tkcommons.rb', line 2681

def titlecontextmenubutton(_parent, _args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Menubutton.new(_parent,{:style=>"Arcadia.Title.Context.TMenubutton"}.update(_args), &b)
    else
      obj = TkMenuButton.new(_parent,Arcadia.style('menubutton').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#titlemenu(_parent, _args = {}, &b) ⇒ Object



2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
# File 'lib/a-tkcommons.rb', line 2746

def titlemenu(_parent,_args={}, &b)
  begin
    obj = TkMenu.new(_parent, &b)
    if !OS.mac?
      obj.configure(Arcadia.style('titlemenu').update(_args))
      obj.extend(TkAutoPostMenu)
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#titlemenubutton(_parent, _args = {}, &b) ⇒ Object



2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
# File 'lib/a-tkcommons.rb', line 2664

def titlemenubutton(_parent, _args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Menubutton.new(_parent,{:style=>"Arcadia.Title.TMenubutton"}.update(_args), &b)
    else
      obj = TkMenuButton.new(_parent,Arcadia.style('menubutton').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#titletoolbutton(_parent, _args = {}, &b) ⇒ Object



2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
# File 'lib/a-tkcommons.rb', line 2613

def titletoolbutton(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Button.new(_parent,{:style=>"Arcadia.Title.Tool.TButton"}.update(_args), &b)
    else
      obj = TkButton.new(_parent,Arcadia.style('toolbarbutton').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end

#toolbutton(_parent, _args = {}, &b) ⇒ Object



2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
# File 'lib/a-tkcommons.rb', line 2596

def toolbutton(_parent,_args={}, &b)
  begin
    if @use_tile
      obj = Tk::Tile::Button.new(_parent,{:style=>"Arcadia.Tool.TButton"}.update(_args), &b)
    else
      obj = TkButton.new(_parent,Arcadia.style('toolbarbutton').update(_args), &b)
    end
    class << obj
      include WidgetEnhancer
    end
    return obj
  rescue RuntimeError => e
    Arcadia.runtime_error(e) 
    return nil
  end
end