Class: Shoes::Swt::Progress

Inherits:
Object
  • Object
show all
Includes:
Common::UpdatePosition, Common::Remove, Common::Visibility, DisposedProtection
Defined in:
shoes-swt/lib/shoes/swt/progress.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DisposedProtection

#real

Methods included from Common::Visibility

#hidden?, #hidden_from_view?, #hide, #outside_parent_view?, #show, #toggle, #visible?

Methods included from Common::Remove

#remove

Constructor Details

#initialize(dsl, app) ⇒ Progress

Returns a new instance of Progress.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'shoes-swt/lib/shoes/swt/progress.rb', line 14

def initialize(dsl, app)
  @dsl = dsl
  @app = app

  @real = ::Swt::Widgets::ProgressBar.new(@app.real,
                                          ::Swt::SWT::SMOOTH)
  real.minimum = 0
  real.maximum = 100

  if @dsl.element_width && @dsl.element_height
    real.setSize dsl.element_width, dsl.element_height
  else
    real.pack
    @dsl.element_width  = real.size.x
    @dsl.element_height = real.size.y
  end
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



12
13
14
# File 'shoes-swt/lib/shoes/swt/progress.rb', line 12

def app
  @app
end

#dslObject (readonly)

Returns the value of attribute dsl.



12
13
14
# File 'shoes-swt/lib/shoes/swt/progress.rb', line 12

def dsl
  @dsl
end

Instance Method Details

#fraction=(value) ⇒ Object



32
33
34
# File 'shoes-swt/lib/shoes/swt/progress.rb', line 32

def fraction=(value)
  real.selection = (value * 100).to_i
end