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
This commit is contained in:
Vadim Zeitlin
2003-08-13 14:09:45 +00:00
parent 339963e0d0
commit 5da0803c15
19 changed files with 29 additions and 87 deletions

View File

@@ -11,6 +11,7 @@ INCOMPATIBLE CHANGES SINCE 2.4.x
- also, OnExit() is not called if OnInit() fails - also, OnExit() is not called if OnInit() fails
- wxTheApp can't be assigned to any longer, use wxApp::SetInstance() instead - wxTheApp can't be assigned to any longer, use wxApp::SetInstance() instead
- wxFileType::GetIcon() returns wxIconLocation, not wxIcon - wxFileType::GetIcon() returns wxIconLocation, not wxIcon
- wxWindow::Clear() is now called ClearBackground()
DEPRECATED METHODS SINCE 2.4.x DEPRECATED METHODS SINCE 2.4.x

View File

@@ -245,9 +245,9 @@ or {\tt wxBOTH}.}
\helpref{wxWindow::CentreOnParent}{wxwindowcenteronparent} \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 Clears the window by filling it with the current background colour. Does not
cause an erase background event to be generated. cause an erase background event to be generated.

View File

@@ -98,8 +98,6 @@ public:
virtual void WarpPointer(int x_pos, int y_pos) ; virtual void WarpPointer(int x_pos, int y_pos) ;
// Send the window a refresh event // Send the window a refresh event
virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL);
// Clear the window
virtual void Clear();
// Set/get the window's font // Set/get the window's font
virtual bool SetFont(const wxFont& f); virtual bool SetFont(const wxFont& f);
// inline virtual wxFont& GetFont() const; // inline virtual wxFont& GetFont() const;

View File

@@ -212,8 +212,6 @@ protected: \
void assign(const_iterator first, const_iterator last); \ void assign(const_iterator first, const_iterator last); \
void assign(size_type n, const_reference v); \ void assign(size_type n, const_reference v); \
size_type capacity() const { return m_nSize; } \ size_type capacity() const { return m_nSize; } \
void clear() { Clear(); } \
bool empty() const { return IsEmpty(); } \
iterator erase(iterator first, iterator last) \ iterator erase(iterator first, iterator last) \
{ \ { \
size_type idx = first - begin(); \ size_type idx = first - begin(); \
@@ -230,17 +228,24 @@ protected: \
return begin() + idx; \ return begin() + idx; \
} \ } \
void insert(iterator it, const_iterator first, const_iterator last);\ 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 pop_back() { RemoveAt(size() - 1); } \
void push_back(const value_type& v) { Add(v); } \ void push_back(const value_type& v) { Add(v); } \
void reserve(size_type n) { if(n > m_nSize) Realloc(n); } \ void reserve(size_type n) { if(n > m_nSize) Realloc(n); } \
void resize(size_type n, value_type v = value_type()); \ void resize(size_type n, value_type v = value_type()); \
size_type size() const { return GetCount(); } \
\ \
iterator begin() { return m_pItems; } \ iterator begin() { return m_pItems; } \
iterator end() { return m_pItems + m_nCount; } \ iterator end() { return m_pItems + m_nCount; } \
const_iterator begin() const { return m_pItems; } \ const_iterator begin() const { return m_pItems; } \
const_iterator end() const { return m_pItems + m_nCount; } \ 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: \ private: \
void Grow(size_t nIncrement = 0); \ void Grow(size_t nIncrement = 0); \
bool Realloc(size_t nSize); \ bool Realloc(size_t nSize); \
@@ -446,8 +451,6 @@ public: \
iterator begin() { return (iterator)base::begin(); } \ iterator begin() { return (iterator)base::begin(); } \
const_iterator begin() const { return (const_iterator)base::begin(); }\ const_iterator begin() const { return (const_iterator)base::begin(); }\
size_type capacity() const { return base::capacity(); } \ size_type capacity() const { return base::capacity(); } \
void clear() { base::clear(); } \
bool empty() const { return base::empty(); } \
iterator end() { return (iterator)base::end(); } \ iterator end() { return (iterator)base::end(); } \
const_iterator end() const { return (const_iterator)base::end(); } \ const_iterator end() const { return (const_iterator)base::end(); } \
iterator erase(iterator first, iterator last) \ iterator erase(iterator first, iterator last) \
@@ -463,7 +466,6 @@ public: \
void insert(iterator it, const_iterator first, const_iterator last) \ void insert(iterator it, const_iterator first, const_iterator last) \
{ base::insert((biterator)it, (bconst_iterator)first, \ { base::insert((biterator)it, (bconst_iterator)first, \
(bconst_iterator)last); } \ (bconst_iterator)last); } \
size_type max_size() const { return base::max_size(); } \
void pop_back() { base::pop_back(); } \ void pop_back() { base::pop_back(); } \
void push_back(const_reference v) \ void push_back(const_reference v) \
{ base::push_back((bconst_reference)v); } \ { base::push_back((bconst_reference)v); } \
@@ -473,7 +475,6 @@ public: \
const_reverse_iterator rend() const; \ const_reverse_iterator rend() const; \
void reserve(size_type n) { base::reserve(n); }; \ void reserve(size_type n) { base::reserve(n); }; \
void resize(size_type n, value_type v = value_type()); \ 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; } #define _WX_PTROP pointer operator->() const { return m_ptr; }

View File

@@ -84,7 +84,6 @@ public:
virtual void Refresh( bool eraseBackground = TRUE, virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL ); const wxRect *rect = (const wxRect *) NULL );
virtual void Clear();
virtual bool SetCursor( const wxCursor &cursor ); virtual bool SetCursor( const wxCursor &cursor );
virtual bool SetFont(const wxFont& font) virtual bool SetFont(const wxFont& font)

