Module: WindowBlessing::Window::Geometry
- Included in:
- WindowBlessing::Window
- Defined in:
- lib/window_blessing/window.rb
Instance Attribute Summary collapse
-
#area ⇒ Object
Returns the value of attribute area.
Instance Method Summary collapse
- #internal_area ⇒ Object
- #loc ⇒ Object
- #loc=(new_loc) ⇒ Object
- #move_onscreen ⇒ Object
- #pointer_inside?(loc) ⇒ Boolean
- #size ⇒ Object
- #size=(new_size) ⇒ Object
Instance Attribute Details
#area ⇒ Object
Returns the value of attribute area.
104 105 106 |
# File 'lib/window_blessing/window.rb', line 104 def area @area end |
Instance Method Details
#internal_area ⇒ Object
124 |
# File 'lib/window_blessing/window.rb', line 124 def internal_area; rect @area.size end |
#loc ⇒ Object
126 |
# File 'lib/window_blessing/window.rb', line 126 def loc; area.loc; end |
#loc=(new_loc) ⇒ Object
127 |
# File 'lib/window_blessing/window.rb', line 127 def loc=(new_loc) self.area = rect new_loc, area.size end |
#move_onscreen ⇒ Object
134 135 136 137 138 |
# File 'lib/window_blessing/window.rb', line 134 def move_onscreen return unless parent parent_area = rect(point, parent.area.size) self.area = parent_area.bound(area) end |
#pointer_inside?(loc) ⇒ Boolean
132 |
# File 'lib/window_blessing/window.rb', line 132 def pointer_inside?(loc) area.contains? loc end |
#size ⇒ Object
129 |
# File 'lib/window_blessing/window.rb', line 129 def size; area.size; end |
#size=(new_size) ⇒ Object
130 |
# File 'lib/window_blessing/window.rb', line 130 def size=(new_size) self.area = rect area.loc, new_size end |