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.
-
#make_centered_in(r, dir = Wx::Orientation::BOTH) ⇒ void
Center this rectangle inside the given rectangle r.
- #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
319 |
# File 'lib/wx/doc/gdi_common.rb', line 319 alias :& :intersect |
#*(rect) ⇒ Wx::Rect
Returns the overlap of the rectangle areas. Does not check negative or zero overlap like #intersect.
327 |
# File 'lib/wx/doc/gdi_common.rb', line 327 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
333 |
# File 'lib/wx/doc/gdi_common.rb', line 333 def +(rect) end |
#==(other) ⇒ Boolean
Compare area values (Wx::Rect or 4-element array). Returns false if incompatible.
230 |
# File 'lib/wx/doc/gdi_common.rb', line 230 def ==(other)end |
#assign(rct) ⇒ self
Set this rectangle to the given rectangle’s position & size values
338 |
# File 'lib/wx/doc/gdi_common.rb', line 338 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.
677 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 677 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.
668 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 668 def centre_in(r, dir=Wx::Orientation::BOTH) end |
#contains(x, y) ⇒ Boolean #contains(pt) ⇒ Boolean #contains(rect) ⇒ Boolean
784 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 784 def contains(*args) end |
#deflate(dx, dy) ⇒ Wx::Rect #deflate(diff) ⇒ Wx::Rect #deflate(diff) ⇒ Wx::Rect
698 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 698 def deflate(*args) end |
#deflate!(dx, dy) ⇒ self #deflate!(diff) ⇒ self #deflate!(diff) ⇒ self
263 |
# File 'lib/wx/doc/gdi_common.rb', line 263 def deflate!(*args) end |
#eql?(other) ⇒ Boolean
Compare areas.
235 |
# File 'lib/wx/doc/gdi_common.rb', line 235 def eql?(other)end |
#get_bottom ⇒ Integer Also known as: bottom
Gets the bottom point of the rectangle.
788 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 788 def get_bottom; end |
#get_bottom_left ⇒ Wx::Point Also known as: bottom_left
Gets the position of the bottom left corner.
793 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 793 def get_bottom_left; end |
#get_bottom_right ⇒ Wx::Point Also known as: bottom_right
Gets the position of the bottom right corner.
798 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 798 def get_bottom_right; end |
#get_height ⇒ Integer Also known as: height
Gets the height member.
803 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 803 def get_height; end |
#get_left ⇒ Integer Also known as: left
Gets the left point of the rectangle (the same as #get_x).
808 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 808 def get_left; end |
#get_position ⇒ Wx::Point Also known as: position
Gets the position.
813 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 813 def get_position; end |
#get_right ⇒ Integer Also known as: right
Gets the right point of the rectangle.
818 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 818 def get_right; end |
#get_size ⇒ Wx::Size Also known as: size
Gets the size.
826 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 826 def get_size; end |
#get_top ⇒ Integer Also known as: top
Gets the top point of the rectangle (the same as #get_y).
831 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 831 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.
836 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 836 def get_top_left; end |
#get_top_right ⇒ Wx::Point Also known as: top_right
Gets the position of the top right corner.
841 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 841 def get_top_right; end |
#get_width ⇒ Integer Also known as: width
Gets the width member.
846 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 846 def get_width; end |
#get_x ⇒ Integer Also known as: x
Gets the x member.
851 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 851 def get_x; end |
#get_y ⇒ Integer Also known as: y
Gets the y member.
856 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 856 def get_y; end |
#inflate(dx, dy) ⇒ Wx::Rect #inflate(diff) ⇒ Wx::Rect #inflate(diff) ⇒ Wx::Rect
734 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 734 def inflate(*args) end |
#inflate!(dx, dy) ⇒ self #inflate!(diff) ⇒ self #inflate!(diff) ⇒ self
291 |
# File 'lib/wx/doc/gdi_common.rb', line 291 def inflate!(*args) end |
#intersect(rect) ⇒ Wx::Rect
Returns the overlapping portion of this rectangle and the one passed in as parameter.
862 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 862 def intersect(rect) end |
#intersect!(rect) ⇒ self
Update this rectangle to the intersection with ‘rect’
245 |
# File 'lib/wx/doc/gdi_common.rb', line 245 def intersect!(rect) end |
#intersects(rect) ⇒ Boolean
Returns true if this rectangle has a non-empty intersection with the rectangle rect and false otherwise.
867 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 867 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.
871 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 871 def is_empty; end |
#make_centered_in(r, dir = Wx::Orientation::BOTH) ⇒ void
This method returns an undefined value.
Center this rectangle inside 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.
881 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 881 def make_centered_in(r, dir=Wx::Orientation::BOTH) end |
#offset(dx, dy) ⇒ Wx::Rect #offset(pt) ⇒ Wx::Rect
304 |
# File 'lib/wx/doc/gdi_common.rb', line 304 def offset(*args) end |
#offset!(dx, dy) ⇒ self #offset!(pt) ⇒ self
317 |
# File 'lib/wx/doc/gdi_common.rb', line 317 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.
951 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 951 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.
975 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 975 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.
963 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 963 def set_bottom_right(p) end |
#set_height(height) ⇒ void Also known as: height=
This method returns an undefined value.
Sets the height.
886 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 886 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.
927 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 927 def set_left(left) end |
#set_position(pos) ⇒ void Also known as: position=
This method returns an undefined value.
Sets the position.
892 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 892 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.
935 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 935 def set_right(right) end |
#set_size(s) ⇒ void Also known as: size=
This method returns an undefined value.
Sets the size.
901 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 901 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.
943 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 943 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.
957 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 957 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.
969 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 969 def set_top_right(p) end |
#set_width(width) ⇒ void Also known as: width=
This method returns an undefined value.
Sets the width.
907 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 907 def set_width(width) end |
#set_x(x) ⇒ void Also known as: x=
This method returns an undefined value.
Sets the x position.
913 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 913 def set_x(x) end |
#set_y(y) ⇒ void Also known as: y=
This method returns an undefined value.
Sets the y position.
919 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 919 def set_y(y) end |
#to_ary ⇒ Array(Integer,Integer,Integer,Integer)
Returns rect array ([left, top, width, height]
)
225 |
# File 'lib/wx/doc/gdi_common.rb', line 225 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.
739 |
# File 'lib/wx/doc/gen/gdi_common.rb', line 739 def union(rect) end |
#union!(rect) ⇒ self
Update this rectangle to the union with ‘rect’
240 |
# File 'lib/wx/doc/gdi_common.rb', line 240 def union!(rect) end |
#| ⇒ Object
321 |
# File 'lib/wx/doc/gdi_common.rb', line 321 alias :| :union |