Class: Wx::Size

Inherits:
Object
  • Object
show all
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 Size is a useful data structure for graphics operations.

It simply contains integer x and y members. Note that the width and height stored inside a Size object may be negative and that Size functions do not perform any check against negative values (this is used to e.g. store the special -1 value in DEFAULT_SIZE instance). See also #is_fully_specified and #set_defaults for utility functions regarding the special -1 value. Size is used throughout wxWidgets as well as Point which, although almost equivalent to Size, has a different meaning: Point represents a position while Size represents the size.

Category: Data Structures Predefined objects/pointers: DEFAULT_SIZE

See Also:

Instance Method Summary collapse

Constructor Details

#initializeWx::Size #initialize(width, height) ⇒ Wx::Size

Returns a new instance of Size.

Overloads:

  • #initializeWx::Size

    Initializes this size object with zero width and height.

  • #initialize(width, height) ⇒ Wx::Size

    Initializes this size object with the given width and height.

    Parameters:

    • width (Integer)
    • height (Integer)


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

def initialize(*args) end

Instance Method Details

#*(num) ⇒ Wx::Size

Return a new Wx::Size with the width and height values both multiplied by parameter num, which should be a Numeric

Parameters:

  • num (Numeric)

Returns:



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

def *(num) end

#+(arg) ⇒ Wx::Size

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

Parameters:

  • arg (Wx::Size, Array(Integer,Integer), Numeric)

Returns:



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

def +(arg) end

#-(arg) ⇒ Wx::Size

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

Parameters:

  • arg (Wx::Size, Array(Integer,Integer), Numeric)

Returns:



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

def -(arg) end

#/(num) ⇒ Wx::Size

Return a new Wx::Size with the width and height values both divided by parameter num, which should be a Numeric

Parameters:

  • num (Numeric)

Returns:



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

def /(num) end

#==(other) ⇒ Boolean

Compare size values (Wx::Size or size array). Throws exception if incompatible.

Parameters:

  • other (Wx::Size, Array(Integer,Integer))

Returns:

  • (Boolean)


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

def ==(other)end

#assign(sz) ⇒ self

Set this size to the given size’s width,height values

Parameters:

Returns:

  • (self)


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

def assign(sz) end

#dec_by(pt) ⇒ void #dec_by(size) ⇒ void #dec_by(dx, dy) ⇒ void #dec_by(d) ⇒ void

Overloads:

  • #dec_by(pt) ⇒ void

    This method returns an undefined value.

    Decreases the size in both x and y directions.

    Parameters:

    See Also:

  • #dec_by(size) ⇒ void

    This method returns an undefined value.

    Decreases the size in both x and y directions.

    Parameters:

    • size (Array(Integer, Integer), Wx::Size)

    See Also:

  • #dec_by(dx, dy) ⇒ void

    This method returns an undefined value.

    Decreases the size in both x and y directions.

    Parameters:

    • dx (Integer)
    • dy (Integer)

    See Also:

  • #dec_by(d) ⇒ void

    This method returns an undefined value.

    Decreases the size in both x and y directions.

    Parameters:

    • d (Integer)

    See Also:



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

def dec_by(*args) end

#dec_to(size) ⇒ void

This method returns an undefined value.

Decrements this object so that both of its dimensions are not greater than the corresponding dimensions of the size.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

See Also:



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

def dec_to(size) end

#dec_to_if_specified(size) ⇒ void

This method returns an undefined value.

Decrements this object to be not bigger than the given size ignoring non-specified components.

This is similar to #dec_to but doesn’t do anything for x or y component if the same component of size is not specified, i.e. set to DEFAULT_COORD.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)


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

def dec_to_if_specified(size) end

#eql?(other) ⇒ Boolean

Compare sizes.

Parameters:

Returns:

  • (Boolean)


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

def eql?(other)end

#get_heightInteger Also known as: height

Gets the height member.

Returns:

  • (Integer)


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

def get_height; end

#get_widthInteger Also known as: width

Gets the width member.

Returns:

  • (Integer)


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

def get_width; end

#get_xObject



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

alias :get_x :get_width

#get_yObject



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

alias :get_y :get_height

#inc_by(pt) ⇒ void #inc_by(size) ⇒ void #inc_by(dx, dy) ⇒ void #inc_by(d) ⇒ void

Overloads:

  • #inc_by(pt) ⇒ void

    This method returns an undefined value.

    Increases the size in both x and y directions.

    Parameters:

    See Also:

  • #inc_by(size) ⇒ void

    This method returns an undefined value.

    Increases the size in both x and y directions.

    Parameters:

    • size (Array(Integer, Integer), Wx::Size)

    See Also:

  • #inc_by(dx, dy) ⇒ void

    This method returns an undefined value.

    Increases the size in both x and y directions.

    Parameters:

    • dx (Integer)
    • dy (Integer)

    See Also:

  • #inc_by(d) ⇒ void

    This method returns an undefined value.

    Increases the size in both x and y directions.

    Parameters:

    • d (Integer)

    See Also:



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

def inc_by(*args) end

#inc_to(size) ⇒ void

This method returns an undefined value.

Increments this object so that both of its dimensions are not less than the corresponding dimensions of the size.

Parameters:

  • size (Array(Integer, Integer), Wx::Size)

See Also:



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

def inc_to(size) end

#is_fully_specifiedBoolean Also known as: fully_specified?

Returns true if neither of the size object components is equal to -1, which is used as default for the size values in wxWidgets (hence the predefined DEFAULT_SIZE has both of its components equal to -1).

This method is typically used before calling #set_defaults.

Returns:

  • (Boolean)


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

def is_fully_specified; end

#scale(xscale, yscale) ⇒ Wx::Size

Scales the dimensions of this object by the given factors.

If you want to scale both dimensions by the same factor you can also use operator*=(). A reference to this object (so that you can concatenate other operations in the same line).

Parameters:

  • xscale (Float)
  • yscale (Float)

Returns:



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

def scale(xscale, yscale) end

#set(width, height) ⇒ void

This method returns an undefined value.

Sets the width and height members.

Parameters:

  • width (Integer)
  • height (Integer)


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

def set(width, height) end

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

This method returns an undefined value.

Combine this size object with another one replacing the default (i.e. equal to -1) components of this object with those of the other.

It is typically used like this:

if !size.is_fully_specified
    size.set_defaults(get_default_size)
  end

Parameters:

  • sizeDefault (Array(Integer, Integer), Wx::Size)

See Also:



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

def set_defaults(sizeDefault) end

#set_height(height) ⇒ void Also known as: height=

This method returns an undefined value.

Sets the height.

Parameters:

  • height (Integer)


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

def set_height(height) end

#set_width(width) ⇒ void Also known as: width=

This method returns an undefined value.

Sets the width.

Parameters:

  • width (Integer)


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

def set_width(width) end

#set_xObject



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

alias :set_x :set_width

#set_yObject



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

alias :set_y :set_height

#to_aryArray(Integer,Integer)

Returns size array ([width, height])

Returns:

  • (Array(Integer,Integer))

    size as array



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

def to_ary; end

#to_sizeself

Returns self.

Returns:

  • (self)


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

def to_size; end

#xObject



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

alias :x :get_width

#x=Object



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

alias :x= :set_width

#yObject



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

alias :y :get_height

#y=Object



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

alias :y= :set_height