Sha256: c8f130733a9ef716a38e0960f1df17837c6bcecaac5a91ea1d671f3404c88f8d

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

class Shoes
  class Button
    include Common::UIElement
    include Common::Style
    include Common::Clickable

    attr_reader :app, :parent, :dimensions, :gui
    style_with :click, :common_styles, :dimensions, :state, :text

    def initialize(app, parent, text, styles = {}, blk = nil)
      @app = app
      @parent = parent
      style_init styles, text: text
      @dimensions = Dimensions.new parent, @style
      @parent.add_child self
      @gui = Shoes.configuration.backend_for self, @parent.gui
      register_click blk
    end

    def focus
      @gui.focus
    end

    def state=(value)
      style(state: value)
      @gui.enabled value.nil?
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-dsl-4.0.0.pre2 lib/shoes/button.rb