Add middle-item click support.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -344,8 +344,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
|||||||
|
|
||||||
#if wxABI_VERSION >= 20801
|
#if wxABI_VERSION >= 20801
|
||||||
void OnRightDown(wxMouseEvent& event);
|
void OnRightDown(wxMouseEvent& event);
|
||||||
|
void OnMiddleDown(wxMouseEvent& event);
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
virtual void SetFocus();
|
virtual void SetFocus();
|
||||||
|
void FireMouseEvent(wxEventType eventType, wxPoint position);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
|
@@ -507,6 +507,7 @@ void wxListCtrlTextCtrlWrapper::OnKillFocus( wxFocusEvent &event )
|
|||||||
BEGIN_EVENT_TABLE(wxListCtrl, wxControl)
|
BEGIN_EVENT_TABLE(wxListCtrl, wxControl)
|
||||||
EVT_LEFT_DOWN(wxListCtrl::OnLeftDown)
|
EVT_LEFT_DOWN(wxListCtrl::OnLeftDown)
|
||||||
EVT_LEFT_DCLICK(wxListCtrl::OnDblClick)
|
EVT_LEFT_DCLICK(wxListCtrl::OnDblClick)
|
||||||
|
EVT_MIDDLE_DOWN(wxListCtrl::OnMiddleDown)
|
||||||
EVT_RIGHT_DOWN(wxListCtrl::OnRightDown)
|
EVT_RIGHT_DOWN(wxListCtrl::OnRightDown)
|
||||||
EVT_CHAR(wxListCtrl::OnChar)
|
EVT_CHAR(wxListCtrl::OnChar)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@@ -621,13 +622,25 @@ void wxListCtrl::OnDblClick(wxMouseEvent& event)
|
|||||||
#if wxABI_VERSION >= 20801
|
#if wxABI_VERSION >= 20801
|
||||||
void wxListCtrl::OnRightDown(wxMouseEvent& event)
|
void wxListCtrl::OnRightDown(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
wxListEvent le( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, GetId() );
|
FireMouseEvent(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, event.GetPosition());
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxListCtrl::OnMiddleDown(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
FireMouseEvent(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, event.GetPosition());
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxListCtrl::FireMouseEvent(wxEventType eventType, wxPoint position)
|
||||||
|
{
|
||||||
|
wxListEvent le( eventType, GetId() );
|
||||||
le.SetEventObject(this);
|
le.SetEventObject(this);
|
||||||
le.m_pointDrag = event.GetPosition();
|
le.m_pointDrag = position;
|
||||||
le.m_itemIndex = -1;
|
le.m_itemIndex = -1;
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
long item = HitTest(event.GetPosition(), flags);
|
long item = HitTest(position, flags);
|
||||||
if (flags & wxLIST_HITTEST_ONITEM)
|
if (flags & wxLIST_HITTEST_ONITEM)
|
||||||
{
|
{
|
||||||
le.m_itemIndex = item;
|
le.m_itemIndex = item;
|
||||||
@@ -639,8 +652,6 @@ void wxListCtrl::OnRightDown(wxMouseEvent& event)
|
|||||||
}
|
}
|
||||||
GetEventHandler()->ProcessEvent(le);
|
GetEventHandler()->ProcessEvent(le);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.Skip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::OnChar(wxKeyEvent& event)
|
void wxListCtrl::OnChar(wxKeyEvent& event)
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
*wxListCtrl*SetFocus*;
|
*wxListCtrl*SetFocus*;
|
||||||
*wxListCtrl*OnChar*;
|
*wxListCtrl*OnChar*;
|
||||||
*wxListCtrl*OnRightDown*;
|
*wxListCtrl*OnRightDown*;
|
||||||
|
*wxListCtrl*OnMiddleDown*;
|
||||||
|
*wxListCtrl*FireMouseEvent*;
|
||||||
};
|
};
|
||||||
|
|
||||||
# symbols available since the beginning of this branch are only given
|
# symbols available since the beginning of this branch are only given
|
||||||
|
Reference in New Issue
Block a user