1. big wxScrollBar optimization: Refresh() doesn't refresh them any more
2. many fixes to refresh scrollbars when needed (as this is not done all the time now) 3. wxStdButtonInputHandler bug with uninit m_hasMouse fixing bug with moving mouse with pressed left button into button 4. wxRadioBox::SetSelection() and wxRadioButton::SetValue() clear the values of the other buttons in the same radio group 5. wxTextCtrl::RefreshPixelRange() calculates the end of line correctly 6. tons of wxListBox fixes 7. removed confusing "Create" button from the lbox sample, listbox is now recreated on the fly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -245,6 +245,7 @@ void wxListBox::DoClear()
|
||||
}
|
||||
|
||||
m_itemsClientData.Clear();
|
||||
m_selections.Clear();
|
||||
}
|
||||
|
||||
void wxListBox::Clear()
|
||||
@@ -371,6 +372,9 @@ void wxListBox::SetSelection(int n, bool select)
|
||||
}
|
||||
//else: not selected
|
||||
}
|
||||
|
||||
wxASSERT_MSG( HasMultipleSelection() || (m_selections.GetCount() < 2),
|
||||
_T("multiple selected items in single selection lbox?") );
|
||||
}
|
||||
|
||||
int wxListBox::GetSelection() const
|
||||
@@ -390,9 +394,15 @@ int wxListBox::GetSelections(wxArrayInt& selections) const
|
||||
{
|
||||
// always return sorted array to the user
|
||||
selections = m_selections;
|
||||
selections.Sort(wxCompareInts);
|
||||
size_t count = m_selections.GetCount();
|
||||
|
||||
return m_selections.GetCount();
|
||||
// don't call sort on an empty array
|
||||
if ( count )
|
||||
{
|
||||
selections.Sort(wxCompareInts);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -401,18 +411,6 @@ int wxListBox::GetSelections(wxArrayInt& selections) const
|
||||
// added/deleted/changed subsequently
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxListBox::Refresh(bool eraseBackground, const wxRect *rect)
|
||||
{
|
||||
if ( rect )
|
||||
wxLogTrace(_T("listbox"), _T("Refreshing (%d, %d)-(%d, %d)"),
|
||||
rect->x, rect->y,
|
||||
rect->x + rect->width, rect->y + rect->height);
|
||||
else
|
||||
wxLogTrace(_T("listbox"), _T("Refreshing all"));
|
||||
|
||||
wxControl::Refresh(eraseBackground, rect);
|
||||
}
|
||||
|
||||
void wxListBox::RefreshFromItemToEnd(int from)
|
||||
{
|
||||
RefreshItems(from, GetCount() - from);
|
||||
@@ -515,9 +513,12 @@ void wxListBox::UpdateScrollbars()
|
||||
|
||||
// what should be the scrollbar range now?
|
||||
int scrollRangeX = showScrollbarX
|
||||
? (maxWidth + 2*charWidth - 1) / charWidth
|
||||
? (maxWidth + charWidth - 1) / charWidth + 2 // FIXME
|
||||
: 0;
|
||||
int scrollRangeY = showScrollbarY
|
||||
? nLines +
|
||||
(size.y % lineHeight + lineHeight - 1) / lineHeight
|
||||
: 0;
|
||||
int scrollRangeY = showScrollbarY ? nLines : 0;
|
||||
|
||||
// reset scrollbars if something changed: either the visibility status
|
||||
// or the range of a scrollbar which is shown
|
||||
@@ -558,7 +559,10 @@ void wxListBox::UpdateItems()
|
||||
rect.height = size.y;
|
||||
rect.y += m_updateFrom*GetLineHeight();
|
||||
rect.height = m_updateCount*GetLineHeight();
|
||||
CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y);
|
||||
|
||||
// we don't need to calculate x position as we always refresh the
|
||||
// entire line(s)
|
||||
CalcScrolledPosition(0, rect.y, NULL, &rect.y);
|
||||
|
||||
wxLogTrace(_T("listbox"), _T("Refreshing items %d..%d (%d-%d)"),
|
||||
m_updateFrom, m_updateFrom + m_updateCount - 1,
|
||||
@@ -948,8 +952,15 @@ void wxListBox::Activate(int item)
|
||||
{
|
||||
if ( item != -1 )
|
||||
SetCurrentItem(item);
|
||||
else
|
||||
item = m_current;
|
||||
|
||||
if ( m_current != -1 )
|
||||
if ( !(GetWindowStyle() & wxLB_MULTIPLE) )
|
||||
{
|
||||
DeselectAll(item);
|
||||
}
|
||||
|
||||
if ( item != -1 )
|
||||
{
|
||||
Select();
|
||||
|
||||
|
Reference in New Issue
Block a user