From 764a3a49068a94d1edb96f299b10c155d101c1b0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 May 1999 21:12:37 +0000 Subject: [PATCH] 1. bug fixes in wxCaret 2. wxPoint now has += and -= 3. Validate() takes "wxWindow *" (and not wxWindowBase) again git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/caret.h | 4 ++-- include/wx/gdicmn.h | 17 ++++++++++++----- include/wx/validate.h | 5 +++-- src/common/wincmn.cpp | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/wx/caret.h b/include/wx/caret.h index 6a314bc94e..1c10856e42 100644 --- a/include/wx/caret.h +++ b/include/wx/caret.h @@ -96,12 +96,12 @@ public: { if ( show ) { - if ( ++m_countVisible > 0 ) + if ( m_countVisible++ == 0 ) DoShow(); } else { - if ( --m_countVisible < 1 ) + if ( --m_countVisible == 0 ) DoHide(); } } diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 564ed2e3fe..b742531d92 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -174,6 +174,7 @@ public: // --------------------------------------------------------------------------- // Point classes: with real or integer coordinates // --------------------------------------------------------------------------- + class WXDLLEXPORT wxRealPoint { public: @@ -205,10 +206,16 @@ public: // no copy ctor or assignment operator - the defaults are ok - bool operator==(const wxPoint& pt) const { return x == pt.x && y == pt.y; } + // comparison + bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; } + bool operator!=(const wxPoint& p) const { return !(*this == p); } + + // arithmetic operations (component wise) + wxPoint operator+(const wxPoint& p) { return wxPoint(x + p.x, y + p.y); } + wxPoint operator-(const wxPoint& p) { return wxPoint(x - p.x, y - p.y); } - wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); } - wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); } + wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } + wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } }; #if WXWIN_COMPATIBILITY @@ -251,8 +258,8 @@ public: long GetBottom() const { return y + height; } long GetRight() const { return x + width; } - bool operator == (const wxRect& rect) const; - bool operator != (const wxRect& rect) const { return !(*this == rect); } + bool operator==(const wxRect& rect) const; + bool operator!=(const wxRect& rect) const { return !(*this == rect); } public: long x, y, width, height; diff --git a/include/wx/validate.h b/include/wx/validate.h index cb3c8aef9b..31cb7a014c 100644 --- a/include/wx/validate.h +++ b/include/wx/validate.h @@ -18,6 +18,7 @@ #include "wx/event.h" +class WXDLLEXPORT wxWindow; class WXDLLEXPORT wxWindowBase; /* @@ -49,7 +50,7 @@ public: // Called when the value in the window must be validated. // This function can pop up an error message. - virtual bool Validate(wxWindowBase *WXUNUSED(parent)) { return FALSE; }; + virtual bool Validate(wxWindow *WXUNUSED(parent)) { return FALSE; }; // Called to transfer data to the window virtual bool TransferToWindow() { return FALSE; } @@ -58,7 +59,7 @@ public: virtual bool TransferFromWindow() { return FALSE; }; // accessors - wxWindowBase *GetWindow() const { return m_validatorWindow; } + wxWindow *GetWindow() const { return (wxWindow *)m_validatorWindow; } void SetWindow(wxWindowBase *win) { m_validatorWindow = win; } // validators beep by default if invalid key is pressed, these functions diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 8fb0eaabde..e8999d0f1a 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -624,7 +624,7 @@ bool wxWindowBase::Validate() { wxWindowBase *child = node->GetData(); wxValidator *validator = child->GetValidator(); - if ( validator && validator->Validate(this) ) + if ( validator && validator->Validate((wxWindow *)this) ) { return FALSE; } -- 2.45.2