Sha256: a6eefe27b40b4028d65401bf871be57d6be09ffca6c0186b25d88afe7f32053d
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 KB
Contents
class Shoes module Swt class SwtButton include Common::Remove include Common::Visibility include Common::UpdatePosition include ::Shoes::BackendDimensionsDelegations attr_reader :app, :real, :dsl def initialize(dsl, app, type) @dsl = dsl @app = app @type = type @real = ::Swt::Widgets::Button.new(@app.real, @type) yield(@real) if block_given? set_size end def eval_block(blk) blk.call @dsl end def focus @real.set_focus end def click(blk) remove_listeners @real.addSelectionListener { eval_block blk } end def remove_listeners listener_array = @real.getListeners ::Swt::SWT::Selection listener_array.each do |listener| @real.removeListener ::Swt::SWT::Selection, listener end end def enabled(value) @real.enable_widget value end private def set_size @real.pack @dsl.element_width ||= @real.size.x @dsl.element_height ||= @real.size.y @real.setSize @dsl.element_width, @dsl.element_height end end end end
Version data entries
4 entries across 4 versions & 1 rubygems