Sha256: e4c162c61005f4fe754d79f3c9fb08651071c62410167a55e2e9713a98923889

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

module Tk
  # A button is a widget that displays a textual string, bitmap or image.
  # If text is displayed, it must all be in a single font, but it can occupy
  # multiple lines on the screen (if it contains newlines or if wrapping occurs
  # because of the wrapLength option) and one of the characters may optionally
  # be underlined using the underline option.
  # It can display itself in either of three different ways, according to the
  # state option; it can be made to appear raised, sunken, or flat; and it can
  # be made to flash.
  # When a user invokes the button (by pressing mouse button 1 with the cursor
  # over the button), then the command specified in the -command option is
  # invoked.
  class Button < Widget
    include Cget, Configure

    def self.tk_command; 'button'; end

    # TODO: implement custom procs
    def initialize(parent = Tk.root, options = None, &block)
      if block
        options = {} unless options.respond_to?(:[]=)
        options[:command] = register_command(:command, &block)
      end

      super
    end

    def destroy
      unregister_commands
      super
    end

    def invoke
      execute_only('invoke')
    end

    def flash
      execute_only('flash')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffi-tk-2010.08.23 lib/ffi-tk/widget/button.rb
ffi-tk-2010.08 lib/ffi-tk/widget/button.rb
ffi-tk-2010.06 lib/ffi-tk/widget/button.rb
ffi-tk-2010.03 lib/ffi-tk/widget/button.rb
ffi-tk-2010.02 lib/ffi-tk/widget/button.rb
ffi-tk-2010.01 lib/ffi-tk/widget/button.rb
ffi-tk-2010.01.02 lib/ffi-tk/widget/button.rb
ffi-tk-2009.12.14 lib/ffi-tk/widget/button.rb
ffi-tk-2009.11.29 lib/ffi-tk/widget/button.rb