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:
parent
a724d7892d
commit
bd8289c14d
@ -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__
|
||||||
@ -410,7 +410,7 @@ void wxListLineData::SetColumnPosition( int index, int x )
|
|||||||
{
|
{
|
||||||
wxListItemData *item = (wxListItemData*)node->Data();
|
wxListItemData *item = (wxListItemData*)node->Data();
|
||||||
item->SetPosition( x, m_bound_all.y+1 );
|
item->SetPosition( x, m_bound_all.y+1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListLineData::GetSize( int &width, int &height )
|
void wxListLineData::GetSize( int &width, int &height )
|
||||||
@ -523,7 +523,7 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
|
|||||||
long dev_w = dc->LogicalToDeviceXRel( m_bound_all.width+4 );
|
long dev_w = dc->LogicalToDeviceXRel( m_bound_all.width+4 );
|
||||||
long dev_h = dc->LogicalToDeviceYRel( m_bound_all.height+4 );
|
long dev_h = dc->LogicalToDeviceYRel( m_bound_all.height+4 );
|
||||||
if (!m_owner->IsExposed( dev_x, dev_y, dev_w, dev_h ) ) return;
|
if (!m_owner->IsExposed( dev_x, dev_y, dev_w, dev_h ) ) return;
|
||||||
|
|
||||||
if (paintBG)
|
if (paintBG)
|
||||||
{
|
{
|
||||||
if (hilight)
|
if (hilight)
|
||||||
@ -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 );
|
||||||
}
|
}
|
||||||
@ -595,7 +595,7 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
|
|||||||
void wxListLineData::Hilight( bool on )
|
void wxListLineData::Hilight( bool on )
|
||||||
{
|
{
|
||||||
if (on == m_hilighted) return;
|
if (on == m_hilighted) return;
|
||||||
if (on)
|
if (on)
|
||||||
m_owner->SelectLine( this );
|
m_owner->SelectLine( this );
|
||||||
else
|
else
|
||||||
m_owner->DeselectLine( this );
|
m_owner->DeselectLine( this );
|
||||||
@ -605,7 +605,7 @@ void wxListLineData::Hilight( bool on )
|
|||||||
void wxListLineData::ReverseHilight( void )
|
void wxListLineData::ReverseHilight( void )
|
||||||
{
|
{
|
||||||
m_hilighted = !m_hilighted;
|
m_hilighted = !m_hilighted;
|
||||||
if (m_hilighted)
|
if (m_hilighted)
|
||||||
m_owner->SelectLine( this );
|
m_owner->SelectLine( this );
|
||||||
else
|
else
|
||||||
m_owner->DeselectLine( this );
|
m_owner->DeselectLine( this );
|
||||||
@ -673,7 +673,7 @@ wxListHeaderWindow::wxListHeaderWindow( void )
|
|||||||
m_isDraging = FALSE;
|
m_isDraging = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListHeaderWindow::wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
|
wxListHeaderWindow::wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxString &name ) :
|
long style, const wxString &name ) :
|
||||||
wxWindow( win, id, pos, size, style, name )
|
wxWindow( win, id, pos, size, style, name )
|
||||||
@ -694,11 +694,11 @@ void wxListHeaderWindow::DoDrawRect( wxPaintDC *dc, int x, int y, int w, int h )
|
|||||||
dc->SetPen( *wxBLACK_PEN );
|
dc->SetPen( *wxBLACK_PEN );
|
||||||
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
|
dc->DrawLine( x+w-m_corner+1, y, x+w, y+h ); // right (outer)
|
||||||
dc->DrawRectangle( x, y+h, w, 1 ); // bottom (outer)
|
dc->DrawRectangle( x, y+h, w, 1 ); // bottom (outer)
|
||||||
|
|
||||||
dc->SetPen( *wxMEDIUM_GREY_PEN );
|
dc->SetPen( *wxMEDIUM_GREY_PEN );
|
||||||
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
|
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
|
||||||
dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
|
dc->DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
|
||||||
|
|
||||||
dc->SetPen( *wxWHITE_PEN );
|
dc->SetPen( *wxWHITE_PEN );
|
||||||
dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer)
|
dc->DrawRectangle( x, y, w-m_corner+1, 1 ); // top (outer)
|
||||||
// dc->DrawRectangle( x, y+1, w-m_corner, 1 ); // top (inner)
|
// dc->DrawRectangle( x, y+1, w-m_corner, 1 ); // top (inner)
|
||||||
@ -710,9 +710,9 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
|
|
||||||
dc.BeginDrawing();
|
dc.BeginDrawing();
|
||||||
|
|
||||||
dc.SetFont( *GetFont() );
|
dc.SetFont( *GetFont() );
|
||||||
|
|
||||||
int w = 0;
|
int w = 0;
|
||||||
@ -734,14 +734,14 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
int cw = item.m_width-2;
|
int cw = item.m_width-2;
|
||||||
if ((i+1 == numColumns) || (x+item.m_width > w-5)) cw = w-x-1;
|
if ((i+1 == numColumns) || (x+item.m_width > w-5)) cw = w-x-1;
|
||||||
dc.SetPen( *wxWHITE_PEN );
|
dc.SetPen( *wxWHITE_PEN );
|
||||||
|
|
||||||
DoDrawRect( &dc, x, y, cw, h-2 );
|
DoDrawRect( &dc, x, y, cw, h-2 );
|
||||||
dc.SetClippingRegion( x, y, cw-5, h-4 );
|
dc.SetClippingRegion( x, y, cw-5, h-4 );
|
||||||
dc.DrawText( item.m_text, x+4, y+3 );
|
dc.DrawText( item.m_text, x+4, y+3 );
|
||||||
dc.DestroyClippingRegion();
|
dc.DestroyClippingRegion();
|
||||||
x += item.m_width;
|
x += item.m_width;
|
||||||
if (x > w+5) break;
|
if (x > w+5) break;
|
||||||
}
|
}
|
||||||
dc.EndDrawing();
|
dc.EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,22 +794,22 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_minX = 0;
|
m_minX = 0;
|
||||||
bool hit_border = FALSE;
|
bool hit_border = FALSE;
|
||||||
int xpos = 0;
|
int xpos = 0;
|
||||||
for (int j = 0; j < m_owner->GetColumnCount(); j++)
|
for (int j = 0; j < m_owner->GetColumnCount(); j++)
|
||||||
{
|
{
|
||||||
xpos += m_owner->GetColumnWidth( j );
|
xpos += m_owner->GetColumnWidth( j );
|
||||||
if ((abs(x-xpos) < 3) && (y < 22))
|
if ((abs(x-xpos) < 3) && (y < 22))
|
||||||
{
|
{
|
||||||
hit_border = TRUE;
|
hit_border = TRUE;
|
||||||
m_column = j;
|
m_column = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_minX = xpos;
|
m_minX = xpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.LeftDown() && hit_border)
|
if (event.LeftDown() && hit_border)
|
||||||
{
|
{
|
||||||
m_isDraging = TRUE;
|
m_isDraging = TRUE;
|
||||||
@ -818,7 +818,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
|
|||||||
CaptureMouse();
|
CaptureMouse();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.Moving())
|
if (event.Moving())
|
||||||
{
|
{
|
||||||
if (hit_border)
|
if (hit_border)
|
||||||
@ -843,13 +843,13 @@ void wxListHeaderWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
|
|||||||
// wxListRenameTimer (internal)
|
// wxListRenameTimer (internal)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxListRenameTimer::wxListRenameTimer( wxListMainWindow *owner )
|
wxListRenameTimer::wxListRenameTimer( wxListMainWindow *owner )
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListRenameTimer::Notify()
|
void wxListRenameTimer::Notify()
|
||||||
{
|
{
|
||||||
m_owner->OnRenameTimer();
|
m_owner->OnRenameTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,13 +858,13 @@ void wxListRenameTimer::Notify()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl,wxTextCtrl);
|
IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl,wxTextCtrl);
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxListTextCtrl,wxTextCtrl)
|
BEGIN_EVENT_TABLE(wxListTextCtrl,wxTextCtrl)
|
||||||
EVT_CHAR (wxListTextCtrl::OnChar)
|
EVT_CHAR (wxListTextCtrl::OnChar)
|
||||||
EVT_KILL_FOCUS (wxListTextCtrl::OnKillFocus)
|
EVT_KILL_FOCUS (wxListTextCtrl::OnKillFocus)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxListTextCtrl::wxListTextCtrl( wxWindow *parent, const wxWindowID id,
|
wxListTextCtrl::wxListTextCtrl( wxWindow *parent, const wxWindowID id,
|
||||||
bool *accept, wxString *res, wxListMainWindow *owner,
|
bool *accept, wxString *res, wxListMainWindow *owner,
|
||||||
const wxString &value, const wxPoint &pos, const wxSize &size,
|
const wxString &value, const wxPoint &pos, const wxSize &size,
|
||||||
int style, const wxValidator& validator, const wxString &name ) :
|
int style, const wxValidator& validator, const wxString &name ) :
|
||||||
@ -887,7 +887,7 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.m_keyCode == WXK_ESCAPE)
|
if (event.m_keyCode == WXK_ESCAPE)
|
||||||
{
|
{
|
||||||
(*m_accept) = FALSE;
|
(*m_accept) = FALSE;
|
||||||
(*m_res) = "";
|
(*m_res) = "";
|
||||||
// Show( FALSE );
|
// Show( FALSE );
|
||||||
@ -911,7 +911,7 @@ void wxListTextCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow);
|
IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow);
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow)
|
BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow)
|
||||||
EVT_PAINT (wxListMainWindow::OnPaint)
|
EVT_PAINT (wxListMainWindow::OnPaint)
|
||||||
EVT_SIZE (wxListMainWindow::OnSize)
|
EVT_SIZE (wxListMainWindow::OnSize)
|
||||||
@ -944,7 +944,7 @@ wxListMainWindow::wxListMainWindow( void )
|
|||||||
m_dragCount = 0;
|
m_dragCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxString &name ) :
|
long style, const wxString &name ) :
|
||||||
wxScrolledWindow( parent, id, pos, size, style, name )
|
wxScrolledWindow( parent, id, pos, size, style, name )
|
||||||
@ -966,7 +966,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
|||||||
m_isCreated = FALSE;
|
m_isCreated = FALSE;
|
||||||
wxSize sz = size;
|
wxSize sz = size;
|
||||||
sz.y = 25;
|
sz.y = 25;
|
||||||
|
|
||||||
if (m_mode & wxLC_REPORT)
|
if (m_mode & wxLC_REPORT)
|
||||||
{
|
{
|
||||||
m_xScroll = 0;
|
m_xScroll = 0;
|
||||||
@ -978,7 +978,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id,
|
|||||||
m_yScroll = 0;
|
m_yScroll = 0;
|
||||||
}
|
}
|
||||||
SetScrollbars( m_xScroll, m_yScroll, 0, 0, 0, 0 );
|
SetScrollbars( m_xScroll, m_yScroll, 0, 0, 0, 0 );
|
||||||
|
|
||||||
m_usedKeys = TRUE;
|
m_usedKeys = TRUE;
|
||||||
m_lastOnSame = FALSE;
|
m_lastOnSame = FALSE;
|
||||||
m_renameTimer = new wxListRenameTimer( this );
|
m_renameTimer = new wxListRenameTimer( this );
|
||||||
@ -1008,10 +1008,10 @@ void wxListMainWindow::RefreshLine( wxListLineData *line )
|
|||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
line->GetExtent( x, y, w, h );
|
line->GetExtent( x, y, w, h );
|
||||||
wxRectangle rect(
|
wxRectangle rect(
|
||||||
dc.LogicalToDeviceX(x-3),
|
dc.LogicalToDeviceX(x-3),
|
||||||
dc.LogicalToDeviceY(y-3),
|
dc.LogicalToDeviceY(y-3),
|
||||||
dc.LogicalToDeviceXRel(w+6),
|
dc.LogicalToDeviceXRel(w+6),
|
||||||
dc.LogicalToDeviceXRel(h+6) );
|
dc.LogicalToDeviceXRel(h+6) );
|
||||||
Refresh( TRUE, &rect );
|
Refresh( TRUE, &rect );
|
||||||
}
|
}
|
||||||
@ -1020,16 +1020,16 @@ void wxListMainWindow::RefreshLine( wxListLineData *line )
|
|||||||
void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (m_dirty) return;
|
if (m_dirty) return;
|
||||||
|
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
|
|
||||||
dc.BeginDrawing();
|
dc.BeginDrawing();
|
||||||
|
|
||||||
dc.SetFont( *GetFont() );
|
dc.SetFont( *GetFont() );
|
||||||
|
|
||||||
wxNode *node = m_lines.First();
|
wxNode *node = m_lines.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
line->Draw( &dc );
|
line->Draw( &dc );
|
||||||
@ -1112,7 +1112,7 @@ void wxListMainWindow::StartLabelEdit( wxListLineData *line )
|
|||||||
void wxListMainWindow::RenameLine( wxListLineData *line, const wxString &newName )
|
void wxListMainWindow::RenameLine( wxListLineData *line, const wxString &newName )
|
||||||
{
|
{
|
||||||
if (!GetParent()) return;
|
if (!GetParent()) return;
|
||||||
|
|
||||||
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
|
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
|
||||||
le.SetEventObject( GetParent() );
|
le.SetEventObject( GetParent() );
|
||||||
le.m_code = 0;
|
le.m_code = 0;
|
||||||
@ -1133,13 +1133,13 @@ void wxListMainWindow::OnRenameTimer()
|
|||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
m_current->GetLabelExtent( x, y, w, h );
|
m_current->GetLabelExtent( x, y, w, h );
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
x = dc.LogicalToDeviceX( x );
|
x = dc.LogicalToDeviceX( x );
|
||||||
y = dc.LogicalToDeviceY( y );
|
y = dc.LogicalToDeviceY( y );
|
||||||
|
|
||||||
wxListTextCtrl *text = new wxListTextCtrl(
|
wxListTextCtrl *text = new wxListTextCtrl(
|
||||||
this, -1, &m_renameAccept, &m_renameRes, this, s, wxPoint(x-4,y-4), wxSize(w+11,h+8) );
|
this, -1, &m_renameAccept, &m_renameRes, this, s, wxPoint(x-4,y-4), wxSize(w+11,h+8) );
|
||||||
text->SetFocus();
|
text->SetFocus();
|
||||||
/*
|
/*
|
||||||
@ -1175,7 +1175,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
long x = dc.DeviceToLogicalX( (long)event.GetX() );
|
long x = dc.DeviceToLogicalX( (long)event.GetX() );
|
||||||
long y = dc.DeviceToLogicalY( (long)event.GetY() );
|
long y = dc.DeviceToLogicalY( (long)event.GetY() );
|
||||||
|
|
||||||
long hitResult = 0;
|
long hitResult = 0;
|
||||||
wxNode *node = m_lines.First();
|
wxNode *node = m_lines.First();
|
||||||
wxListLineData *line = (wxListLineData *) NULL;
|
wxListLineData *line = (wxListLineData *) NULL;
|
||||||
@ -1187,12 +1187,12 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
line = (wxListLineData *) NULL;
|
line = (wxListLineData *) NULL;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.Dragging())
|
if (!event.Dragging())
|
||||||
m_dragCount = 0;
|
m_dragCount = 0;
|
||||||
else
|
else
|
||||||
m_dragCount++;
|
m_dragCount++;
|
||||||
|
|
||||||
if (event.Dragging() && (m_dragCount > 3))
|
if (event.Dragging() && (m_dragCount > 3))
|
||||||
{
|
{
|
||||||
m_dragCount = 0;
|
m_dragCount = 0;
|
||||||
@ -1203,9 +1203,9 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
le.m_col = 0;
|
le.m_col = 0;
|
||||||
OnListNotify( le );
|
OnListNotify( le );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!line) return;
|
if (!line) return;
|
||||||
|
|
||||||
if (event.ButtonDClick())
|
if (event.ButtonDClick())
|
||||||
{
|
{
|
||||||
m_usedKeys = FALSE;
|
m_usedKeys = FALSE;
|
||||||
@ -1214,21 +1214,21 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
ActivateLine( line );
|
ActivateLine( line );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.LeftUp() && m_lastOnSame)
|
if (event.LeftUp() && m_lastOnSame)
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
m_lastOnSame = FALSE;
|
m_lastOnSame = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.LeftDown())
|
if (event.LeftDown())
|
||||||
{
|
{
|
||||||
m_usedKeys = FALSE;
|
m_usedKeys = FALSE;
|
||||||
@ -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,23 +1265,23 @@ 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
|
||||||
{
|
{
|
||||||
m_current = line;
|
m_current = line;
|
||||||
HilightAll( FALSE );
|
HilightAll( FALSE );
|
||||||
@ -1298,7 +1298,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
m_lastOnSame = (m_current == oldCurrent);
|
m_lastOnSame = (m_current == oldCurrent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListMainWindow::MoveToFocus( void )
|
void wxListMainWindow::MoveToFocus( void )
|
||||||
@ -1317,7 +1317,7 @@ void wxListMainWindow::MoveToFocus( void )
|
|||||||
{
|
{
|
||||||
if (GetScrollPos( wxHORIZONTAL ) != 0) SetScrollPos( wxHORIZONTAL, 0);
|
if (GetScrollPos( wxHORIZONTAL ) != 0) SetScrollPos( wxHORIZONTAL, 0);
|
||||||
int y_s = m_yScroll*GetScrollPos( wxVERTICAL );
|
int y_s = m_yScroll*GetScrollPos( wxVERTICAL );
|
||||||
if ((y > y_s) && (y+h < y_s+h_p)) return;
|
if ((y > y_s) && (y+h < y_s+h_p)) return;
|
||||||
if (y-y_s < 5) SetScrollPos( wxVERTICAL, (y-5)/m_yScroll );
|
if (y-y_s < 5) SetScrollPos( wxVERTICAL, (y-5)/m_yScroll );
|
||||||
if (y+h+5 > y_s+h_p) SetScrollPos( wxVERTICAL, (y+h-h_p+h+5)/m_yScroll );
|
if (y+h+5 > y_s+h_p) SetScrollPos( wxVERTICAL, (y+h-h_p+h+5)/m_yScroll );
|
||||||
}
|
}
|
||||||
@ -1390,7 +1390,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
|||||||
if (m_mode & wxLC_REPORT) { steps = m_visibleLines-1; }
|
if (m_mode & wxLC_REPORT) { steps = m_visibleLines-1; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
wxNode *node = m_lines.First();
|
wxNode *node = m_lines.First();
|
||||||
for (;;) { if (m_current == (wxListLineData*)node->Data()) break; pos++; node = node->Next(); }
|
for (;;) { if (m_current == (wxListLineData*)node->Data()) break; pos++; node = node->Next(); }
|
||||||
steps = pos % m_visibleLines;
|
steps = pos % m_visibleLines;
|
||||||
@ -1447,11 +1447,11 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
|||||||
{
|
{
|
||||||
wxListLineData *oldCurrent = m_current;
|
wxListLineData *oldCurrent = m_current;
|
||||||
m_current->ReverseHilight();
|
m_current->ReverseHilight();
|
||||||
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 );
|
||||||
}
|
}
|
||||||
@ -1476,9 +1476,9 @@ void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
|
|||||||
{
|
{
|
||||||
m_hasFocus = TRUE;
|
m_hasFocus = TRUE;
|
||||||
RefreshLine( m_current );
|
RefreshLine( m_current );
|
||||||
|
|
||||||
if (!GetParent()) return;
|
if (!GetParent()) return;
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_SET_FOCUS, GetParent()->GetId() );
|
wxFocusEvent event( wxEVT_SET_FOCUS, GetParent()->GetId() );
|
||||||
event.SetEventObject( GetParent() );
|
event.SetEventObject( GetParent() );
|
||||||
GetParent()->GetEventHandler()->ProcessEvent( event );
|
GetParent()->GetEventHandler()->ProcessEvent( event );
|
||||||
@ -1574,7 +1574,7 @@ void wxListMainWindow::SetItemSpacing( int spacing, bool isSmall )
|
|||||||
{
|
{
|
||||||
m_dirty = TRUE;
|
m_dirty = TRUE;
|
||||||
if (isSmall)
|
if (isSmall)
|
||||||
{
|
{
|
||||||
m_small_spacing = spacing;
|
m_small_spacing = spacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1607,16 +1607,16 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
|
|||||||
if (!(m_mode & wxLC_REPORT)) return;
|
if (!(m_mode & wxLC_REPORT)) return;
|
||||||
|
|
||||||
m_dirty = TRUE;
|
m_dirty = TRUE;
|
||||||
|
|
||||||
wxNode *node = m_columns.Nth( col );
|
wxNode *node = m_columns.Nth( col );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListHeaderData *column = (wxListHeaderData*)node->Data();
|
wxListHeaderData *column = (wxListHeaderData*)node->Data();
|
||||||
column->SetWidth( width );
|
column->SetWidth( width );
|
||||||
}
|
}
|
||||||
|
|
||||||
node = m_lines.First();
|
node = m_lines.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
wxNode *n = line->m_items.Nth( col );
|
wxNode *n = line->m_items.Nth( col );
|
||||||
@ -1627,7 +1627,7 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
|
|||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListCtrl *lc = (wxListCtrl*) GetParent();
|
wxListCtrl *lc = (wxListCtrl*) GetParent();
|
||||||
if (lc->m_headerWin) lc->m_headerWin->Refresh();
|
if (lc->m_headerWin) lc->m_headerWin->Refresh();
|
||||||
}
|
}
|
||||||
@ -1650,7 +1650,7 @@ void wxListMainWindow::GetColumn( int col, wxListItem &item )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListMainWindow::GetColumnWidth( int col )
|
int wxListMainWindow::GetColumnWidth( int col )
|
||||||
{
|
{
|
||||||
wxNode *node = m_columns.Nth( col );
|
wxNode *node = m_columns.Nth( col );
|
||||||
if (node)
|
if (node)
|
||||||
@ -1676,7 +1676,7 @@ void wxListMainWindow::SetItem( wxListItem &item )
|
|||||||
{
|
{
|
||||||
m_dirty = TRUE;
|
m_dirty = TRUE;
|
||||||
wxNode *node = m_lines.Nth( item.m_itemId );
|
wxNode *node = m_lines.Nth( item.m_itemId );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
if (m_mode & wxLC_REPORT) item.m_width = GetColumnWidth( item.m_col )-3;
|
if (m_mode & wxLC_REPORT) item.m_width = GetColumnWidth( item.m_col )-3;
|
||||||
@ -1687,13 +1687,13 @@ void wxListMainWindow::SetItem( wxListItem &item )
|
|||||||
void wxListMainWindow::SetItemState( long item, long state, long stateMask )
|
void wxListMainWindow::SetItemState( long item, long state, long stateMask )
|
||||||
{
|
{
|
||||||
// m_dirty = TRUE; no recalcs needed
|
// m_dirty = TRUE; no recalcs needed
|
||||||
|
|
||||||
wxListLineData *oldCurrent = m_current;
|
wxListLineData *oldCurrent = m_current;
|
||||||
|
|
||||||
if (stateMask & wxLIST_STATE_FOCUSED)
|
if (stateMask & wxLIST_STATE_FOCUSED)
|
||||||
{
|
{
|
||||||
wxNode *node = m_lines.Nth( item );
|
wxNode *node = m_lines.Nth( item );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
UnfocusLine( m_current );
|
UnfocusLine( m_current );
|
||||||
@ -1703,20 +1703,20 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask )
|
|||||||
RefreshLine( oldCurrent );
|
RefreshLine( oldCurrent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateMask & wxLIST_STATE_SELECTED)
|
if (stateMask & wxLIST_STATE_SELECTED)
|
||||||
{
|
{
|
||||||
bool on = state & wxLIST_STATE_SELECTED;
|
bool on = state & wxLIST_STATE_SELECTED;
|
||||||
if (!on && (m_mode & wxLC_SINGLE_SEL)) return;
|
if (!on && (m_mode & wxLC_SINGLE_SEL)) return;
|
||||||
|
|
||||||
wxNode *node = m_lines.Nth( item );
|
wxNode *node = m_lines.Nth( item );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
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 );
|
||||||
@ -1735,7 +1735,7 @@ int wxListMainWindow::GetItemState( long item, long stateMask )
|
|||||||
if (stateMask & wxLIST_STATE_FOCUSED)
|
if (stateMask & wxLIST_STATE_FOCUSED)
|
||||||
{
|
{
|
||||||
wxNode *node = m_lines.Nth( item );
|
wxNode *node = m_lines.Nth( item );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
if (line == m_current) ret |= wxLIST_STATE_FOCUSED;
|
if (line == m_current) ret |= wxLIST_STATE_FOCUSED;
|
||||||
@ -1744,7 +1744,7 @@ int wxListMainWindow::GetItemState( long item, long stateMask )
|
|||||||
if (stateMask & wxLIST_STATE_SELECTED)
|
if (stateMask & wxLIST_STATE_SELECTED)
|
||||||
{
|
{
|
||||||
wxNode *node = m_lines.Nth( item );
|
wxNode *node = m_lines.Nth( item );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
if (line->IsHilighted()) ret |= wxLIST_STATE_FOCUSED;
|
if (line->IsHilighted()) ret |= wxLIST_STATE_FOCUSED;
|
||||||
@ -1756,7 +1756,7 @@ int wxListMainWindow::GetItemState( long item, long stateMask )
|
|||||||
void wxListMainWindow::GetItem( wxListItem &item )
|
void wxListMainWindow::GetItem( wxListItem &item )
|
||||||
{
|
{
|
||||||
wxNode *node = m_lines.Nth( item.m_itemId );
|
wxNode *node = m_lines.Nth( item.m_itemId );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
line->GetItem( item.m_col, item );
|
line->GetItem( item.m_col, item );
|
||||||
@ -1778,7 +1778,7 @@ int wxListMainWindow::GetItemCount( void )
|
|||||||
void wxListMainWindow::GetItemRect( long index, wxRectangle &rect )
|
void wxListMainWindow::GetItemRect( long index, wxRectangle &rect )
|
||||||
{
|
{
|
||||||
wxNode *node = m_lines.Nth( index );
|
wxNode *node = m_lines.Nth( index );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
line->GetRect( rect );
|
line->GetRect( rect );
|
||||||
@ -1795,7 +1795,7 @@ void wxListMainWindow::GetItemRect( long index, wxRectangle &rect )
|
|||||||
bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos)
|
bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos)
|
||||||
{
|
{
|
||||||
wxNode *node = m_lines.Nth( item );
|
wxNode *node = m_lines.Nth( item );
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxRectangle rect;
|
wxRectangle rect;
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
@ -1828,9 +1828,9 @@ void wxListMainWindow::SetMode( long mode )
|
|||||||
{
|
{
|
||||||
m_dirty = TRUE;
|
m_dirty = TRUE;
|
||||||
m_mode = mode;
|
m_mode = mode;
|
||||||
|
|
||||||
DeleteEverything();
|
DeleteEverything();
|
||||||
|
|
||||||
if (m_mode & wxLC_REPORT)
|
if (m_mode & wxLC_REPORT)
|
||||||
{
|
{
|
||||||
m_xScroll = 0;
|
m_xScroll = 0;
|
||||||
@ -1857,7 +1857,7 @@ void wxListMainWindow::CalculatePositions( void )
|
|||||||
if (m_mode & wxLC_ICON) iconSpacing = m_normal_spacing;
|
if (m_mode & wxLC_ICON) iconSpacing = m_normal_spacing;
|
||||||
if (m_mode & wxLC_SMALL_ICON) iconSpacing = m_small_spacing;
|
if (m_mode & wxLC_SMALL_ICON) iconSpacing = m_small_spacing;
|
||||||
wxNode *node = m_lines.First();
|
wxNode *node = m_lines.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
line->CalculateSize( &dc, iconSpacing );
|
line->CalculateSize( &dc, iconSpacing );
|
||||||
@ -1866,10 +1866,10 @@ void wxListMainWindow::CalculatePositions( void )
|
|||||||
|
|
||||||
int lineWidth = 0;
|
int lineWidth = 0;
|
||||||
int lineHeight = 0;
|
int lineHeight = 0;
|
||||||
int lineSpacing = 0;
|
int lineSpacing = 0;
|
||||||
|
|
||||||
node = m_lines.First();
|
node = m_lines.First();
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
@ -1879,12 +1879,12 @@ void wxListMainWindow::CalculatePositions( void )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// just in case
|
// just in case
|
||||||
lineSpacing = 4 + (int)dc.GetCharHeight();
|
lineSpacing = 4 + (int)dc.GetCharHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
int clientWidth = 0;
|
int clientWidth = 0;
|
||||||
int clientHeight = 0;
|
int clientHeight = 0;
|
||||||
|
|
||||||
if (m_mode & wxLC_REPORT)
|
if (m_mode & wxLC_REPORT)
|
||||||
{
|
{
|
||||||
int x = 4;
|
int x = 4;
|
||||||
@ -1892,7 +1892,7 @@ void wxListMainWindow::CalculatePositions( void )
|
|||||||
int entireHeight = m_lines.Number() * lineSpacing + 10;
|
int entireHeight = m_lines.Number() * lineSpacing + 10;
|
||||||
SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+10) / m_yScroll, 0, 0, TRUE );
|
SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+10) / m_yScroll, 0, 0, TRUE );
|
||||||
GetClientSize( &clientWidth, &clientHeight );
|
GetClientSize( &clientWidth, &clientHeight );
|
||||||
|
|
||||||
node = m_lines.First();
|
node = m_lines.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@ -1912,9 +1912,9 @@ void wxListMainWindow::CalculatePositions( void )
|
|||||||
{
|
{
|
||||||
// At first, we try without any scrollbar
|
// At first, we try without any scrollbar
|
||||||
GetSize( &clientWidth, &clientHeight );
|
GetSize( &clientWidth, &clientHeight );
|
||||||
|
|
||||||
int entireWidth = 0;
|
int entireWidth = 0;
|
||||||
|
|
||||||
for (int tries = 0; tries < 2; tries++)
|
for (int tries = 0; tries < 2; tries++)
|
||||||
{
|
{
|
||||||
entireWidth = 0;
|
entireWidth = 0;
|
||||||
@ -1929,7 +1929,7 @@ void wxListMainWindow::CalculatePositions( void )
|
|||||||
line->GetSize( lineWidth, lineHeight );
|
line->GetSize( lineWidth, lineHeight );
|
||||||
if (lineWidth > maxWidth) maxWidth = lineWidth;
|
if (lineWidth > maxWidth) maxWidth = lineWidth;
|
||||||
y += lineSpacing;
|
y += lineSpacing;
|
||||||
if (y+lineHeight > clientHeight-4)
|
if (y+lineHeight > clientHeight-4)
|
||||||
{
|
{
|
||||||
y = 6;
|
y = 6;
|
||||||
x += maxWidth+13;
|
x += maxWidth+13;
|
||||||
@ -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 );
|
||||||
@ -1959,7 +1959,7 @@ void wxListMainWindow::RealizeChanges( void )
|
|||||||
if (node) m_current = (wxListLineData*)node->Data();
|
if (node) m_current = (wxListLineData*)node->Data();
|
||||||
}
|
}
|
||||||
if (m_current)
|
if (m_current)
|
||||||
{
|
{
|
||||||
FocusLine( m_current );
|
FocusLine( m_current );
|
||||||
if (m_mode & wxLC_SINGLE_SEL) m_current->Hilight( TRUE );
|
if (m_mode & wxLC_SINGLE_SEL) m_current->Hilight( 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 );
|
||||||
@ -2111,7 +2114,7 @@ void wxListMainWindow::InsertItem( wxListItem &item )
|
|||||||
line->InitItems( GetColumnCount() );
|
line->InitItems( GetColumnCount() );
|
||||||
item.m_width = GetColumnWidth( 0 )-3;
|
item.m_width = GetColumnWidth( 0 )-3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
line->InitItems( 1 );
|
line->InitItems( 1 );
|
||||||
line->SetItem( 0, item );
|
line->SetItem( 0, item );
|
||||||
if ((item.m_itemId >= 0) && (item.m_itemId < (int)m_lines.GetCount()))
|
if ((item.m_itemId >= 0) && (item.m_itemId < (int)m_lines.GetCount()))
|
||||||
@ -2230,50 +2233,50 @@ wxListCtrl::~wxListCtrl(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
|
bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxValidator &validator,
|
long style, const wxValidator &validator,
|
||||||
const wxString &name )
|
const wxString &name )
|
||||||
{
|
{
|
||||||
m_imageListNormal = (wxImageList *) NULL;
|
m_imageListNormal = (wxImageList *) NULL;
|
||||||
m_imageListSmall = (wxImageList *) NULL;
|
m_imageListSmall = (wxImageList *) NULL;
|
||||||
m_imageListState = (wxImageList *) NULL;
|
m_imageListState = (wxImageList *) NULL;
|
||||||
|
|
||||||
long s = style;
|
long s = style;
|
||||||
|
|
||||||
if ((s & wxLC_REPORT == 0) &&
|
if ((s & wxLC_REPORT == 0) &&
|
||||||
(s & wxLC_LIST == 0) &&
|
(s & wxLC_LIST == 0) &&
|
||||||
(s & wxLC_ICON == 0))
|
(s & wxLC_ICON == 0))
|
||||||
s = s | wxLC_LIST;
|
s = s | wxLC_LIST;
|
||||||
|
|
||||||
bool ret = wxControl::Create( parent, id, pos, size, s, name );
|
bool ret = wxControl::Create( parent, id, pos, size, s, name );
|
||||||
|
|
||||||
SetValidator( validator );
|
SetValidator( validator );
|
||||||
|
|
||||||
m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s );
|
m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s );
|
||||||
|
|
||||||
if (GetWindowStyleFlag() & wxLC_REPORT)
|
if (GetWindowStyleFlag() & wxLC_REPORT)
|
||||||
m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(size.x,23) );
|
m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(size.x,23) );
|
||||||
else
|
else
|
||||||
m_headerWin = (wxListHeaderWindow *) NULL;
|
m_headerWin = (wxListHeaderWindow *) NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::OnSize( wxSizeEvent &WXUNUSED(event) )
|
void wxListCtrl::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
// handled in OnIdle
|
// handled in OnIdle
|
||||||
|
|
||||||
if (m_mainWin) m_mainWin->m_dirty = TRUE;
|
if (m_mainWin) m_mainWin->m_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::SetSingleStyle( long style, bool add )
|
void wxListCtrl::SetSingleStyle( long style, bool add )
|
||||||
{
|
{
|
||||||
long flag = GetWindowStyleFlag();
|
long flag = GetWindowStyleFlag();
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -2286,7 +2289,7 @@ void wxListCtrl::SetSingleStyle( long style, bool add )
|
|||||||
{
|
{
|
||||||
if (flag & style) flag -= style;
|
if (flag & style) flag -= style;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowStyleFlag( flag );
|
SetWindowStyleFlag( flag );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2299,7 +2302,7 @@ void wxListCtrl::SetWindowStyleFlag( long flag )
|
|||||||
GetClientSize( &width, &height );
|
GetClientSize( &width, &height );
|
||||||
|
|
||||||
m_mainWin->SetMode( flag );
|
m_mainWin->SetMode( flag );
|
||||||
|
|
||||||
if (flag & wxLC_REPORT)
|
if (flag & wxLC_REPORT)
|
||||||
{
|
{
|
||||||
if (!(GetWindowStyleFlag() & wxLC_REPORT))
|
if (!(GetWindowStyleFlag() & wxLC_REPORT))
|
||||||
@ -2323,12 +2326,12 @@ void wxListCtrl::SetWindowStyleFlag( long flag )
|
|||||||
// m_mainWin->SetSize( 0, 0, width, height );
|
// m_mainWin->SetSize( 0, 0, width, height );
|
||||||
m_headerWin->Show( FALSE );
|
m_headerWin->Show( FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow::SetWindowStyleFlag( flag );
|
wxWindow::SetWindowStyleFlag( flag );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListCtrl::GetColumn(int col, wxListItem &item)
|
bool wxListCtrl::GetColumn(int col, wxListItem &item)
|
||||||
{
|
{
|
||||||
m_mainWin->GetColumn( col, item );
|
m_mainWin->GetColumn( col, item );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2340,7 +2343,7 @@ bool wxListCtrl::SetColumn( int col, wxListItem& item )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListCtrl::GetColumnWidth( int col )
|
int wxListCtrl::GetColumnWidth( int col )
|
||||||
{
|
{
|
||||||
return m_mainWin->GetColumnWidth( col );
|
return m_mainWin->GetColumnWidth( col );
|
||||||
}
|
}
|
||||||
@ -2351,7 +2354,7 @@ bool wxListCtrl::SetColumnWidth( int col, int width )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListCtrl::GetCountPerPage(void)
|
int wxListCtrl::GetCountPerPage(void)
|
||||||
{
|
{
|
||||||
return m_mainWin->GetCountPerPage(); // different from Windows ?
|
return m_mainWin->GetCountPerPage(); // different from Windows ?
|
||||||
}
|
}
|
||||||
@ -2362,7 +2365,7 @@ wxText& wxListCtrl::GetEditControl(void) const
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool wxListCtrl::GetItem( wxListItem &info )
|
bool wxListCtrl::GetItem( wxListItem &info )
|
||||||
{
|
{
|
||||||
m_mainWin->GetItem( info );
|
m_mainWin->GetItem( info );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2393,7 +2396,7 @@ long wxListCtrl::SetItem( long index, int col, const wxString& label, int imageI
|
|||||||
|
|
||||||
int wxListCtrl::GetItemState( long item, long stateMask )
|
int wxListCtrl::GetItemState( long item, long stateMask )
|
||||||
{
|
{
|
||||||
return m_mainWin->GetItemState( item, stateMask );
|
return m_mainWin->GetItemState( item, stateMask );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListCtrl::SetItemState( long item, long state, long stateMask )
|
bool wxListCtrl::SetItemState( long item, long state, long stateMask )
|
||||||
@ -2412,7 +2415,7 @@ bool wxListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxListCtrl::GetItemText( long item )
|
wxString wxListCtrl::GetItemText( long item )
|
||||||
{
|
{
|
||||||
wxListItem info;
|
wxListItem info;
|
||||||
info.m_itemId = item;
|
info.m_itemId = item;
|
||||||
@ -2464,7 +2467,7 @@ bool wxListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(p
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListCtrl::GetItemCount(void)
|
int wxListCtrl::GetItemCount(void)
|
||||||
{
|
{
|
||||||
return m_mainWin->GetItemCount();
|
return m_mainWin->GetItemCount();
|
||||||
}
|
}
|
||||||
@ -2479,7 +2482,7 @@ int wxListCtrl::GetItemSpacing( bool isSmall )
|
|||||||
return m_mainWin->GetItemSpacing( isSmall );
|
return m_mainWin->GetItemSpacing( isSmall );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListCtrl::GetSelectedItemCount(void)
|
int wxListCtrl::GetSelectedItemCount(void)
|
||||||
{
|
{
|
||||||
return m_mainWin->GetSelectedItemCount();
|
return m_mainWin->GetSelectedItemCount();
|
||||||
}
|
}
|
||||||
@ -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 );
|
||||||
@ -2571,7 +2580,7 @@ long wxListCtrl::FindItem( long start, long data )
|
|||||||
return m_mainWin->FindItem( start, data );
|
return m_mainWin->FindItem( start, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxListCtrl::FindItem( long WXUNUSED(start), const wxPoint& WXUNUSED(pt),
|
long wxListCtrl::FindItem( long WXUNUSED(start), const wxPoint& WXUNUSED(pt),
|
||||||
int WXUNUSED(direction))
|
int WXUNUSED(direction))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -2667,19 +2676,19 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
|
|||||||
int cw = 0;
|
int cw = 0;
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
GetClientSize( &cw, &ch );
|
GetClientSize( &cw, &ch );
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
|
|
||||||
if (GetWindowStyleFlag() & wxLC_REPORT)
|
if (GetWindowStyleFlag() & wxLC_REPORT)
|
||||||
{
|
{
|
||||||
m_headerWin->GetPosition( &x, &y );
|
m_headerWin->GetPosition( &x, &y );
|
||||||
m_headerWin->GetSize( &w, &h );
|
m_headerWin->GetSize( &w, &h );
|
||||||
if ((x != 0) || (y != 0) || (w != cw) || (h != 23))
|
if ((x != 0) || (y != 0) || (w != cw) || (h != 23))
|
||||||
m_headerWin->SetSize( 0, 0, cw, 23 );
|
m_headerWin->SetSize( 0, 0, cw, 23 );
|
||||||
|
|
||||||
m_mainWin->GetPosition( &x, &y );
|
m_mainWin->GetPosition( &x, &y );
|
||||||
m_mainWin->GetSize( &w, &h );
|
m_mainWin->GetSize( &w, &h );
|
||||||
if ((x != 0) || (y != 24) || (w != cw) || (h != ch-24))
|
if ((x != 0) || (y != 24) || (w != cw) || (h != ch-24))
|
||||||
@ -2692,7 +2701,7 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
|
|||||||
if ((x != 0) || (y != 24) || (w != cw) || (h != ch))
|
if ((x != 0) || (y != 24) || (w != cw) || (h != ch))
|
||||||
m_mainWin->SetSize( 0, 0, cw, ch );
|
m_mainWin->SetSize( 0, 0, cw, ch );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainWin->CalculatePositions();
|
m_mainWin->CalculatePositions();
|
||||||
m_mainWin->RealizeChanges();
|
m_mainWin->RealizeChanges();
|
||||||
m_mainWin->m_dirty = FALSE;
|
m_mainWin->m_dirty = FALSE;
|
||||||
@ -2700,23 +2709,23 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::SetBackgroundColour( const wxColour &colour )
|
void wxListCtrl::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
m_mainWin->SetBackgroundColour( colour );
|
m_mainWin->SetBackgroundColour( colour );
|
||||||
m_headerWin->SetBackgroundColour( colour );
|
m_headerWin->SetBackgroundColour( colour );
|
||||||
m_mainWin->m_dirty = TRUE;
|
m_mainWin->m_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::SetForegroundColour( const wxColour &colour )
|
void wxListCtrl::SetForegroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
m_mainWin->SetForegroundColour( colour );
|
m_mainWin->SetForegroundColour( colour );
|
||||||
m_headerWin->SetForegroundColour( colour );
|
m_headerWin->SetForegroundColour( colour );
|
||||||
m_mainWin->m_dirty = TRUE;
|
m_mainWin->m_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::SetFont( const wxFont &font )
|
void wxListCtrl::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
m_mainWin->SetFont( font );
|
m_mainWin->SetFont( font );
|
||||||
m_headerWin->SetFont( font );
|
m_headerWin->SetFont( font );
|
||||||
m_mainWin->m_dirty = TRUE;
|
m_mainWin->m_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user