From: Vadim Zeitlin Date: Wed, 13 Aug 2003 14:09:45 +0000 (+0000) Subject: renamed wxWindow::Clear() to ClearBackground() (fixes bug 783576) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5da0803c1534db8a410cdff616921175a8ddda77 renamed wxWindow::Clear() to ClearBackground() (fixes bug 783576) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 9373a54ad2..ef06308310 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -11,6 +11,7 @@ INCOMPATIBLE CHANGES SINCE 2.4.x - also, OnExit() is not called if OnInit() fails - wxTheApp can't be assigned to any longer, use wxApp::SetInstance() instead - wxFileType::GetIcon() returns wxIconLocation, not wxIcon +- wxWindow::Clear() is now called ClearBackground() DEPRECATED METHODS SINCE 2.4.x diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex index fa07aa81b9..1cb3132425 100644 --- a/docs/latex/wx/window.tex +++ b/docs/latex/wx/window.tex @@ -245,9 +245,9 @@ or {\tt wxBOTH}.} \helpref{wxWindow::CentreOnParent}{wxwindowcenteronparent} -\membersection{wxWindow::Clear}\label{wxwindowclear} +\membersection{wxWindow::ClearBackground}\label{wxwindowclearbackground} -\func{void}{Clear}{\void} +\func{void}{ClearBackground}{\void} Clears the window by filling it with the current background colour. Does not cause an erase background event to be generated. diff --git a/include/wx/cocoa/window.h b/include/wx/cocoa/window.h index f36f37222e..ef3dcb4740 100644 --- a/include/wx/cocoa/window.h +++ b/include/wx/cocoa/window.h @@ -98,8 +98,6 @@ public: virtual void WarpPointer(int x_pos, int y_pos) ; // Send the window a refresh event virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); - // Clear the window - virtual void Clear(); // Set/get the window's font virtual bool SetFont(const wxFont& f); // inline virtual wxFont& GetFont() const; diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 26d7e06540..6c64938d80 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -212,8 +212,6 @@ protected: \ void assign(const_iterator first, const_iterator last); \ void assign(size_type n, const_reference v); \ size_type capacity() const { return m_nSize; } \ - void clear() { Clear(); } \ - bool empty() const { return IsEmpty(); } \ iterator erase(iterator first, iterator last) \ { \ size_type idx = first - begin(); \ @@ -230,17 +228,24 @@ protected: \ return begin() + idx; \ } \ void insert(iterator it, const_iterator first, const_iterator last);\ - size_type max_size() const { return INT_MAX; } \ void pop_back() { RemoveAt(size() - 1); } \ void push_back(const value_type& v) { Add(v); } \ void reserve(size_type n) { if(n > m_nSize) Realloc(n); } \ void resize(size_type n, value_type v = value_type()); \ - size_type size() const { return GetCount(); } \ \ iterator begin() { return m_pItems; } \ iterator end() { return m_pItems + m_nCount; } \ const_iterator begin() const { return m_pItems; } \ const_iterator end() const { return m_pItems + m_nCount; } \ + \ + /* the following functions may be made directly public because */ \ + /* they don't use the type of the elements at all */ \ +public: \ + void clear() { Clear(); } \ + bool empty() const { return IsEmpty(); } \ + size_type max_size() const { return INT_MAX; } \ + size_type size() const { return GetCount(); } \ + \ private: \ void Grow(size_t nIncrement = 0); \ bool Realloc(size_t nSize); \ @@ -446,8 +451,6 @@ public: \ iterator begin() { return (iterator)base::begin(); } \ const_iterator begin() const { return (const_iterator)base::begin(); }\ size_type capacity() const { return base::capacity(); } \ - void clear() { base::clear(); } \ - bool empty() const { return base::empty(); } \ iterator end() { return (iterator)base::end(); } \ const_iterator end() const { return (const_iterator)base::end(); } \ iterator erase(iterator first, iterator last) \ @@ -463,7 +466,6 @@ public: \ void insert(iterator it, const_iterator first, const_iterator last) \ { base::insert((biterator)it, (bconst_iterator)first, \ (bconst_iterator)last); } \ - size_type max_size() const { return base::max_size(); } \ void pop_back() { base::pop_back(); } \ void push_back(const_reference v) \ { base::push_back((bconst_reference)v); } \ @@ -473,7 +475,6 @@ public: \ const_reverse_iterator rend() const; \ void reserve(size_type n) { base::reserve(n); }; \ void resize(size_type n, value_type v = value_type()); \ - size_type size() const { return base::size(); } \ } #define _WX_PTROP pointer operator->() const { return m_ptr; } diff --git a/include/wx/mac/window.h b/include/wx/mac/window.h index 92f5bbb7b1..08442d3ee4 100644 --- a/include/wx/mac/window.h +++ b/include/wx/mac/window.h @@ -84,7 +84,6 @@ public: virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); - virtual void Clear(); virtual bool SetCursor( const wxCursor &cursor ); virtual bool SetFont(const wxFont& font) diff --git a/include/wx/motif/window.h b/include/wx/motif/window.h index 500cbfe9d4..c85264e4f3 100644 --- a/include/wx/motif/window.h +++ b/include/wx/motif/window.h @@ -66,7 +66,6 @@ public: virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); - virtual void Clear(); virtual bool SetBackgroundColour( const wxColour &colour ); virtual bool SetForegroundColour( const wxColour &colour ); diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index b6a76b4544..45372805e6 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -95,7 +95,6 @@ public: virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); virtual void Update(); - virtual void Clear(); virtual void Freeze(); virtual void Thaw(); diff --git a/include/wx/os2/window.h b/include/wx/os2/window.h index 261d6562d8..8c5626dcc5 100644 --- a/include/wx/os2/window.h +++ b/include/wx/os2/window.h @@ -103,7 +103,6 @@ public: virtual void Refresh( bool bEraseBackground = TRUE ,const wxRect* pRect = (const wxRect *)NULL ); - virtual void Clear(void); virtual void Freeze(void); virtual void Update(void); virtual void Thaw(void); diff --git a/include/wx/window.h b/include/wx/window.h index e8767aae8c..c506460376 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -583,8 +583,8 @@ public: // repaint all invalid areas of the window immediately virtual void Update() { } - // clear the window entirely - virtual void Clear() = 0; + // clear the window background + virtual void ClearBackground(); // freeze the window: don't redraw it until it is thawed virtual void Freeze() { } diff --git a/include/wx/x11/window.h b/include/wx/x11/window.h index df8d37553f..ce7fe96831 100644 --- a/include/wx/x11/window.h +++ b/include/wx/x11/window.h @@ -64,8 +64,6 @@ public: const wxRect *rect = (const wxRect *) NULL ); virtual void Update(); - virtual void Clear(); - virtual bool SetBackgroundColour( const wxColour &colour ); virtual bool SetForegroundColour( const wxColour &colour ); diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index c73a1fa0ca..b255cb1212 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -531,11 +531,6 @@ bool wxWindow::SetFont(const wxFont& font) return TRUE; } -void wxWindow::Clear() -{ - // TODO -} - static int CocoaRaiseWindowCompareFunction(id first, id second, void *target) { // first should be ordered higher diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index f044c553cd..9a1a983162 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -977,6 +977,17 @@ bool wxWindowBase::IsExposed(int x, int y, int w, int h) const return m_updateRegion.Contains(x, y, w, h) != wxOutRegion; } +void wxWindowBase::ClearBackground() +{ + // wxGTK uses its own version, no need to add never used code +#ifndef __WXGTK__ + wxClientDC dc((wxWindow *)this); + wxBrush brush(GetBackgroundColour(), wxSOLID); + dc.SetBackground(brush); + dc.Clear(); +#endif // __WXGTK__ +} + // ---------------------------------------------------------------------------- // find child window by id or name // ---------------------------------------------------------------------------- diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index ddb8eebf2b..74d6c9730d 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1351,14 +1351,6 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) event.Skip(); } -void wxWindowMac::Clear() -{ - wxClientDC dc(this); - wxBrush brush(GetBackgroundColour(), wxSOLID); - dc.SetBackground(brush); - dc.Clear(); -} - // Setup background and foreground colours correctly void wxWindowMac::SetupColours() { diff --git a/src/mac/window.cpp b/src/mac/window.cpp index ddb8eebf2b..74d6c9730d 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -1351,14 +1351,6 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) event.Skip(); } -void wxWindowMac::Clear() -{ - wxClientDC dc(this); - wxBrush brush(GetBackgroundColour(), wxSOLID); - dc.SetBackground(brush); - dc.Clear(); -} - // Setup background and foreground colours correctly void wxWindowMac::SetupColours() { diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 0a70d435a5..fcb9aa4b49 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -1577,14 +1577,6 @@ void wxWindow::Refresh(bool eraseBack, const wxRect *rect) XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent); } -void wxWindow::Clear() -{ - wxClientDC dc(this); - wxBrush brush(GetBackgroundColour(), wxSOLID); - dc.SetBackground(brush); - dc.Clear(); -} - void wxWindow::DoPaint() { //TODO : make a temporary gc so we can do the XCopyArea below diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 64096f7d77..cccb8ed09f 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -49,19 +49,13 @@ WX_DECLARE_HASH_MAP( long, wxTimerMap wxTimerList; -void WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); +void WINAPI wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- -#ifdef __WIN32__ - #define _EXPORT -#else - #define _EXPORT _export -#endif - -// should probably be in wx/msw/private.h +// should probably be in wx/msw/missing.h #ifdef __WXMICROWIN__ #define MakeProcInstance(proc, hinst) proc #endif @@ -149,7 +143,7 @@ void wxProcessTimer(wxTimer& timer) timer.Notify(); } -void WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) +void WINAPI wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) { wxTimerMap::iterator node = wxTimerList.find((long)idTimer); @@ -157,8 +151,7 @@ void WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) wxASSERT_MSG( node != wxTimerList.end(), wxT("bogus timer id in wxTimerProc") ); wxProcessTimer(*(node->second)); - - // return 0; } #endif // wxUSE_TIMER + diff --git a/src/msw/window.cpp b/src/msw/window.cpp index a957b5e8c0..91c35788a7 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1297,14 +1297,6 @@ bool wxWindowMSW::Reparent(wxWindowBase *parent) return TRUE; } -void wxWindowMSW::Clear() -{ - wxClientDC dc((wxWindow *)this); - wxBrush brush(GetBackgroundColour(), wxSOLID); - dc.SetBackground(brush); - dc.Clear(); -} - static inline void SendSetRedraw(HWND hwnd, bool on) { #ifndef __WXMICROWIN__ diff --git a/src/os2/window.cpp b/src/os2/window.cpp index affeabe47e..70d2e322aa 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -1385,17 +1385,6 @@ bool wxWindowOS2::Reparent( return TRUE; } // end of wxWindowOS2::Reparent -void wxWindowOS2::Clear() -{ - wxClientDC vDc((wxWindow*)this); - wxBrush vBrush( GetBackgroundColour() - ,wxSOLID - ); - - vDc.SetBackground(vBrush); - vDc.Clear(); -} // end of wxWindowOS2::Clear - void wxWindowOS2::Update() { ::WinUpdateWindow(GetHwnd()); diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 4c8a3ce35b..5fc23f7e6b 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -1163,14 +1163,6 @@ void wxWindowX11::Update() } } -void wxWindowX11::Clear() -{ -// wxClientDC dc((wxWindow*) this); -// wxBrush brush(GetBackgroundColour(), wxSOLID); -// dc.SetBackground(brush); -// dc.Clear(); -} - void wxWindowX11::SendEraseEvents() { if (m_clearRegion.IsEmpty()) return;