stop the rename timer when the current item changes (Tim Kosse)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -695,7 +695,7 @@ public:
|
|||||||
|
|
||||||
// send out a wxListEvent
|
// send out a wxListEvent
|
||||||
void SendNotify( size_t line,
|
void SendNotify( size_t line,
|
||||||
wxEventType command,
|
wxEventType command,
|
||||||
const wxPoint& point = wxDefaultPosition );
|
const wxPoint& point = wxDefaultPosition );
|
||||||
|
|
||||||
// override base class virtual to reset m_lineHeight when the font changes
|
// override base class virtual to reset m_lineHeight when the font changes
|
||||||
@@ -728,7 +728,7 @@ public:
|
|||||||
{
|
{
|
||||||
return m_hasFocus ? m_highlightBrush : m_highlightUnfocusedBrush;
|
return m_hasFocus ? m_highlightBrush : m_highlightUnfocusedBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasFocus() const
|
bool HasFocus() const
|
||||||
{
|
{
|
||||||
return m_hasFocus;
|
return m_hasFocus;
|
||||||
@@ -1036,7 +1036,7 @@ void wxListHeaderData::SetItem( const wxListItem &item )
|
|||||||
|
|
||||||
if ( m_mask & wxLIST_MASK_WIDTH )
|
if ( m_mask & wxLIST_MASK_WIDTH )
|
||||||
SetWidth(item.m_width);
|
SetWidth(item.m_width);
|
||||||
|
|
||||||
if ( m_mask & wxLIST_MASK_STATE )
|
if ( m_mask & wxLIST_MASK_STATE )
|
||||||
SetState(item.m_state);
|
SetState(item.m_state);
|
||||||
}
|
}
|
||||||
@@ -1473,7 +1473,7 @@ void wxListLineData::Draw( wxDC *dc )
|
|||||||
if (m_owner->HasFocus())
|
if (m_owner->HasFocus())
|
||||||
flags |= wxCONTROL_FOCUSED;
|
flags |= wxCONTROL_FOCUSED;
|
||||||
wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, m_gi->m_rectHighlight, flags );
|
wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, m_gi->m_rectHighlight, flags );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1802,12 +1802,12 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (!m_parent->IsEnabled())
|
if (!m_parent->IsEnabled())
|
||||||
flags |= wxCONTROL_DISABLED;
|
flags |= wxCONTROL_DISABLED;
|
||||||
|
|
||||||
// NB: The code below is not really Mac-specific, but since we are close
|
// NB: The code below is not really Mac-specific, but since we are close
|
||||||
// to 2.8 release and I don't have time to test on other platforms, I
|
// to 2.8 release and I don't have time to test on other platforms, I
|
||||||
// defined this only for wxMac. If this behavior is desired on
|
// defined this only for wxMac. If this behavior is desired on
|
||||||
// other platforms, please go ahead and revise or remove the #ifdef.
|
// other platforms, please go ahead and revise or remove the #ifdef.
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
if ( !m_owner->IsVirtual() && (item.m_mask & wxLIST_MASK_STATE) &&
|
if ( !m_owner->IsVirtual() && (item.m_mask & wxLIST_MASK_STATE) &&
|
||||||
(item.m_state & wxLIST_STATE_SELECTED) )
|
(item.m_state & wxLIST_STATE_SELECTED) )
|
||||||
flags |= wxCONTROL_SELECTED;
|
flags |= wxCONTROL_SELECTED;
|
||||||
#endif
|
#endif
|
||||||
@@ -2020,7 +2020,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
|
|||||||
{
|
{
|
||||||
wxListItem colItem;
|
wxListItem colItem;
|
||||||
m_owner->GetColumn(i, colItem);
|
m_owner->GetColumn(i, colItem);
|
||||||
long state = colItem.GetState();
|
long state = colItem.GetState();
|
||||||
if (i == m_column)
|
if (i == m_column)
|
||||||
colItem.SetState(state | wxLIST_STATE_SELECTED);
|
colItem.SetState(state | wxLIST_STATE_SELECTED);
|
||||||
else
|
else
|
||||||
@@ -2028,7 +2028,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
|
|||||||
m_owner->SetColumn(i, colItem);
|
m_owner->SetColumn(i, colItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendListEvent( event.LeftDown()
|
SendListEvent( event.LeftDown()
|
||||||
? wxEVT_COMMAND_LIST_COL_CLICK
|
? wxEVT_COMMAND_LIST_COL_CLICK
|
||||||
: wxEVT_COMMAND_LIST_COL_RIGHT_CLICK,
|
: wxEVT_COMMAND_LIST_COL_RIGHT_CLICK,
|
||||||
@@ -2234,7 +2234,7 @@ BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow)
|
|||||||
EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse)
|
EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse)
|
||||||
EVT_CHAR (wxListMainWindow::OnChar)
|
EVT_CHAR (wxListMainWindow::OnChar)
|
||||||
EVT_KEY_DOWN (wxListMainWindow::OnKeyDown)
|
EVT_KEY_DOWN (wxListMainWindow::OnKeyDown)
|
||||||
EVT_KEY_UP (wxListMainWindow::OnKeyUp)
|
EVT_KEY_UP (wxListMainWindow::OnKeyUp)
|
||||||
EVT_SET_FOCUS (wxListMainWindow::OnSetFocus)
|
EVT_SET_FOCUS (wxListMainWindow::OnSetFocus)
|
||||||
EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus)
|
EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus)
|
||||||
EVT_SCROLLWIN (wxListMainWindow::OnScroll)
|
EVT_SCROLLWIN (wxListMainWindow::OnScroll)
|
||||||
@@ -2300,7 +2300,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent,
|
|||||||
),
|
),
|
||||||
wxSOLID
|
wxSOLID
|
||||||
);
|
);
|
||||||
|
|
||||||
m_highlightUnfocusedBrush = new wxBrush
|
m_highlightUnfocusedBrush = new wxBrush
|
||||||
(
|
(
|
||||||
wxSystemSettings::GetColour
|
wxSystemSettings::GetColour
|
||||||
@@ -2719,7 +2719,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
wxRect rectLine;
|
wxRect rectLine;
|
||||||
int xOrig = dc.LogicalToDeviceX( 0 );
|
int xOrig = dc.LogicalToDeviceX( 0 );
|
||||||
int yOrig = dc.LogicalToDeviceY( 0 );
|
int yOrig = dc.LogicalToDeviceY( 0 );
|
||||||
|
|
||||||
// tell the caller cache to cache the data
|
// tell the caller cache to cache the data
|
||||||
if ( IsVirtual() )
|
if ( IsVirtual() )
|
||||||
{
|
{
|
||||||
@@ -2816,7 +2816,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.DrawRectangle( rect );
|
dc.DrawRectangle( rect );
|
||||||
#else
|
#else
|
||||||
wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, wxCONTROL_CURRENT|wxCONTROL_FOCUSED );
|
wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, wxCONTROL_CURRENT|wxCONTROL_FOCUSED );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2848,7 +2848,7 @@ void wxListMainWindow::SendNotify( size_t line,
|
|||||||
{
|
{
|
||||||
wxListEvent le( command, GetParent()->GetId() );
|
wxListEvent le( command, GetParent()->GetId() );
|
||||||
le.SetEventObject( GetParent() );
|
le.SetEventObject( GetParent() );
|
||||||
|
|
||||||
le.m_itemIndex = line;
|
le.m_itemIndex = line;
|
||||||
|
|
||||||
// set only for events which have position
|
// set only for events which have position
|
||||||
@@ -2876,6 +2876,11 @@ void wxListMainWindow::ChangeCurrent(size_t current)
|
|||||||
{
|
{
|
||||||
m_current = current;
|
m_current = current;
|
||||||
|
|
||||||
|
// as the current item changed, we shouldn't start editing it when the
|
||||||
|
// "slow click" timer expires as the click happened on another item
|
||||||
|
if ( m_renameTimer->IsRunning() )
|
||||||
|
m_renameTimer->Stop();
|
||||||
|
|
||||||
SendNotify(current, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
|
SendNotify(current, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2966,7 +2971,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
|
|
||||||
if ( event.LeftDown() )
|
if ( event.LeftDown() )
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
event.SetEventObject( GetParent() );
|
event.SetEventObject( GetParent() );
|
||||||
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
|
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
|
||||||
return;
|
return;
|
||||||
@@ -3076,7 +3081,9 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
bool forceClick = false;
|
bool forceClick = false;
|
||||||
if (event.ButtonDClick())
|
if (event.ButtonDClick())
|
||||||
{
|
{
|
||||||
m_renameTimer->Stop();
|
if ( m_renameTimer->IsRunning() )
|
||||||
|
m_renameTimer->Stop();
|
||||||
|
|
||||||
m_lastOnSame = false;
|
m_lastOnSame = false;
|
||||||
|
|
||||||
if ( current == m_lineLastClicked )
|
if ( current == m_lineLastClicked )
|
||||||
@@ -4361,7 +4368,7 @@ void wxListMainWindow::DeleteItem( long lindex )
|
|||||||
if ( m_current != index || m_current == count - 1 )
|
if ( m_current != index || m_current == count - 1 )
|
||||||
m_current--;
|
m_current--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( InReportView() )
|
if ( InReportView() )
|
||||||
{
|
{
|
||||||
// mark the Column Max Width cache as dirty if the items in the line
|
// mark the Column Max Width cache as dirty if the items in the line
|
||||||
@@ -4508,7 +4515,7 @@ long wxListMainWindow::FindItem(long start, const wxString& str, bool partial )
|
|||||||
{
|
{
|
||||||
if (str.empty())
|
if (str.empty())
|
||||||
return wxNOT_FOUND;
|
return wxNOT_FOUND;
|
||||||
|
|
||||||
long pos = start;
|
long pos = start;
|
||||||
wxString str_upper = str.Upper();
|
wxString str_upper = str.Upper();
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
|
Reference in New Issue
Block a user