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