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.


2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
# File 'lib/a-tkcommons.rb', line 2088

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


2087
2088
2089
# File 'lib/a-tkcommons.rb', line 2087

def max
  @max
end

Instance Method Details

#destroyObject


2118
2119
2120
2121
# File 'lib/a-tkcommons.rb', line 2118

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

#on_cancel=(_proc) ⇒ Object


2127
2128
2129
# File 'lib/a-tkcommons.rb', line 2127

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

#on_destroy=(_proc) ⇒ Object


2131
2132
2133
# File 'lib/a-tkcommons.rb', line 2131

def on_destroy=(_proc)
  @on_destroy=_proc
end

#progress(_incr = 1) ⇒ Object


2123
2124
2125
# File 'lib/a-tkcommons.rb', line 2123

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