Refresh() didn't work as it wasn't passed to subwindows

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-08 11:19:10 +00:00
parent 3a97d2db67
commit 2f1e3c464c
3 changed files with 56 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ wxGTK:
- added wxTextCtrl::SetSelection implementation for GTK+ 2 - added wxTextCtrl::SetSelection implementation for GTK+ 2
- fixed wxTextCtrl::IsEditable() for GTK+ 2 - fixed wxTextCtrl::IsEditable() for GTK+ 2
- don't consume 100% CPU when showing a poup menu - don't consume 100% CPU when showing a poup menu
- implemented wxListCtrl::Refresh() (Norbert Berzen)
wxMac: wxMac:

View File

@@ -148,8 +148,8 @@ public:
long InsertItem( long index, int imageIndex ); long InsertItem( long index, int imageIndex );
long InsertItem( long index, const wxString& label, int imageIndex ); long InsertItem( long index, const wxString& label, int imageIndex );
long InsertColumn( long col, wxListItem& info ); long InsertColumn( long col, wxListItem& info );
long InsertColumn( long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT, long InsertColumn( long col, const wxString& heading,
int width = -1 ); int format = wxLIST_FORMAT_LEFT, int width = -1 );
bool ScrollList( int dx, int dy ); bool ScrollList( int dx, int dy );
bool SortItems( wxListCtrlCompare fn, long data ); bool SortItems( wxListCtrlCompare fn, long data );
bool Update( long item ); bool Update( long item );
@@ -168,6 +168,8 @@ public:
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );
// We have to hand down a few functions // We have to hand down a few functions
virtual void Refresh(bool eraseBackground = TRUE,
const wxRect *rect = NULL);
virtual void Freeze(); virtual void Freeze();
virtual void Thaw(); virtual void Thaw();

View File

@@ -5168,6 +5168,57 @@ void wxGenericListCtrl::RefreshItems(long itemFrom, long itemTo)
m_mainWin->RefreshLines(itemFrom, itemTo); m_mainWin->RefreshLines(itemFrom, itemTo);
} }
/*
* Generic wxListCtrl is more or less a container for two other
* windows which drawings are done upon. These are namely
* 'm_headerWin' and 'm_mainWin'.
* Here we override 'virtual wxWindow::Refresh()' to mimic the
* behaviour wxListCtrl has under wxMSW.
*/
void wxGenericListCtrl::Refresh(bool eraseBackground, const wxRect *rect)
{
if (!rect)
{
// The easy case, no rectangle specified.
if (m_headerWin)
m_headerWin->Refresh(eraseBackground);
if (m_mainWin)
m_mainWin->Refresh(eraseBackground);
}
else
{
// Refresh the header window
if (m_headerWin)
{
wxRect rectHeader = m_headerWin->GetRect();
rectHeader.Intersect(*rect);
if (rectHeader.GetWidth() && rectHeader.GetHeight())
{
int x, y;
m_headerWin->GetPosition(&x, &y);
rectHeader.Offset(-x, -y);
m_headerWin->Refresh(eraseBackground, &rectHeader);
}
}
// Refresh the main window
if (m_mainWin)
{
wxRect rectMain = m_mainWin->GetRect();
rectMain.Intersect(*rect);
if (rectMain.GetWidth() && rectMain.GetHeight())
{
int x, y;
m_mainWin->GetPosition(&x, &y);
rectMain.Offset(-x, -y);
m_mainWin->Refresh(eraseBackground, &rectMain);
}
}
}
}
void wxGenericListCtrl::Freeze() void wxGenericListCtrl::Freeze()
{ {
m_mainWin->Freeze(); m_mainWin->Freeze();