wxListBox input handling works for single and multi selection ones (not

extended yet)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8242 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-09-02 20:16:04 +00:00
parent afcd76dae8
commit 4d437f4b2b
9 changed files with 284 additions and 51 deletions

View File

@@ -578,14 +578,22 @@ void wxControlRenderer::DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
void wxControlRenderer::DrawItems(const wxListBox *lbox,
size_t itemFirst, size_t itemLast)
{
// prepare for the drawing: calc the initial position
wxCoord lineHeight = lbox->GetLineHeight();
int lines, pixelsPerLine;
lbox->GetViewStart(NULL, &lines);
lbox->GetScrollPixelsPerUnit(NULL, &pixelsPerLine);
wxRect rect = m_rect;
rect.y += itemFirst*lineHeight;
rect.y += itemFirst*lineHeight - lines*pixelsPerLine;
rect.height = lineHeight;
// an item should have the focused rect only when the app has focus, so
// make sure that we never set wxCONTROL_FOCUSED flag if it doesn't
int itemCurrent = wxTheApp->IsActive() ? lbox->GetCurrentItem() : -1;
for ( size_t n = itemFirst; n < itemLast; n++ )
{
int flags = 0;
if ( (int)n == lbox->GetCurrentItem() )
if ( (int)n == itemCurrent )
flags |= wxCONTROL_FOCUSED;
if ( lbox->IsSelected(n) )
flags |= wxCONTROL_SELECTED;