Class: Wx::Point

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/wx/doc/gen/gdi_common.rb,
lib/wx/doc/gdi_common.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A Point is a useful data structure for graphics operations.

It contains integer x and y members. See RealPoint for a floating point version. Note that the width and height stored inside a Point object may be negative and that Point functions do not perform any check against negative values (this is used to e.g. store the special -1 value in DEFAULT_POSITION instance).

Category: Data Structures Predefined objects/pointers: DEFAULT_POSITION

See Also:

Instance Method Summary collapse

Constructor Details

#initializeWx::Point #initialize(x, y) ⇒ Wx::Point #initialize(pt) ⇒ Wx::Point

Returns a new instance of Point.

Overloads:

  • #initializeWx::Point

    Constructs a point.

    Initializes the internal x and y coordinates to zero.

  • #initialize(x, y) ⇒ Wx::Point

    Initializes the point object with the given x and y coordinates.

    Parameters:

    • x (Integer)
    • y (Integer)
  • #initialize(pt) ⇒ Wx::Point

    Converts the given RealPoint (with floating point coordinates) to a Wx::Point instance.

    Notice that this truncates the floating point values of pt components, if you want to round them instead you need to do it manually, e.g.

    real_point = ...
      p = Wx::Point.new(real_point.x.round, real_point.y.round)
    

    Parameters:



453
# File 'lib/wx/doc/gen/gdi_common.rb', line 453

def initialize(*args) end

Instance Method Details

#*(num) ⇒ Wx::Point

Return a new Wx::Point with the x and y values both multiplied by parameter num, which should be a Numeric

Parameters:

  • num (Numeric)

Returns:



115
# File 'lib/wx/doc/gdi_common.rb', line 115

def *(num) end

#+(arg) ⇒ Wx::Point

Return a new Wx::Point with the x and y values both increased by parameter arg. If arg is another Wx::Point (or Wx::Size or 2-element array), increase x by the other’s x (or width) and y by the other’s y (or height); if arg is a numeric value, increase both x and y by that value.

Parameters:

Returns:



131
# File 'lib/wx/doc/gdi_common.rb', line 131

def +(arg) end

#-(arg) ⇒ Wx::Point

Return a new Wx::Point with the x and y values both reduced by parameter arg. If arg is another Wx::Point (or Wx::Size or 2-element array), reduce x by the other’s x (or width) and y by the other’s y (or height); if arg is a numeric value, reduce x and y both by that value.

Parameters:

Returns:



123
# File 'lib/wx/doc/gdi_common.rb', line 123

def -(arg) end

#/(num) ⇒ Wx::Point

Return a new Wx::Point with the x and y parameters both divided by parameter num, which should be a Numeric

Parameters:

  • num (Numeric)

Returns:



109
# File 'lib/wx/doc/gdi_common.rb', line 109

def /(num) end

#<=>(other) ⇒ Boolean?

Compare point values (Wx::Point or point array). Returns -1,0 or 1 to indicate if this point is smaller, equal or greater than other (comparing xy with other.xother.y). Returns nil if incompatible.

Parameters:

Returns:

  • (Boolean, nil)


95
# File 'lib/wx/doc/gdi_common.rb', line 95

def <=>(other)end

#assign(pt) ⇒ self

Set this point to the given point’s x,y values

Parameters:

Returns:

  • (self)


145
# File 'lib/wx/doc/gdi_common.rb', line 145

def assign(pt) end

#eql?(other) ⇒ Boolean

Compare points.

Parameters:

Returns:

  • (Boolean)


100
# File 'lib/wx/doc/gdi_common.rb', line 100

def eql?(other)end

#hashObject

Returns hash for point



103
# File 'lib/wx/doc/gdi_common.rb', line 103

def hash; end

#is_fully_specifiedBoolean Also known as: fully_specified?

Returns true if neither of the point components is equal to DEFAULT_COORD.

This method is typically used before calling #set_defaults.

Returns:

  • (Boolean)


391
# File 'lib/wx/doc/gen/gdi_common.rb', line 391

def is_fully_specified; end

#set_defaults(pt) ⇒ void Also known as: defaults=

This method returns an undefined value.

Combine this object with another one replacing the uninitialized values.

It is typically used like this:

if !pos.is_fully_specified
    pos.set_defaults(get_default_position)
  end

Parameters:

See Also:



406
# File 'lib/wx/doc/gen/gdi_common.rb', line 406

def set_defaults(pt) end

#to_aryArray(Integer,Integer)

Returns point array ([x, y])

Returns:

  • (Array(Integer,Integer))

    point as array



88
# File 'lib/wx/doc/gdi_common.rb', line 88

def to_ary; end

#to_pointself

Returns self.

Returns:

  • (self)


140
# File 'lib/wx/doc/gdi_common.rb', line 140

def to_point; end

#to_real_pointWx::RealPoint Also known as: to_real

Converts point to Wx::RealPoint

Returns:

  • (Wx::RealPoint)

    Wx::RealPoint instance from point coordinates



135
# File 'lib/wx/doc/gdi_common.rb', line 135

def to_real_point; end

#xInteger

x member.

Returns:

  • (Integer)


413
# File 'lib/wx/doc/gen/gdi_common.rb', line 413

def x; end

#x=(val) ⇒ void

This method returns an undefined value.

x member.

Parameters:

  • val (Integer)


419
# File 'lib/wx/doc/gen/gdi_common.rb', line 419

def x=(val); end

#yInteger

y member.

Returns:

  • (Integer)


425
# File 'lib/wx/doc/gen/gdi_common.rb', line 425

def y; end

#y=(val) ⇒ void

This method returns an undefined value.

y member.

Parameters:

  • val (Integer)


431
# File 'lib/wx/doc/gen/gdi_common.rb', line 431

def y=(val); end