Move event generation in multiple selectino mode to common code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-05-23 11:02:32 +00:00
parent bc60925fb3
commit 84c5c49bca

View File

@@ -266,6 +266,8 @@ void wxListBox::DoDeleteOneItem(unsigned int n)
m_noItems--; m_noItems--;
SetHorizontalExtent(wxEmptyString); SetHorizontalExtent(wxEmptyString);
UpdateOldSelections();
} }
int wxListBox::FindString(const wxString& s, bool bCase) const int wxListBox::FindString(const wxString& s, bool bCase) const
@@ -289,6 +291,8 @@ void wxListBox::DoClear()
m_noItems = 0; m_noItems = 0;
SetHorizontalExtent(); SetHorizontalExtent();
UpdateOldSelections();
} }
void wxListBox::Free() void wxListBox::Free()
@@ -314,6 +318,8 @@ void wxListBox::DoSetSelection(int N, bool select)
{ {
SendMessage(GetHwnd(), LB_SETCURSEL, select ? N : -1, 0); SendMessage(GetHwnd(), LB_SETCURSEL, select ? N : -1, 0);
} }
UpdateOldSelections();
} }
bool wxListBox::IsSelected(int N) const bool wxListBox::IsSelected(int N) const
@@ -464,6 +470,8 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter & items,
SetHorizontalExtent(); SetHorizontalExtent();
UpdateOldSelections();
return n; return n;
} }
@@ -626,6 +634,12 @@ wxSize wxListBox::DoGetBestSize() const
bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{ {
if ((param == LBN_SELCHANGE) && HasMultipleSelection())
{
CalcAndSendEvent();
return true;
}
wxEventType evtType; wxEventType evtType;
if ( param == LBN_SELCHANGE ) if ( param == LBN_SELCHANGE )
{ {
@@ -654,7 +668,10 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
event.SetClientData( GetClientData(n) ); event.SetClientData( GetClientData(n) );
event.SetString(GetString(n)); event.SetString(GetString(n));
event.SetExtraLong( HasMultipleSelection() ? IsSelected(n) : true ); }
else
{
return false;
} }
event.SetInt(n); event.SetInt(n);