Wt::Size Class Reference

#include <size.h>

Collaboration diagram for Wt::Size:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Size (int width=0, int height=0)
int width () const
int height () const
bool isValid () const
void setWidth (int w)
void setHeight (int h)
void setSize (int w, int h)
bool operator== (const Size &other) const
 Compare two Sizes for equality.
bool operator!= (const Size &other) const
 Compare two Sizes.
bool contains (const Size &other) const
Sizeoperator+= (const Size &other)
 increment operator
Sizeoperator>> (int margin)
 add a margin (smaller rectangle)
Sizeoperator<< (int margin)
 subtract a margin (bigger rectangle)
Size operator>> (int margin) const
 add a margin (smaller rectangle)
Size operator<< (int margin) const
 subtract a margin (bigger rectangle)
Size boundedTo (const Size &other) const
SizeboundedTo (const Size &other)
Size expandedTo (const Size &other) const
SizeexpandedTo (const Size &other)

Private Attributes

int width_
int height_

Detailed Description

Definition at line 28 of file size.h.


Constructor & Destructor Documentation

Wt::Size::Size ( int  width = 0,
int  height = 0 
) [inline]

Definition at line 30 of file size.h.

Referenced by boundedTo(), expandedTo(), operator<<(), and operator>>().

00031             :width_(width), height_(height) {}


Member Function Documentation

Size& Wt::Size::boundedTo ( const Size other  )  [inline]

Definition at line 106 of file size.h.

References height_, and width_.

00106                                        {
00107         width_ = std::min(other.width_, width_);
00108         height_ = std::min(other.height_, height_);
00109         return *this;
00110     }

Size Wt::Size::boundedTo ( const Size other  )  const [inline]

Definition at line 100 of file size.h.

References height_, Size(), and width_.

Referenced by Wt::Layout::setGeometry().

00100                                             {
00101         int w = std::min(other.width_, width_);
00102         int h = std::min(other.height_, height_);
00103         return Size(w, h);
00104     }

Here is the call graph for this function:

bool Wt::Size::contains ( const Size other  )  const [inline]

Definition at line 65 of file size.h.

References height_, and width_.

Referenced by Wt::PushButton::setButtonSize(), and Wt::Layout::setGeometry().

00065                                            {
00066         return (width_ >= other.width_ && height_ >= other.height_);
00067     }

Size& Wt::Size::expandedTo ( const Size other  )  [inline]

Definition at line 118 of file size.h.

References height_, and width_.

00118                                         {
00119         width_ = std::max(other.width_, width_);
00120         height_ = std::max(other.height_, height_);
00121         return *this;
00122     }

Size Wt::Size::expandedTo ( const Size other  )  const [inline]

Definition at line 112 of file size.h.

References height_, Size(), and width_.

Referenced by Wt::Layout::setGeometry(), Wt::Widget::setMinimumSize(), and Wt::Widget::setSizeHint().

00112                                              {
00113         int w = std::max(other.width_, width_);
00114         int h = std::max(other.height_, height_);
00115         return Size(w, h);
00116     }

Here is the call graph for this function:

int Wt::Size::height (  )  const [inline]

Definition at line 35 of file size.h.

References height_.

Referenced by Wt::Rect::align(), Wt::Label::calc_size_hint(), Wt::operator<<(), Wt::preferredHeight(), Wt::Widget::resize(), Wt::RootWindow::resize(), Wt::PixmapOf< Wt::SDLSurface >::resize(), Wt::PixmapOf< Wt::SDLSurface >::scale(), Wt::PushButton::setButtonSize(), Wt::BoxLayout::setGeometry(), Wt::GridLayout::setGeometry(), Wt::CascadeLayout::setGeometry(), Wt::Rect::setSize(), and Wt::PixmapOf< Wt::SDLSurface >::smoothScale().

00035                        {
00036         return height_;
00037     };

bool Wt::Size::isValid (  )  const [inline]

Definition at line 38 of file size.h.

References height_, and width_.

