Add wxPoint::IsFullySpecified() and SetDefaults().

These methods do the same thing as wxSize methods with the same names and are
useful for the same reasons.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65259 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-08-11 16:03:51 +00:00
parent 01495abf87
commit 06cfc05269
2 changed files with 56 additions and 1 deletions

View File

@@ -524,6 +524,18 @@ public:
wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; }
wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; }
// check if both components are set/initialized
bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; }
// fill in the unset components with the values from the other point
void SetDefaults(const wxPoint& pt)
{
if ( x == wxDefaultCoord )
x = pt.x;
if ( y == wxDefaultCoord )
y = pt.y;
}
};