Class: Fzeet::Windows::POINT
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Fzeet::Windows::POINT
- Defined in:
- lib/fzeet/windows/core/Point.rb
Class Method Summary collapse
- .[](x, y) ⇒ Object (also: from)
Instance Method Summary collapse
- #==(other) ⇒ Object
- #clear ⇒ Object
- #client(window) ⇒ Object
- #client!(window) ⇒ Object
- #dup ⇒ Object
- #get ⇒ Object (also: #to_a)
- #inside?(r) ⇒ Boolean
- #offset(dx, dy) ⇒ Object
- #offset!(dx, dy) ⇒ Object
- #outside?(r) ⇒ Boolean
- #screen(window) ⇒ Object
- #screen!(window) ⇒ Object
- #set(x, y) ⇒ Object
Class Method Details
.[](x, y) ⇒ Object Also known as: from
10 |
# File 'lib/fzeet/windows/core/Point.rb', line 10 def self.[](x, y) new.set(x, y) end |
Instance Method Details
#==(other) ⇒ Object
26 |
# File 'lib/fzeet/windows/core/Point.rb', line 26 def ==(other) self[:x] == other[:x] && self[:y] == other[:y] end |
#clear ⇒ Object
24 |
# File 'lib/fzeet/windows/core/Point.rb', line 24 def clear; set(0, 0) end |
#client(window) ⇒ Object
33 |
# File 'lib/fzeet/windows/core/Point.rb', line 33 def client(window) dup.client!(window) end |
#client!(window) ⇒ Object
34 |
# File 'lib/fzeet/windows/core/Point.rb', line 34 def client!(window) tap { |pt| Windows.Detonate(0, :ScreenToClient, window.handle, pt) } end |
#dup ⇒ Object
17 |
# File 'lib/fzeet/windows/core/Point.rb', line 17 def dup; self.class[self[:x], self[:y]] end |
#get ⇒ Object Also known as: to_a
19 |
# File 'lib/fzeet/windows/core/Point.rb', line 19 def get; [self[:x], self[:y]] end |
#inside?(r) ⇒ Boolean
27 |
# File 'lib/fzeet/windows/core/Point.rb', line 27 def inside?(r) r.include?(self) end |
#offset(dx, dy) ⇒ Object
30 |
# File 'lib/fzeet/windows/core/Point.rb', line 30 def offset(dx, dy) dup.offset!(dx, dy) end |
#offset!(dx, dy) ⇒ Object
31 |
# File 'lib/fzeet/windows/core/Point.rb', line 31 def offset!(dx, dy) tap { |pt| pt[:x] += dx; pt[:y] += dy } end |
#outside?(r) ⇒ Boolean
28 |
# File 'lib/fzeet/windows/core/Point.rb', line 28 def outside?(r) !inside?(r) end |
#screen(window) ⇒ Object
36 |
# File 'lib/fzeet/windows/core/Point.rb', line 36 def screen(window) dup.screen!(window) end |
#screen!(window) ⇒ Object
37 |
# File 'lib/fzeet/windows/core/Point.rb', line 37 def screen!(window) tap { |pt| Windows.Detonate(0, :ClientToScreen, window.handle, pt) } end |
#set(x, y) ⇒ Object
22 |
# File 'lib/fzeet/windows/core/Point.rb', line 22 def set(x, y) tap { |pt| pt[:x], pt[:y] = x, y } end |