module Tk::TkDND::Shape - tk-0.2.0 Documentation

# module Tk::TkDND::Shape

### Constants

PACKAGE_NAME

### Public Class Methods

package_name() click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 23
    def self.package_name
      PACKAGE_NAME
    end

package_patchlevel() click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 42
    def package_patchlevel
      Tk.tk_call('set', 'shape_patchLevel')
    end

Also aliased as: shape_patchlevel
package_version() click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 37
    def package_version
      Tk.tk_call('set', 'shape_version')
    end

Also aliased as: shape_version
shape_patchlevel()
Alias for: package_patchlevel
shape_version()
Alias for: package_version
version() click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 47
    def version
      tk_call('shape', 'version')
    end

Also aliased as: xshape_version
xshape_version()
Alias for: version

### Public Instance Methods

shape_bounds(kind=nil) click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 55
    def shape_bounds(kind=nil)
      if kind
        ret = tk_call('shape', 'bounds', @path, "-#{kind}")
      else
        ret = tk_call('shape', 'bounds', @path)
      end
      if ret == ""
        nil
      else
        list(ret)
      end
    end

shape_get(kind=nil) click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 68
    def shape_get(kind=nil)
      if kind
        list(tk_call('shape', 'get', @path, "-#{kind}"))
      else
        list(tk_call('shape', 'get', @path))
      end
    end

shape_offset(x, y, kind=nil) click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 76
    def shape_offset(x, y, kind=nil)
      if kind
        tk_call('shape', 'get', @path, "-#{kind}", x, y)
      else
        tk_call('shape', 'get', @path, x, y)
      end
      self
    end

shape_set(*args) click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 110
    def shape_set(*args) # ?kind? ?offset <x> <y>? srckind ?arg ...?
      tk_call('shape', 'set', @path, *(_parse_shapespec_param(args)))
      self
    end

shape_update(op, *args) click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 115
    def shape_update(op, *args) # ?kind? ?offset <x> <y>? srckind ?arg ...?
      tk_call('shape', 'update', @path, op, *(_parse_shapespec_param(args)))
      self
    end

### Private Instance Methods

_parse_shapespec_param(args) click to toggle source

    # File lib/tkextlib/tkDND/shape.rb, line 85
    def _parse_shapespec_param(args)
      cmd = []

      kind_keys    = ['bounding', 'clip', 'both']
      offset_keys  = ['offset']
      srckind_keys = ['bitmap', 'rectangles', 'reset', 'test', 'window']

      cmd << "-#{args.shift}" if kind_keys.member?(args[0].to_s)

      if offset_keys.member?(args[0].to_s)
        cmd << "-#{args.shift}"
        cmd << args.shift # xOffset
        cmd << args.shift # yOffset
      end

      if srckind_keys.member?(args[0].to_s)
        cmd << "-#{args.shift}"
      end

      cmd.concat(args)

      cmd
    end