Sha256: 5509e0962a77d52002d617d54133e0279486322f4fb335563dfb40e780cb85c2

Contents?: true

Size: 896 Bytes

Versions: 4

Compression:

Stored size: 896 Bytes

Contents

# frozen_string_literal: true
class Shoes
  module Swt
    class Progress
      include Common::Remove
      include Common::Visibility
      include Common::UpdatePosition
      include DisposedProtection
      include ::Shoes::BackendDimensionsDelegations

      attr_reader :app, :dsl

      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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre12 lib/shoes/swt/progress.rb
shoes-swt-4.0.0.pre11 lib/shoes/swt/progress.rb
shoes-swt-4.0.0.pre10 lib/shoes/swt/progress.rb
shoes-swt-4.0.0.pre9 lib/shoes/swt/progress.rb