Contents Up Previous Next

wxSize

A wxSize is a useful data structure for graphics operations. It simply contains integer width and height members.

wxSize is used throughout wxWidgets as well as wxPoint which, although almost equivalent to wxSize, has a different meaning: wxPoint represents a position while wxSize - the size.

wxPython note: wxPython defines aliases for the x and y members named width and height since it makes much more sense for sizes.

Derived from

None

Include files

<wx/gdicmn.h>

See also

wxPoint, wxRealPoint

Members

wxSize::wxSize
wxSize::DecBy
wxSize::DecTo
wxSize::IsFullySpecified
wxSize::GetWidth
wxSize::GetHeight
wxSize::IncBy
wxSize::IncTo
wxSize::Scale
wxSize::Set
wxSize::SetDefaults
wxSize::SetHeight
wxSize::SetWidth
Operators


wxSize::wxSize

wxSize()

wxSize(int width, int height)

Creates a size object.


wxSize::DecBy

void DecBy(const wxSize& size)

void DecBy(int dx, int dy)

void DecBy(int d)

Decreases the size in x- and y- directions

  1. By size.x and size.y for the first overload
  2. By dx and dy for the second one
  3. By d and d for the third one

See also

IncBy


wxSize::DecTo

void DecTo(const wxSize& size)

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

See also

IncTo


wxSize::IsFullySpecified

bool IsFullySpecified() const

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 wxDefaultSize has both of its components equal to -1).

This method is typically used before calling SetDefaults.


wxSize::GetWidth

int GetWidth() const

Gets the width member.


wxSize::GetHeight

int GetHeight() const

Gets the height member.


wxSize::IncBy

void IncBy(const wxSize& size)

void IncBy(int dx, int dy)

void IncBy(int d)

Increases the size in x- and y- directions

  1. By size.x and size.y for the first overload
  2. By dx and dy for the second one
  3. By d and d for the third one

See also

DecBy


wxSize::IncTo

void IncTo(const wxSize& size)

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

See also

DecTo


wxSize::Scale

wxSize& Scale(float xscale, float yscale)

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 the operator *=

Returns a reference to this object (so that you can concatenate other operations in the same line).


wxSize::Set

void Set(int width, int height)

Sets the width and height members.


wxSize::SetDefaults

void SetDefaults(const wxSize& sizeDefault)

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.IsFullySpecified() )
    {
        size.SetDefaults(GetDefaultSize());
    }
See also

IsFullySpecified


wxSize::SetHeight

void SetHeight(int height)

Sets the height.


wxSize::SetWidth

void SetWidth(int width)

Sets the width.


Operators

void operator =(const wxSize& sz)

Assignment operator.

bool operator ==(const wxSize& sz) const

bool operator !=(const wxSize& sz) const

wxSize operator +(const wxSize& sz)

wxSize operator -(const wxSize& sz)

wxSize& operator +=(const wxSize& sz)

wxSize& operator -=(const wxSize& sz)

Operators for comparison, sum and subtraction between wxSize objects.

wxSize operator /(int factor)

wxSize operator *(int factor)

wxSize& operator /=(int factor)

wxSize& operator *=(int factor)

Operators for division and multiplication between a wxSize object and an integer.