00038                          {
00039         return (width_ >=0) && (height_ >= 0);
00040     }

bool Wt::Size::operator!= ( const Size other  )  const [inline]

Compare two Sizes.

Definition at line 61 of file size.h.

00061                                              {
00062         return !(*this == other);
00063     }

Size& Wt::Size::operator+= ( const Size other  )  [inline]

increment operator

Definition at line 70 of file size.h.

References height_, and width_.

00070                                         {
00071         width_ += other.width_;
00072         height_ += other.height_;
00073         return *this;
00074     }

Size Wt::Size::operator<< ( int  margin  )  const [inline]

subtract a margin (bigger rectangle)

Definition at line 96 of file size.h.

References height_, Size(), and width_.

00096                                       {
00097         return Size(width_ + 2 * margin, height_ +2 * margin);
00098     }

Here is the call graph for this function:

Size& Wt::Size::operator<< ( int  margin  )  [inline]

subtract a margin (bigger rectangle)

Definition at line 84 of file size.h.

References height_, and width_.

00084                                  {
00085         width_ += 2 * margin;
00086         height_ += 2 * margin;
00087         return *this;
00088     }

bool Wt::Size::operator== ( const Size other  )  const [inline]

Compare two Sizes for equality.

Definition at line 56 of file size.h.

References height_, and width_.

00056                                              {
00057         return (width_ == other.width_ && height_ == other.height_);
00058     }

Size Wt::Size::operator>> ( int  margin  )  const [inline]

add a margin (smaller rectangle)

Definition at line 91 of file size.h.

References height_, Size(), and width_.

00091                                       {
00092         return Size(width_ - 2 * margin, height_ -2 * margin);
00093     }

Here is the call graph for this function:

Size& Wt::Size::operator>> ( int  margin  )  [inline]

add a margin (smaller rectangle)

Definition at line 77 of file size.h.

References height_, and width_.

00077                                  {
00078         width_ -= 2 * margin;
00079         height_ -= 2 * margin;
00080         return *this;
00081     }

void Wt::Size::setHeight ( int  h  )  [inline]

Definition at line 46 of file size.h.

References height_.

Referenced by setSize().

00046                           {
00047         height_ = h;
00048     }

void Wt::Size::setSize ( int  w,
int  h 
) [inline]

Definition at line 50 of file size.h.

References setHeight(), and setWidth().

Referenced by Wt::Widget::resize().

00050                                {
00051         setWidth(w);
00052         setHeight(h);
00053     }

Here is the call graph for this function:

void Wt::Size::setWidth ( int  w  )  [inline]

Definition at line 42 of file size.h.

References width_.

Referenced by setSize().

00042                          {
00043         width_ = w;
00044     }

int Wt::Size::width (  )  const [inline]

Definition at line 32 of file size.h.

References width_.

Referenced by Wt::Rect::align(), Wt::Label::calc_size_hint(), Wt::operator<<(), Wt::preferredWidth(), Wt::Widget::resize(), Wt::RootWindow::resize(), Wt::PixmapOf< Wt::SDLSurface >::resize(), Wt::PixmapOf< Wt::SDLSurface >::scale(), Wt::PushButton::setButtonSize(), Wt::BoxLayout::setGeometry(), Wt::GridLayout::setGeometry(), Wt::CascadeLayout::setGeometry(), Wt::Rect::setSize(), and Wt::PixmapOf< Wt::SDLSurface >::smoothScale().

00032                       {
00033         return width_;
00034     };


Member Data Documentation

int Wt::Size::height_ [private]

Definition at line 126 of file size.h.

Referenced by boundedTo(), contains(), expandedTo(), height(), isValid(), operator+=(), operator<<(), operator==(), operator>>(), and setHeight().

int Wt::Size::width_ [private]

Definition at line 125 of file size.h.

Referenced by boundedTo(), contains(), expandedTo(), isValid(), operator+=(), operator<<(), operator==(), operator>>(), setWidth(), and width().


The documentation for this class was generated from the following file:

Generated Fri Jul 28 19:33:05 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.