Class: Wx::Rect
- Inherits:
-
Object
- Object
- Wx::Rect
- Defined in:
- lib/wx/doc/gen/gdi_common.rb,
lib/wx/doc/gdi_common.rb
Overview
This class is untracked and should not be derived from nor instances extended!
Represents a rectangle with integer coordinates.
x and y members specify the coordinates of the rectangle top-left corner and width and height specify its width and height respectively. The usual C++ semi-open interval convention is used: point p lies inside the rectangle if and only if both conditions below are satisfied:
x <= p.x < x + width
y <= p.y < y + height
In other words, the rectangle left and right boundaries are at x and x+width-1
and its top and bottom boundaries are at y and y+height-1
respectively. Note that the x and y coordinates may be negative, but width and height are always strictly positive for non-empty rectangles.
Category: Data Structures
Instance Method Summary collapse
- #& ⇒ Object
-
#*(rect) ⇒ Wx::Rect
Returns the overlap of the rectangle areas.
-
#+(rect) ⇒ Wx::Rect
Returns a rectangle containing the bounding box of this rectangle and the one passed in as parameter.
-
#==(other) ⇒ Boolean
Compare area values (Wx::Rect or 4-element array).
-
#assign(rct) ⇒ self
Set this rectangle to the given rectangle’s position & size values.
-
#center_in(r, dir = Wx::Orientation::BOTH) ⇒ Wx::Rect
Returns the rectangle having the same size as this one but centered relatively to the given rectangle r.
-
#centre_in(r, dir = Wx::Orientation::BOTH) ⇒ Wx::Rect
Returns the rectangle having the same size as this one but centered relatively to the given rectangle r.
- #contains(*args) ⇒ Object
- #deflate(*args) ⇒ Object
- #deflate!(*args) ⇒ Object
-
#eql?(other) ⇒ Boolean
Compare areas.
-
#get_bottom ⇒ Integer
(also: #bottom)
Gets the bottom point of the rectangle.
-
#get_bottom_left ⇒ Wx::Point
(also: #bottom_left)
Gets the position of the bottom left corner.
-
#get_bottom_right ⇒ Wx::Point
(also: #bottom_right)
Gets the position of the bottom right corner.
-
#get_height ⇒ Integer
(also: #height)
Gets the height member.
-
#get_left ⇒ Integer
(also: #left)
Gets the left point of the rectangle (the same as #get_x).
-
#get_position ⇒ Wx::Point
(also: #position)
Gets the position.
-
#get_right ⇒ Integer
(also: #right)
Gets the right point of the rectangle.
-
#get_size ⇒ Wx::Size
(also: #size)
Gets the size.
-
#get_top ⇒ Integer
(also: #top)
Gets the top point of the rectangle (the same as #get_y).
-
#get_top_left ⇒ Wx::Point
(also: #top_left)
Gets the position of the top left corner of the rectangle, same as #get_position.
-
#get_top_right ⇒ Wx::Point
(also: #top_right)
Gets the position of the top right corner.
-
#get_width ⇒ Integer
(also: #width)
Gets the width member.
-
#get_x ⇒ Integer
(also: #x)
Gets the x member.
-
#get_y ⇒ Integer
(also: #y)
Gets the y member.
- #inflate(*args) ⇒ Object
- #inflate!(*args) ⇒ Object
-
#initialize(*args) ⇒ Rect
constructor
A new instance of Rect.
-
#intersect(rect) ⇒ Wx::Rect
Returns the overlapping portion of this rectangle and the one passed in as parameter.
-
#intersect!(rect) ⇒ self
Update this rectangle to the intersection with ‘rect’.
-
#intersects(rect) ⇒ Boolean
Returns true if this rectangle has a non-empty intersection with the rectangle rect and false otherwise.
-
#is_empty ⇒ Boolean
(also: #empty?)
Returns true if this rectangle has a width or height less than or equal to 0 and false otherwise.
- #offset(*args) ⇒ Object
- #offset!(*args) ⇒ Object
-
#set_bottom(bottom) ⇒ void
(also: #bottom=)
Set the bottom edge of the rectangle.
-
#set_bottom_left(p) ⇒ void
(also: #bottom_left=)
Set the bottom-left point of the rectangle.
-
#set_bottom_right(p) ⇒ void
(also: #bottom_right=)
Set the bottom-right point of the rectangle.
-
#set_height(height) ⇒ void
(also: #height=)
Sets the height.
-
#set_left(left) ⇒ void
(also: #left=)
Set the left side of the rectangle.
-
#set_position(pos) ⇒ void
(also: #position=)
Sets the position.
-
#set_right(right) ⇒ void
(also: #right=)
Set the right side of the rectangle.
-
#set_size(s) ⇒ void
(also: #size=)
Sets the size.
-
#set_top(top) ⇒ void
(also: #top=)
Set the top edge of the rectangle.
-
#set_top_left(p) ⇒ void
(also: #top_left=)
Set the top-left point of the rectangle.
-
#set_top_right(p) ⇒ void
(also: #top_right=)
Set the top-right point of the rectangle.
-
#set_width(width) ⇒ void
(also: #width=)
Sets the width.
-
#set_x(x) ⇒ void
(also: #x=)
Sets the x position.
-
#set_y(y) ⇒ void
(also: #y=)
Sets the y position.
-
#to_ary ⇒ Array(Integer,Integer,Integer,Integer)
Returns rect array (
[left, top, width, height]
). -
#union(rect) ⇒ Wx::Rect
Modifies the rectangle to contain the bounding box of this rectangle and the one passed in as parameter.
-
#union!(rect) ⇒ self
Update this rectangle to the union with ‘rect’.
- #| ⇒ Object
Constructor Details
Instance Method Details
#& ⇒ Object
318 |
# File 'lib/wx/doc/gdi_common.rb', line 318 alias :& :intersect |
#*(rect) ⇒ Wx::Rect
Returns the overlap of the rectangle areas. Does not check negative or zero overlap like #intersect.
326 |
# File 'lib/wx/doc/gdi_common.rb', line 326 def *(rect) end |
#+(rect) ⇒ Wx::Rect
Returns a rectangle containing the bounding box of this rectangle and the one passed in as parameter. Does not ignore empty rectangles like #union
332 |
# File 'lib/wx/doc/gdi_common.rb', line 332 def +(rect) end |
#==(other) ⇒ Boolean
Compare area values (Wx::Rect or 4-element array). Returns false if incompatible.
229 |
# File 'lib/wx/doc/gdi_common.rb', line 229 def ==(other)end |
#assign(rct) ⇒ self
Set this rectangle to the given rectangle’s position & size values
337 |
# File 'lib/wx/doc/gdi_common.rb', line 337 def assign(rct) end |
#center_in(r, dir = Wx::Orientation::BOTH) ⇒ Wx::Rect
Returns the rectangle having the same size as this one but centered relatively to the given rectangle r.
By default, rectangle is centred in both directions but if dir includes only Orientation::VERTICAL or only Orientation::HORIZONTAL, then it is only centered in this direction while the other component of its position remains unchanged.
663 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 663 def center_in(r, dir=Wx::Orientation::BOTH) end |
#centre_in(r, dir = Wx::Orientation::BOTH) ⇒ Wx::Rect
Returns the rectangle having the same size as this one but centered relatively to the given rectangle r.
By default, rectangle is centred in both directions but if dir includes only Orientation::VERTICAL or only Orientation::HORIZONTAL, then it is only centered in this direction while the other component of its position remains unchanged.
655 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 655 def centre_in(r, dir=Wx::Orientation::BOTH) end |
#contains(x, y) ⇒ Boolean #contains(pt) ⇒ Boolean #contains(rect) ⇒ Boolean
770 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 770 def contains(*args) end |
#deflate(dx, dy) ⇒ Wx::Rect #deflate(diff) ⇒ Wx::Rect #deflate(diff) ⇒ Wx::Rect
684 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 684 def deflate(*args) end |
#deflate!(dx, dy) ⇒ self #deflate!(diff) ⇒ self #deflate!(diff) ⇒ self
262 |
# File 'lib/wx/doc/gdi_common.rb', line 262 def deflate!(*args) end |
#eql?(other) ⇒ Boolean
Compare areas.
234 |
# File 'lib/wx/doc/gdi_common.rb', line 234 def eql?(other)end |
#get_bottom ⇒ Integer Also known as: bottom
Gets the bottom point of the rectangle.
774 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 774 def get_bottom; end |
#get_bottom_left ⇒ Wx::Point Also known as: bottom_left
Gets the position of the bottom left corner.
779 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 779 def get_bottom_left; end |
#get_bottom_right ⇒ Wx::Point Also known as: bottom_right
Gets the position of the bottom right corner.
784 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 784 def get_bottom_right; end |
#get_height ⇒ Integer Also known as: height
Gets the height member.
789 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 789 def get_height; end |
#get_left ⇒ Integer Also known as: left
Gets the left point of the rectangle (the same as #get_x).
794 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 794 def get_left; end |
#get_position ⇒ Wx::Point Also known as: position
Gets the position.
799 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 799 def get_position; end |
#get_right ⇒ Integer Also known as: right
Gets the right point of the rectangle.
804 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 804 def get_right; end |
#get_size ⇒ Wx::Size Also known as: size
Gets the size.
812 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 812 def get_size; end |
#get_top ⇒ Integer Also known as: top
Gets the top point of the rectangle (the same as #get_y).
817 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 817 def get_top; end |
#get_top_left ⇒ Wx::Point Also known as: top_left
Gets the position of the top left corner of the rectangle, same as #get_position.
822 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 822 def get_top_left; end |
#get_top_right ⇒ Wx::Point Also known as: top_right
Gets the position of the top right corner.
827 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 827 def get_top_right; end |
#get_width ⇒ Integer Also known as: width
Gets the width member.
832 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 832 def get_width; end |
#get_x ⇒ Integer Also known as: x
Gets the x member.
837 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 837 def get_x; end |
#get_y ⇒ Integer Also known as: y
Gets the y member.
842 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 842 def get_y; end |
#inflate(dx, dy) ⇒ Wx::Rect #inflate(diff) ⇒ Wx::Rect #inflate(diff) ⇒ Wx::Rect
720 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 720 def inflate(*args) end |
#inflate!(dx, dy) ⇒ self #inflate!(diff) ⇒ self #inflate!(diff) ⇒ self
290 |
# File 'lib/wx/doc/gdi_common.rb', line 290 def inflate!(*args) end |
#intersect(rect) ⇒ Wx::Rect
Returns the overlapping portion of this rectangle and the one passed in as parameter.
848 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 848 def intersect(rect) end |
#intersect!(rect) ⇒ self
Update this rectangle to the intersection with ‘rect’
244 |
# File 'lib/wx/doc/gdi_common.rb', line 244 def intersect!(rect) end |
#intersects(rect) ⇒ Boolean
Returns true if this rectangle has a non-empty intersection with the rectangle rect and false otherwise.
853 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 853 def intersects(rect) end |
#is_empty ⇒ Boolean Also known as: empty?
Returns true if this rectangle has a width or height less than or equal to 0 and false otherwise.
857 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 857 def is_empty; end |
#offset(dx, dy) ⇒ Wx::Rect #offset(pt) ⇒ Wx::Rect
303 |
# File 'lib/wx/doc/gdi_common.rb', line 303 def offset(*args) end |
#offset!(dx, dy) ⇒ self #offset!(pt) ⇒ self
316 |
# File 'lib/wx/doc/gdi_common.rb', line 316 def offset!(*args) end |
#set_bottom(bottom) ⇒ void Also known as: bottom=
This method returns an undefined value.
Set the bottom edge of the rectangle.
Notice that this doesn’t affect #get_top return value but changes the rectangle height to set its bottom side to the given position.
928 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 928 def set_bottom(bottom) end |
#set_bottom_left(p) ⇒ void Also known as: bottom_left=
This method returns an undefined value.
Set the bottom-left point of the rectangle.
952 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 952 def set_bottom_left(p) end |
#set_bottom_right(p) ⇒ void Also known as: bottom_right=
This method returns an undefined value.
Set the bottom-right point of the rectangle.
940 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 940 def set_bottom_right(p) end |
#set_height(height) ⇒ void Also known as: height=
This method returns an undefined value.
Sets the height.
863 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 863 def set_height(height) end |
#set_left(left) ⇒ void Also known as: left=
This method returns an undefined value.
Set the left side of the rectangle.
Notice that because the rectangle stores its left side and width, calling #set_left changes the right side position too but does preserve the width.
904 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 904 def set_left(left) end |
#set_position(pos) ⇒ void Also known as: position=
This method returns an undefined value.
Sets the position.
869 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 869 def set_position(pos) end |
#set_right(right) ⇒ void Also known as: right=
This method returns an undefined value.
Set the right side of the rectangle.
Notice that this doesn’t affect #get_left return value but changes the rectangle width to set its right side to the given position.
912 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 912 def set_right(right) end |
#set_size(s) ⇒ void Also known as: size=
This method returns an undefined value.
Sets the size.
878 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 878 def set_size(s) end |
#set_top(top) ⇒ void Also known as: top=
This method returns an undefined value.
Set the top edge of the rectangle.
Notice that because the rectangle stores its top side and height, calling #set_top changes the bottom side position too but does preserve the height.
920 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 920 def set_top(top) end |
#set_top_left(p) ⇒ void Also known as: top_left=
This method returns an undefined value.
Set the top-left point of the rectangle.
934 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 934 def set_top_left(p) end |
#set_top_right(p) ⇒ void Also known as: top_right=
This method returns an undefined value.
Set the top-right point of the rectangle.
946 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 946 def set_top_right(p) end |
#set_width(width) ⇒ void Also known as: width=
This method returns an undefined value.
Sets the width.
884 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 884 def set_width(width) end |
#set_x(x) ⇒ void Also known as: x=
This method returns an undefined value.
Sets the x position.
890 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 890 def set_x(x) end |
#set_y(y) ⇒ void Also known as: y=
This method returns an undefined value.
Sets the y position.
896 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 896 def set_y(y) end |
#to_ary ⇒ Array(Integer,Integer,Integer,Integer)
Returns rect array ([left, top, width, height]
)
224 |
# File 'lib/wx/doc/gdi_common.rb', line 224 def to_ary; end |
#union(rect) ⇒ Wx::Rect
Modifies the rectangle to contain the bounding box of this rectangle and the one passed in as parameter.
725 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 725 def union(rect) end |
#union!(rect) ⇒ self
Update this rectangle to the union with ‘rect’
239 |
# File 'lib/wx/doc/gdi_common.rb', line 239 def union!(rect) end |
#| ⇒ Object
320 |
# File 'lib/wx/doc/gdi_common.rb', line 320 alias :| :union |