View File

@@ -66,7 +66,6 @@ public:
virtual void Refresh( bool eraseBackground = TRUE, virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL ); const wxRect *rect = (const wxRect *) NULL );
virtual void Clear();
virtual bool SetBackgroundColour( const wxColour &colour ); virtual bool SetBackgroundColour( const wxColour &colour );
virtual bool SetForegroundColour( const wxColour &colour ); virtual bool SetForegroundColour( const wxColour &colour );

View File

@@ -95,7 +95,6 @@ public:
virtual void Refresh( bool eraseBackground = TRUE, virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL ); const wxRect *rect = (const wxRect *) NULL );
virtual void Update(); virtual void Update();
virtual void Clear();
virtual void Freeze(); virtual void Freeze();
virtual void Thaw(); virtual void Thaw();

View File

@@ -103,7 +103,6 @@ public:
virtual void Refresh( bool bEraseBackground = TRUE virtual void Refresh( bool bEraseBackground = TRUE
,const wxRect* pRect = (const wxRect *)NULL ,const wxRect* pRect = (const wxRect *)NULL
); );
virtual void Clear(void);
virtual void Freeze(void); virtual void Freeze(void);
virtual void Update(void); virtual void Update(void);
virtual void Thaw(void); virtual void Thaw(void);

View File

@@ -583,8 +583,8 @@ public:
// repaint all invalid areas of the window immediately // repaint all invalid areas of the window immediately
virtual void Update() { } virtual void Update() { }
// clear the window entirely // clear the window background
virtual void Clear() = 0; virtual void ClearBackground();
// freeze the window: don't redraw it until it is thawed // freeze the window: don't redraw it until it is thawed
virtual void Freeze() { } virtual void Freeze() { }

View File

@@ -64,8 +64,6 @@ public:
const wxRect *rect = (const wxRect *) NULL ); const wxRect *rect = (const wxRect *) NULL );
virtual void Update(); virtual void Update();
virtual void Clear();
virtual bool SetBackgroundColour( const wxColour &colour ); virtual bool SetBackgroundColour( const wxColour &colour );
virtual bool SetForegroundColour( const wxColour &colour ); virtual bool SetForegroundColour( const wxColour &colour );

View File

@@ -531,11 +531,6 @@ bool wxWindow::SetFont(const wxFont& font)
return TRUE; return TRUE;
} }
void wxWindow::Clear()
{
// TODO
}
static int CocoaRaiseWindowCompareFunction(id first, id second, void *target) static int CocoaRaiseWindowCompareFunction(id first, id second, void *target)
{ {
// first should be ordered higher // first should be ordered higher

View File

@@ -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; 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 // find child window by id or name
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -1351,14 +1351,6 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
event.Skip(); event.Skip();
} }
void wxWindowMac::Clear()
{
wxClientDC dc(this);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(brush);
dc.Clear();
}
// Setup background and foreground colours correctly // Setup background and foreground colours correctly
void wxWindowMac::SetupColours() void wxWindowMac::SetupColours()
{ {

View File

@@ -1351,14 +1351,6 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
event.Skip(); event.Skip();
} }
void wxWindowMac::Clear()
{
wxClientDC dc(this);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(brush);
dc.Clear();
}
// Setup background and foreground colours correctly // Setup background and foreground colours correctly
void wxWindowMac::SetupColours() void wxWindowMac::SetupColours()
{ {

View File

@@ -1577,14 +1577,6 @@ void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent); 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() void wxWindow::DoPaint()
{ {
//TODO : make a temporary gc so we can do the XCopyArea below //TODO : make a temporary gc so we can do the XCopyArea below

View File

@@ -49,19 +49,13 @@ WX_DECLARE_HASH_MAP( long,
wxTimerMap wxTimerList; wxTimerMap wxTimerList;
void WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); void WINAPI wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// macros // macros
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __WIN32__ // should probably be in wx/msw/missing.h
#define _EXPORT
#else
#define _EXPORT _export
#endif
// should probably be in wx/msw/private.h
#ifdef __WXMICROWIN__ #ifdef __WXMICROWIN__
#define MakeProcInstance(proc, hinst) proc #define MakeProcInstance(proc, hinst) proc
#endif #endif
@@ -149,7 +143,7 @@ void wxProcessTimer(wxTimer& timer)
timer.Notify(); 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); 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") ); wxASSERT_MSG( node != wxTimerList.end(), wxT("bogus timer id in wxTimerProc") );
wxProcessTimer(*(node->second)); wxProcessTimer(*(node->second));
// return 0;
} }
#endif // wxUSE_TIMER #endif // wxUSE_TIMER

View File

@@ -1297,14 +1297,6 @@ bool wxWindowMSW::Reparent(wxWindowBase *parent)
return TRUE; 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) static inline void SendSetRedraw(HWND hwnd, bool on)
{ {
#ifndef __WXMICROWIN__ #ifndef __WXMICROWIN__

View File

@@ -1385,17 +1385,6 @@ bool wxWindowOS2::Reparent(
return TRUE; return TRUE;
} // end of wxWindowOS2::Reparent } // 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() void wxWindowOS2::Update()
{ {
::WinUpdateWindow(GetHwnd()); ::WinUpdateWindow(GetHwnd());

View File

@@ -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() void wxWindowX11::SendEraseEvents()
{ {
if (m_clearRegion.IsEmpty()) return; if (m_clearRegion.IsEmpty()) return;