Class: SKUI::Rect

Inherits:
Object
  • Object
show all
Defined in:
src/SKUI/rect.rb

Overview

Returns the position and size of the control as reported by the WebDialog. The WebDialog must be ready and visible for these methods to work.

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

#initialize(control) ⇒ Rect

Returns a new instance of Rect.

Parameters:

Since:

  • 1.0.0



11
12
13
14
15
16
# File 'src/SKUI/rect.rb', line 11

def initialize( control )
  unless control.is_a?( Control )
    raise( ArgumentError, 'Not a valid control.' )
  end
  @control = control
end

Instance Method Details

#bottomInteger

Returns:

  • (Integer)

Since:

  • 1.0.0



38
39
40
# File 'src/SKUI/rect.rb', line 38

def bottom
  get_rect[ 'bottom' ]
end

#heightInteger

Returns:

  • (Integer)

Since:

  • 1.0.0



50
51
52
# File 'src/SKUI/rect.rb', line 50

def height
  get_rect[ 'height' ]
end

#leftInteger

Returns:

  • (Integer)

Since:

  • 1.0.0



20
21
22
# File 'src/SKUI/rect.rb', line 20

def left
  get_rect[ 'left' ]
end

#releaseNil

Returns:

  • (Nil)

See Also:

Since:

  • 1.0.0



57
58
59
60
# File 'src/SKUI/rect.rb', line 57

def release
  @control = nil
  nil
end

#rightInteger

Returns:

  • (Integer)

Since:

  • 1.0.0



32
33
34
# File 'src/SKUI/rect.rb', line 32

def right
  get_rect[ 'right' ]
end

#to_hashHash

Returns:

  • (Hash)

Since:

  • 1.0.0



64
65
66
67
68
# File 'src/SKUI/rect.rb', line 64

def to_hash
  hash = get_rect
  keys = hash.keys.map { |string| string.intern }
  Hash[ *keys.zip(hash.values).flatten ]
end

#topInteger

Returns:

  • (Integer)

Since:

  • 1.0.0



26
27
28
# File 'src/SKUI/rect.rb', line 26

def top
  get_rect[ 'top' ]
end

#widthInteger

Returns:

  • (Integer)

Since:

  • 1.0.0



44
45
46
# File 'src/SKUI/rect.rb', line 44

def width
  get_rect[ 'width' ]
end