From: Julian Smart Date: Wed, 2 Jun 1999 10:34:35 +0000 (+0000) Subject: day_of_week fix to wxDate, wxRect additions X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/dcb44466c13262aad45c82f13373069dac8ba932 day_of_week fix to wxDate, wxRect additions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 5453692236..b465e7978d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,6 +1,23 @@ wxWindows 2 Change Log ---------------------- +2.1.0, b?, June 2nd 1999 +------------------------ + +wxGTK: + + +wxMSW: + + +wxMotif: + + +General: + +- Fixed day_of_week bug (Peter Stadel). +- Added Inside(), SetLeft/Right/Top/Bottom, +, += to wxRect. + 2.1.0, b4, May 9th 1999 ----------------------- diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index b742531d92..a94d0ee228 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -250,17 +250,21 @@ public: long GetHeight() const { return height; } void SetHeight(long h) { height = h; } - wxPoint GetPosition() { return wxPoint(x, y); } - wxSize GetSize() { return wxSize(width, height); } + wxPoint GetPosition() const { return wxPoint(x, y); } + wxSize GetSize() const { return wxSize(width, height); } long GetLeft() const { return x; } long GetTop() const { return y; } long GetBottom() const { return y + height; } long GetRight() const { return x + width; } + bool Inside(int, int) const; + bool operator==(const wxRect& rect) const; bool operator!=(const wxRect& rect) const { return !(*this == rect); } + wxRect operator + (const wxRect& rect) const; + const wxRect& operator += (const wxRect& rect); public: long x, y, width, height; }; diff --git a/src/common/date.cpp b/src/common/date.cpp index 04d7fdbcb9..ec7f8d549f 100644 --- a/src/common/date.cpp +++ b/src/common/date.cpp @@ -291,7 +291,11 @@ ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt) void wxDate::julian_to_wday (void) { + // Correction by Peter Stadel + day_of_week = ((julian - 2) % 7L); +/* day_of_week = (int) ((julian + 2) % 7 + 1); +*/ } void wxDate::julian_to_mdy () diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 81c83a8e70..a55bd47e58 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -88,6 +88,29 @@ bool wxRect::operator==(const wxRect& rect) const (height == rect.height)); } +const wxRect& wxRect::operator += (const wxRect& rect) +{ + *this = (*this + rect); + return ( *this ) ; +} + +wxRect wxRect::operator + (const wxRect& rect) const +{ + int x1 = min(this->x, rect.x); + int y1 = min(this->y, rect.y); + int y2 = max(y+height, rect.height+rect.y); + int x2 = max(x+width, rect.width+rect.x); + return wxRect(x1, y1, x2-x1, y2-y1); +} + +bool wxRect::Inside(int cx, int cy) const +{ + return ( (cx >= x) && (cy >= y) + && ((cy - y) < height) + && ((cx - x) < width) + ); +} + wxColourDatabase::wxColourDatabase (int type) : wxList (type) { }