added wxListCtrl::DeleteAllColumns()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1099 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-12-02 20:06:14 +00:00
parent a724d7892d
commit bd8289c14d
2 changed files with 175 additions and 165 deletions

View File

@@ -582,6 +582,7 @@ class wxListCtrl: public wxControl
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
bool DeleteItem( long item );
bool DeleteAllItems(void) ;
void DeleteAllColumns(void) ;
bool DeleteColumn( int col );
// wxText& Edit(long item) ; // not supported in wxGLC
bool EnsureVisible( long item );

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -552,15 +552,15 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
{
int y = 0;
m_owner->DrawImage( item->GetImage(), dc, x, item->GetY() );
m_owner->GetImageSize( item->GetImage(), x, y );
x += item->GetX() + 5;
m_owner->GetImageSize( item->GetImage(), x, y );
x += item->GetX() + 5;
}
if (item->HasText())
{
item->GetText( s );
if (hilight)
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
else
if (hilight)
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
else
dc->SetTextForeground( *item->GetColour() );
dc->DrawText( s, x, item->GetY() );
}
@@ -582,9 +582,9 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
{
wxString s;
item->GetText( s );
if (hilight)
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
else
if (hilight)
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
else
dc->SetTextForeground( * item->GetColour() );
dc->DrawText( s, m_bound_label.x, m_bound_label.y );
}
@@ -1220,8 +1220,8 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
m_usedKeys = FALSE;
if ((line == m_current) &&
(hitResult == wxLIST_HITTEST_ONITEMLABEL) &&
// (m_mode & wxLC_ICON) &&
(m_mode & wxLC_EDIT_LABELS) )
// (m_mode & wxLC_ICON) &&
(m_mode & wxLC_EDIT_LABELS) )
{
m_renameTimer->Start( 100, TRUE );
}
@@ -1256,8 +1256,8 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
while (node)
{
wxListLineData *test_line = (wxListLineData*)node->Data();
numOfCurrent++;
if (test_line == oldCurrent) break;
numOfCurrent++;
if (test_line == oldCurrent) break;
node = node->Next();
}
int numOfLine = -1;
@@ -1265,21 +1265,21 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
while (node)
{
wxListLineData *test_line = (wxListLineData*)node->Data();
numOfLine++;
if (test_line == line) break;
numOfLine++;
if (test_line == line) break;
node = node->Next();
}
if (numOfLine < numOfCurrent)
{ int i = numOfLine; numOfLine = numOfCurrent; numOfCurrent = i; }
wxNode *node = m_lines.Nth( numOfCurrent );
for (int i = 0; i <= numOfLine-numOfCurrent; i++)
{
wxListLineData *test_line= (wxListLineData*)node->Data();
test_line->Hilight(TRUE);
RefreshLine( test_line );
node = node->Next();
}
if (numOfLine < numOfCurrent)
{ int i = numOfLine; numOfLine = numOfCurrent; numOfCurrent = i; }
wxNode *node = m_lines.Nth( numOfCurrent );
for (int i = 0; i <= numOfLine-numOfCurrent; i++)
{
wxListLineData *test_line= (wxListLineData*)node->Data();
test_line->Hilight(TRUE);
RefreshLine( test_line );
node = node->Next();
}
}
else
{
@@ -1450,8 +1450,8 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
wxNode *node = m_lines.Member( m_current )->Next();
if (node) m_current = (wxListLineData*)node->Data();
MoveToFocus();
RefreshLine( oldCurrent );
RefreshLine( m_current );
RefreshLine( oldCurrent );
RefreshLine( m_current );
UnfocusLine( oldCurrent );
FocusLine( m_current );
}
@@ -1716,7 +1716,7 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask )
if (m_mode & wxLC_SINGLE_SEL)
{
UnfocusLine( m_current );
m_current = line;
m_current = line;
FocusLine( m_current );
oldCurrent->Hilight( FALSE );
RefreshLine( m_current );
@@ -1937,13 +1937,13 @@ void wxListMainWindow::CalculatePositions( void )
maxWidth = 0;
}
node = node->Next();
if (!node) entireWidth += maxWidth;
if ((tries == 0) && (entireWidth > clientWidth))
{
clientHeight -= 14; // scrollbar height
break;
}
if (!node) tries = 1;
if (!node) entireWidth += maxWidth;
if ((tries == 0) && (entireWidth > clientWidth))
{
clientHeight -= 14; // scrollbar height
break;
}
if (!node) tries = 1;
}
}
SetScrollbars( m_xScroll, m_yScroll, (entireWidth+15) / m_xScroll, 0, 0, 0, TRUE );
@@ -1997,6 +1997,9 @@ void wxListMainWindow::DeleteItem( long index )
void wxListMainWindow::DeleteColumn( int col )
{
wxCHECK_RET( col < m_columns.GetCount(),
"attempting to delete inexistent column in wxListView" );
m_dirty = TRUE;
wxNode *node = m_columns.Nth( col );
if (node) m_columns.DeleteNode( node );
@@ -2273,7 +2276,7 @@ void wxListCtrl::SetSingleStyle( long style, bool add )
if (add)
{
if (style & wxLC_MASK_TYPE) flag = flag & ~wxLC_MASK_TYPE;
if (style & wxLC_MASK_TYPE) flag = flag & ~wxLC_MASK_TYPE;
if (style & wxLC_MASK_ALIGN) flag = flag & ~wxLC_MASK_ALIGN;
if (style & wxLC_MASK_SORT) flag = flag & ~wxLC_MASK_SORT;
}
@@ -2543,6 +2546,12 @@ bool wxListCtrl::DeleteAllItems(void)
return TRUE;
}
void wxListCtrl::DeleteAllColumns()
{
for ( size_t n = 0; n < m_mainWin->m_columns.GetCount(); n++ )
DeleteColumn(n);
}
bool wxListCtrl::DeleteColumn( int col )
{
m_mainWin->DeleteColumn( col );