m_minX = 0;
bool hit_border = FALSE;
int xpos = 0;
- for (int j = 0; j < m_owner->GetColumnCount()-1; j++)
+ for (int j = 0; j < m_owner->GetColumnCount(); j++)
{
xpos += m_owner->GetColumnWidth( j );
m_column = j;
- if ((abs(x-xpos) < 3) && (y < 22))
+ if ((abs(x-xpos) < 3) && (y < 22) && (m_column < m_owner->GetColumnCount()-1))
{
hit_border = TRUE;
break;
{
(*m_accept) = TRUE;
(*m_res) = GetValue();
- m_owner->SetFocus();
+
+ if (!wxPendingDelete.Member(this))
+ wxPendingDelete.Append(this);
+
+ if ((*m_accept) && ((*m_res) != m_startValue))
+ m_owner->OnRenameAccept();
+
return;
}
if (event.m_keyCode == WXK_ESCAPE)
{
(*m_accept) = FALSE;
(*m_res) = "";
- m_owner->SetFocus();
+
+ if (!wxPendingDelete.Member(this))
+ wxPendingDelete.Append(this);
+
return;
}
+
event.Skip();
}
void wxListTextCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
{
- if (wxPendingDelete.Member(this)) return;
-
- wxPendingDelete.Append(this);
+ if (!wxPendingDelete.Member(this))
+ wxPendingDelete.Append(this);
if ((*m_accept) && ((*m_res) != m_startValue))
m_owner->OnRenameAccept();
EVT_KEY_DOWN (wxListMainWindow::OnKeyDown)
EVT_SET_FOCUS (wxListMainWindow::OnSetFocus)
EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus)
- EVT_SCROLLWIN (wxListMainWindow::OnScroll)
+ EVT_SCROLLWIN (wxListMainWindow::OnScroll)
END_EVENT_TABLE()
wxListMainWindow::wxListMainWindow()
m_renameTimer = new wxListRenameTimer( this );
m_renameAccept = FALSE;
- SetBackgroundColour( *wxWHITE );
+ SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) );
}
wxListMainWindow::~wxListMainWindow()
{
+ DeleteEverything();
+
if (m_hilightBrush) delete m_hilightBrush;
delete m_renameTimer;
if (node) m_columns.DeleteNode( node );
}
-void wxListMainWindow::DeleteAllItems( void )
+void wxListMainWindow::DeleteAllItems()
{
m_dirty = TRUE;
m_current = (wxListLineData *) NULL;
// to make the deletion of all items faster, we don't send the
// notifications in this case: this is compatible with wxMSW and
// documented in DeleteAllItems() description
-#if 0
- wxNode *node = m_lines.First();
- while (node)
- {
- wxListLineData *line = (wxListLineData*)node->Data();
-
- DeleteLine( line );
- node = node->Next();
- }
-#endif // 0
+ wxListEvent event( wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, GetParent()->GetId() );
+ event.SetEventObject( GetParent() );
+ GetParent()->GetEventHandler()->ProcessEvent( event );
m_lines.Clear();
}
-void wxListMainWindow::DeleteEverything( void )
+void wxListMainWindow::DeleteEverything()
{
- m_dirty = TRUE;
- m_current = (wxListLineData *) NULL;
- wxNode *node = m_lines.First();
- while (node)
- {
- wxListLineData *line = (wxListLineData*)node->Data();
- DeleteLine( line );
- node = node->Next();
- }
- m_lines.Clear();
- m_current = (wxListLineData *) NULL;
+ DeleteAllItems();
+
m_columns.Clear();
}
m_headerWin = (wxListHeaderWindow *) NULL;
}
- SetBackgroundColour( *wxWHITE );
+ SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) );
return ret;
}