Use the same 250ms when waiting for slow-clicks for starting

the edit label process in wxTreeCtrl and wxListCtrl.
Take icon size in the first column into account when shwoing
   text control.
Only activate label editing when clicked on the first label,
   not somewhere else


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47097 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-07-03 12:00:58 +00:00
parent 88a48ead61
commit 804ce4d2b2
2 changed files with 26 additions and 4 deletions

View File

@@ -2449,10 +2449,24 @@ wxRect wxListMainWindow::GetLineLabelRect(size_t line) const
if ( !InReportView() ) if ( !InReportView() )
return GetLine(line)->m_gi->m_rectLabel; return GetLine(line)->m_gi->m_rectLabel;
int image_x = 0;
wxListLineData *data = GetLine(line);
wxListItemDataList::compatibility_iterator node = data->m_items.GetFirst();
if (node)
{
wxListItemData *item = node->GetData();
if ( item->HasImage() )
{
int ix, iy;
GetImageSize( item->GetImage(), ix, iy );
image_x = 3 + ix + IMAGE_MARGIN_IN_REPORT_MODE;
}
}
wxRect rect; wxRect rect;
rect.x = HEADER_OFFSET_X; rect.x = image_x + HEADER_OFFSET_X;
rect.y = GetLineY(line); rect.y = GetLineY(line);
rect.width = GetColumnWidth(0); rect.width = GetColumnWidth(0) - image_x;
rect.height = GetLineHeight(); rect.height = GetLineHeight();
return rect; return rect;
@@ -3142,7 +3156,15 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
(hitResult == wxLIST_HITTEST_ONITEMLABEL) && (hitResult == wxLIST_HITTEST_ONITEMLABEL) &&
HasFlag(wxLC_EDIT_LABELS) ) HasFlag(wxLC_EDIT_LABELS) )
{ {
m_renameTimer->Start( 100, true ); if (InReportView())
{
wxRect label = GetLineLabelRect( current );
if (label.Contains( x, y ))
m_renameTimer->Start( 250, true );
}
else
m_renameTimer->Start( 250, true );
} }
} }

View File

@@ -74,7 +74,7 @@ class WXDLLEXPORT wxTreeRenameTimer: public wxTimer
public: public:
// start editing the current item after half a second (if the mouse hasn't // start editing the current item after half a second (if the mouse hasn't
// been clicked/moved) // been clicked/moved)
enum { DELAY = 500 }; enum { DELAY = 250 };
wxTreeRenameTimer( wxGenericTreeCtrl *owner ); wxTreeRenameTimer( wxGenericTreeCtrl *owner );