Class: TkFrameProgress

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil, _max = 100, *args) ⇒ TkFrameProgress

Returns a new instance of TkFrameProgress.



1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
# File 'lib/a-tkcommons.rb', line 1812

def initialize(parent=nil, _max=100,  *args)
  super(parent, Arcadia.style('panel').update({:background => Arcadia.conf('titlelabel.background')}), *args)
  _max=1 if _max<=0
  @max = _max
  @progress = TkVariable.new
  @progress.value = -1
  Tk::BWidget::ProgressBar.new(self, :width=>50, :height=>16,
    :background=>Arcadia.conf('titlelabel.background'),
    :troughcolor=>Arcadia.conf('titlelabel.background'),
    :foreground=>Arcadia.conf('progress.foreground'),
    :variable=>@progress,
    :borderwidth=>0,
    :relief=>'flat',
    :maximum=>_max).pack('side'=>'left','padx'=>0, 'pady'=>0)
  #@b_cancel = TkButton.new(self, Arcadia.style('toolbarbutton')){|b|
  @b_cancel = Arcadia.wf.titletoolbutton(self){|b|
   # background  Arcadia.conf('titlelabel.background')
   # foreground  Arcadia.conf('titlelabel.background')
   # highlightbackground Arcadia.conf('titlelabel.background')
   # highlightcolor Arcadia.conf('titlelabel.background')
    image Arcadia.image_res(CLOSE_FRAME_GIF)
   # borderwidth 0
   # relief 'flat'
   # padx 0
   # pady 0
   # anchor 'n'
    pack('side'=>'left','padx'=>0, 'pady'=>0)
  }
end

Instance Attribute Details

#maxObject

Returns the value of attribute max.



1811
1812
1813
# File 'lib/a-tkcommons.rb', line 1811

def max
  @max
end

Instance Method Details

#destroyObject



1842
1843
1844
1845
# File 'lib/a-tkcommons.rb', line 1842

def destroy
  @on_destroy.call if defined?(@on_destroy)
  super
end

#on_cancel=(_proc) ⇒ Object



1851
1852
1853
# File 'lib/a-tkcommons.rb', line 1851

def on_cancel=(_proc)
  @b_cancel.bind_append('1', _proc)
end

#on_destroy=(_proc) ⇒ Object



1855
1856
1857
# File 'lib/a-tkcommons.rb', line 1855

def on_destroy=(_proc)
  @on_destroy=_proc
end

#progress(_incr = 1) ⇒ Object



1847
1848
1849
# File 'lib/a-tkcommons.rb', line 1847

def progress(_incr=1)
  @progress.numeric += _incr
end