]> git.saurik.com Git - wxWidgets.git/blob - src/msw/listbox.cpp
fd17da4b4177f57c1f995954b38b48d646106ec2
[wxWidgets.git] / src / msw / listbox.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/listbox.cpp
3 // Purpose: wxListBox
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin (owner drawn stuff)
6 // Created:
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #if wxUSE_LISTBOX
20
21 #include "wx/listbox.h"
22
23 #ifndef WX_PRECOMP
24 #include "wx/dynarray.h"
25 #include "wx/settings.h"
26 #include "wx/brush.h"
27 #include "wx/font.h"
28 #include "wx/dc.h"
29 #include "wx/utils.h"
30 #include "wx/log.h"
31 #include "wx/window.h"
32 #endif
33
34 #include "wx/msw/private.h"
35 #include "wx/msw/dc.h"
36
37 #include <windowsx.h>
38
39 #if wxUSE_OWNER_DRAWN
40 #include "wx/ownerdrw.h"
41 #endif
42
43 // ============================================================================
44 // list box item declaration and implementation
45 // ============================================================================
46
47 #if wxUSE_OWNER_DRAWN
48
49 class wxListBoxItem : public wxOwnerDrawn
50 {
51 public:
52 wxListBoxItem(wxListBox *parent)
53 { m_parent = parent; }
54
55 wxListBox *GetParent() const
56 { return m_parent; }
57
58 int GetIndex() const
59 { return m_parent->GetItemIndex(const_cast<wxListBoxItem*>(this)); }
60
61 wxString GetName() const
62 { return m_parent->GetString(GetIndex()); }
63
64 private:
65 wxListBox *m_parent;
66 };
67
68 wxOwnerDrawn *wxListBox::CreateLboxItem(size_t WXUNUSED(n))
69 {
70 return new wxListBoxItem(this);
71 }
72
73 #endif //USE_OWNER_DRAWN
74
75 // ============================================================================
76 // list box control implementation
77 // ============================================================================
78
79 // ----------------------------------------------------------------------------
80 // creation
81 // ----------------------------------------------------------------------------
82
83 void wxListBox::Init()
84 {
85 m_noItems = 0;
86 m_updateHorizontalExtent = false;
87 m_selectedByKeyboard = false;
88 }
89
90 bool wxListBox::Create(wxWindow *parent,
91 wxWindowID id,
92 const wxPoint& pos,
93 const wxSize& size,
94 int n, const wxString choices[],
95 long style,
96 const wxValidator& validator,
97 const wxString& name)
98 {
99 // initialize base class fields
100 if ( !CreateControl(parent, id, pos, size, style, validator, name) )
101 return false;
102
103 // create the native control
104 if ( !MSWCreateControl(wxT("LISTBOX"), wxEmptyString, pos, size) )
105 {
106 // control creation failed
107 return false;
108 }
109
110 // initialize the contents
111 for ( int i = 0; i < n; i++ )
112 {
113 Append(choices[i]);
114 }
115
116 // now we can compute our best size correctly, so do it again
117 SetInitialSize(size);
118
119 return true;
120 }
121
122 bool wxListBox::Create(wxWindow *parent,
123 wxWindowID id,
124 const wxPoint& pos,
125 const wxSize& size,
126 const wxArrayString& choices,
127 long style,
128 const wxValidator& validator,
129 const wxString& name)
130 {
131 wxCArrayString chs(choices);
132 return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
133 style, validator, name);
134 }
135
136 wxListBox::~wxListBox()
137 {
138 Clear();
139 }
140
141 WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const
142 {
143 WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
144
145 // we always want to get the notifications
146 msStyle |= LBS_NOTIFY;
147
148 // without this style, you get unexpected heights, so e.g. constraint
149 // layout doesn't work properly
150 msStyle |= LBS_NOINTEGRALHEIGHT;
151
152 wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
153 wxT("only one of listbox selection modes can be specified") );
154
155 if ( style & wxLB_MULTIPLE )
156 msStyle |= LBS_MULTIPLESEL;
157 else if ( style & wxLB_EXTENDED )
158 msStyle |= LBS_EXTENDEDSEL;
159
160 wxASSERT_MSG( !(style & wxLB_ALWAYS_SB) || !(style & wxLB_NO_SB),
161 wxT( "Conflicting styles wxLB_ALWAYS_SB and wxLB_NO_SB." ) );
162
163 if ( !(style & wxLB_NO_SB) )
164 {
165 msStyle |= WS_VSCROLL;
166 if ( style & wxLB_ALWAYS_SB )
167 msStyle |= LBS_DISABLENOSCROLL;
168 }
169
170 if ( m_windowStyle & wxLB_HSCROLL )
171 msStyle |= WS_HSCROLL;
172 if ( m_windowStyle & wxLB_SORT )
173 msStyle |= LBS_SORT;
174
175 #if wxUSE_OWNER_DRAWN && !defined(__WXWINCE__)
176 if ( m_windowStyle & wxLB_OWNERDRAW )
177 {
178 // we don't support LBS_OWNERDRAWVARIABLE yet and we also always put
179 // the strings in the listbox for simplicity even though we could have
180 // avoided it in this case
181 msStyle |= LBS_OWNERDRAWFIXED | LBS_HASSTRINGS;
182 }
183 #endif // wxUSE_OWNER_DRAWN
184
185 return msStyle;
186 }
187
188 void wxListBox::OnInternalIdle()
189 {
190 wxWindow::OnInternalIdle();
191
192 if (m_updateHorizontalExtent)
193 {
194 SetHorizontalExtent(wxEmptyString);
195 m_updateHorizontalExtent = false;
196 }
197 }
198
199 void wxListBox::MSWOnItemsChanged()
200 {
201 // we need to do two things when items change: update their max horizontal
202 // extent so that horizontal scrollbar could be shown or hidden as
203 // appropriate and also invlaidate the best size
204 //
205 // updating the max extent is slow (it's an O(N) operation) and so we defer
206 // it until the idle time but the best size should be invalidated
207 // immediately doing it in idle time is too late -- layout using incorrect
208 // old best size will have been already done by then
209
210 m_updateHorizontalExtent = true;
211
212 InvalidateBestSize();
213 }
214
215 // ----------------------------------------------------------------------------
216 // implementation of wxListBoxBase methods
217 // ----------------------------------------------------------------------------
218
219 void wxListBox::DoSetFirstItem(int N)
220 {
221 wxCHECK_RET( IsValid(N),
222 wxT("invalid index in wxListBox::SetFirstItem") );
223
224 SendMessage(GetHwnd(), LB_SETTOPINDEX, (WPARAM)N, (LPARAM)0);
225 }
226
227 void wxListBox::DoDeleteOneItem(unsigned int n)
228 {
229 wxCHECK_RET( IsValid(n),
230 wxT("invalid index in wxListBox::Delete") );
231
232 #if wxUSE_OWNER_DRAWN
233 if ( HasFlag(wxLB_OWNERDRAW) )
234 {
235 delete m_aItems[n];
236 m_aItems.RemoveAt(n);
237 }
238 #endif // wxUSE_OWNER_DRAWN
239
240 SendMessage(GetHwnd(), LB_DELETESTRING, n, 0);
241 m_noItems--;
242
243 MSWOnItemsChanged();
244
245 UpdateOldSelections();
246 }
247
248 int wxListBox::FindString(const wxString& s, bool bCase) const
249 {
250 // back to base class search for not native search type
251 if (bCase)
252 return wxItemContainerImmutable::FindString( s, bCase );
253
254 int pos = ListBox_FindStringExact(GetHwnd(), -1, s.wx_str());
255 if (pos == LB_ERR)
256 return wxNOT_FOUND;
257 else
258 return pos;
259 }
260
261 void wxListBox::DoClear()
262 {
263 #if wxUSE_OWNER_DRAWN
264 if ( HasFlag(wxLB_OWNERDRAW) )
265 {
266 WX_CLEAR_ARRAY(m_aItems);
267 }
268 #endif // wxUSE_OWNER_DRAWN
269
270 ListBox_ResetContent(GetHwnd());
271
272 m_noItems = 0;
273 MSWOnItemsChanged();
274
275 UpdateOldSelections();
276 }
277
278 void wxListBox::DoSetSelection(int N, bool select)
279 {
280 wxCHECK_RET( N == wxNOT_FOUND || IsValid(N),
281 wxT("invalid index in wxListBox::SetSelection") );
282
283 if ( HasMultipleSelection() )
284 {
285 // Setting selection to -1 should deselect everything.
286 const bool deselectAll = N == wxNOT_FOUND;
287 SendMessage(GetHwnd(), LB_SETSEL,
288 deselectAll ? FALSE : select,
289 deselectAll ? -1 : N);
290 }
291 else
292 {
293 SendMessage(GetHwnd(), LB_SETCURSEL, select ? N : -1, 0);
294 }
295
296 UpdateOldSelections();
297 }
298
299 bool wxListBox::IsSelected(int N) const
300 {
301 wxCHECK_MSG( IsValid(N), false,
302 wxT("invalid index in wxListBox::Selected") );
303
304 return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? false : true;
305 }
306
307 void *wxListBox::DoGetItemClientData(unsigned int n) const
308 {
309 LPARAM rc = SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
310 if ( rc == LB_ERR && GetLastError() != ERROR_SUCCESS )
311 {
312 wxLogLastError(wxT("LB_GETITEMDATA"));
313
314 return NULL;
315 }
316
317 return (void *)rc;
318 }
319
320 void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
321 {
322 if ( ListBox_SetItemData(GetHwnd(), n, clientData) == LB_ERR )
323 {
324 wxLogDebug(wxT("LB_SETITEMDATA failed"));
325 }
326 }
327
328 // Return number of selections and an array of selected integers
329 int wxListBox::GetSelections(wxArrayInt& aSelections) const
330 {
331 aSelections.Empty();
332
333 if ( HasMultipleSelection() )
334 {
335 int countSel = ListBox_GetSelCount(GetHwnd());
336 if ( countSel == LB_ERR )
337 {
338 wxLogDebug(wxT("ListBox_GetSelCount failed"));
339 }
340 else if ( countSel != 0 )
341 {
342 int *selections = new int[countSel];
343
344 if ( ListBox_GetSelItems(GetHwnd(),
345 countSel, selections) == LB_ERR )
346 {
347 wxLogDebug(wxT("ListBox_GetSelItems failed"));
348 countSel = -1;
349 }
350 else
351 {
352 aSelections.Alloc(countSel);
353 for ( int n = 0; n < countSel; n++ )
354 aSelections.Add(selections[n]);
355 }
356
357 delete [] selections;
358 }
359
360 return countSel;
361 }
362 else // single-selection listbox
363 {
364 if (ListBox_GetCurSel(GetHwnd()) > -1)
365 aSelections.Add(ListBox_GetCurSel(GetHwnd()));
366
367 return aSelections.Count();
368 }
369 }
370
371 // Get single selection, for single choice list items
372 int wxListBox::GetSelection() const
373 {
374 wxCHECK_MSG( !HasMultipleSelection(),
375 -1,
376 wxT("GetSelection() can't be used with multiple-selection listboxes, use GetSelections() instead.") );
377
378 return ListBox_GetCurSel(GetHwnd());
379 }
380
381 // Find string for position
382 wxString wxListBox::GetString(unsigned int n) const
383 {
384 wxCHECK_MSG( IsValid(n), wxEmptyString,
385 wxT("invalid index in wxListBox::GetString") );
386
387 int len = ListBox_GetTextLen(GetHwnd(), n);
388
389 // +1 for terminating NUL
390 wxString result;
391 ListBox_GetText(GetHwnd(), n, (wxChar*)wxStringBuffer(result, len + 1));
392
393 return result;
394 }
395
396 int wxListBox::DoInsertItems(const wxArrayStringsAdapter & items,
397 unsigned int pos,
398 void **clientData,
399 wxClientDataType type)
400 {
401 MSWAllocStorage(items, LB_INITSTORAGE);
402
403 const bool append = pos == GetCount();
404
405 // we must use CB_ADDSTRING when appending as only it works correctly for
406 // the sorted controls
407 const unsigned msg = append ? LB_ADDSTRING : LB_INSERTSTRING;
408
409 if ( append )
410 pos = 0;
411
412 int n = wxNOT_FOUND;
413
414 const unsigned int numItems = items.GetCount();
415 for ( unsigned int i = 0; i < numItems; i++ )
416 {
417 n = MSWInsertOrAppendItem(pos, items[i], msg);
418 if ( n == wxNOT_FOUND )
419 return n;
420
421 if ( !append )
422 pos++;
423
424 ++m_noItems;
425
426 #if wxUSE_OWNER_DRAWN
427 if ( HasFlag(wxLB_OWNERDRAW) )
428 {
429 wxOwnerDrawn *pNewItem = CreateLboxItem(n);
430 pNewItem->SetFont(GetFont());
431 m_aItems.Insert(pNewItem, n);
432 }
433 #endif // wxUSE_OWNER_DRAWN
434 AssignNewItemClientData(n, clientData, i, type);
435 }
436
437 MSWOnItemsChanged();
438
439 UpdateOldSelections();
440
441 return n;
442 }
443
444 int wxListBox::DoHitTestList(const wxPoint& point) const
445 {
446 LRESULT lRes = ::SendMessage(GetHwnd(), LB_ITEMFROMPOINT,
447 0, MAKELPARAM(point.x, point.y));
448
449 // non zero high-order word means that this item is outside of the client
450 // area, IOW the point is outside of the listbox
451 return HIWORD(lRes) ? wxNOT_FOUND : LOWORD(lRes);
452 }
453
454 void wxListBox::SetString(unsigned int n, const wxString& s)
455 {
456 wxCHECK_RET( IsValid(n),
457 wxT("invalid index in wxListBox::SetString") );
458
459 // remember the state of the item
460 bool wasSelected = IsSelected(n);
461
462 void *oldData = NULL;
463 wxClientData *oldObjData = NULL;
464 if ( HasClientUntypedData() )
465 oldData = GetClientData(n);
466 else if ( HasClientObjectData() )
467 oldObjData = GetClientObject(n);
468
469 // delete and recreate it
470 SendMessage(GetHwnd(), LB_DELETESTRING, n, 0);
471
472 int newN = n;
473 if ( n == (m_noItems - 1) )
474 newN = -1;
475
476 ListBox_InsertString(GetHwnd(), newN, s.wx_str());
477
478 // restore the client data
479 if ( oldData )
480 SetClientData(n, oldData);
481 else if ( oldObjData )
482 SetClientObject(n, oldObjData);
483
484 // we may have lost the selection
485 if ( wasSelected )
486 Select(n);
487
488 MSWOnItemsChanged();
489 }
490
491 unsigned int wxListBox::GetCount() const
492 {
493 return m_noItems;
494 }
495
496 // ----------------------------------------------------------------------------
497 // size-related stuff
498 // ----------------------------------------------------------------------------
499
500 void wxListBox::SetHorizontalExtent(const wxString& s)
501 {
502 // the rest is only necessary if we want a horizontal scrollbar
503 if ( !HasFlag(wxHSCROLL) )
504 return;
505
506
507 WindowHDC dc(GetHwnd());
508 SelectInHDC selFont(dc, GetHfontOf(GetFont()));
509
510 TEXTMETRIC lpTextMetric;
511 ::GetTextMetrics(dc, &lpTextMetric);
512
513 int largestExtent = 0;
514 SIZE extentXY;
515
516 if ( s.empty() )
517 {
518 // set extent to the max length of all strings
519 for ( unsigned int i = 0; i < m_noItems; i++ )
520 {
521 const wxString str = GetString(i);
522 ::GetTextExtentPoint32(dc, str.c_str(), str.length(), &extentXY);
523
524 int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
525 if ( extentX > largestExtent )
526 largestExtent = extentX;
527 }
528 }
529 else // just increase the extent to the length of this string
530 {
531 int existingExtent = (int)SendMessage(GetHwnd(),
532 LB_GETHORIZONTALEXTENT, 0, 0L);
533
534 ::GetTextExtentPoint32(dc, s.c_str(), s.length(), &extentXY);
535
536 int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
537 if ( extentX > existingExtent )
538 largestExtent = extentX;
539 }
540
541 if ( largestExtent )
542 SendMessage(GetHwnd(), LB_SETHORIZONTALEXTENT, LOWORD(largestExtent), 0L);
543 //else: it shouldn't change
544 }
545
546 wxSize wxListBox::DoGetBestClientSize() const
547 {
548 // find the widest string
549 int wLine;
550 int wListbox = 0;
551 for (unsigned int i = 0; i < m_noItems; i++)
552 {
553 wxString str(GetString(i));
554 GetTextExtent(str, &wLine, NULL);
555 if ( wLine > wListbox )
556 wListbox = wLine;
557 }
558
559 // give it some reasonable default value if there are no strings in the
560 // list
561 if ( wListbox == 0 )
562 wListbox = 100;
563
564 // the listbox should be slightly larger than the widest string
565 wListbox += 3*GetCharWidth();
566
567 // add room for the scrollbar
568 wListbox += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
569
570 // don't make the listbox too tall (limit height to 10 items) but don't
571 // make it too small neither
572 int hListbox = SendMessage(GetHwnd(), LB_GETITEMHEIGHT, 0, 0)*
573 wxMin(wxMax(m_noItems, 3), 10);
574
575 return wxSize(wListbox, hListbox);
576 }
577
578 // ----------------------------------------------------------------------------
579 // callbacks
580 // ----------------------------------------------------------------------------
581
582 bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
583 {
584 wxEventType evtType;
585 int n = wxNOT_FOUND;
586 if ( param == LBN_SELCHANGE )
587 {
588 if ( HasMultipleSelection() )
589 return CalcAndSendEvent();
590
591 evtType = wxEVT_COMMAND_LISTBOX_SELECTED;
592
593 if ( m_selectedByKeyboard )
594 {
595 // We shouldn't use the mouse position to find the item as mouse
596 // can be anywhere, ask the listbox itself. Notice that this can't
597 // be used when the item is selected using the mouse however as
598 // LB_GETCARETINDEX will always return a valid item, even if the
599 // mouse is clicked below all the items, which is why we find the
600 // item ourselves below in this case.
601 n = SendMessage(GetHwnd(), LB_GETCARETINDEX, 0, 0);
602 }
603 //else: n will be determined below from the mouse position
604 }
605 else if ( param == LBN_DBLCLK )
606 {
607 evtType = wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
608 }
609 else
610 {
611 // some event we're not interested in
612 return false;
613 }
614
615 // Find the item position if it was a mouse-generated selection event or a
616 // double click event (which is always generated using the mouse)
617 if ( n == wxNOT_FOUND )
618 {
619 const DWORD pos = ::GetMessagePos();
620 const wxPoint pt(GET_X_LPARAM(pos), GET_Y_LPARAM(pos));
621 n = HitTest(ScreenToClient(wxPoint(pt)));
622 }
623
624 // We get events even when mouse is clicked outside of any valid item from
625 // Windows, just ignore them.
626 if ( n == wxNOT_FOUND )
627 return false;
628
629 if ( param == LBN_SELCHANGE )
630 {
631 if ( !DoChangeSingleSelection(n) )
632 return false;
633 }
634
635 // Do generate an event otherwise.
636 return SendEvent(evtType, n, true /* selection */);
637 }
638
639 WXLRESULT
640 wxListBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
641 {
642 // Remember whether there was a keyboard or mouse event before
643 // LBN_SELCHANGE: this allows us to correctly determine the item affected
644 // by it in MSWCommand() above in any case.
645 if ( WM_KEYFIRST <= nMsg && nMsg <= WM_KEYLAST )
646 m_selectedByKeyboard = true;
647 else if ( WM_MOUSEFIRST <= nMsg && nMsg <= WM_MOUSELAST )
648 m_selectedByKeyboard = false;
649
650 return wxListBoxBase::MSWWindowProc(nMsg, wParam, lParam);
651 }
652
653 // ----------------------------------------------------------------------------
654 // owner-drawn list boxes support
655 // ----------------------------------------------------------------------------
656
657 #if wxUSE_OWNER_DRAWN
658
659 // misc overloaded methods
660 // -----------------------
661
662 bool wxListBox::SetFont(const wxFont &font)
663 {
664 if ( HasFlag(wxLB_OWNERDRAW) )
665 {
666 const unsigned count = m_aItems.GetCount();
667 for ( unsigned i = 0; i < count; i++ )
668 m_aItems[i]->SetFont(font);
669 }
670
671 wxListBoxBase::SetFont(font);
672
673 return true;
674 }
675
676 bool wxListBox::GetItemRect(size_t n, wxRect& rect) const
677 {
678 wxCHECK_MSG( IsValid(n), false,
679 wxT("invalid index in wxListBox::GetItemRect") );
680
681 RECT rc;
682
683 if ( ListBox_GetItemRect(GetHwnd(), n, &rc) != LB_ERR )
684 {
685 rect = wxRectFromRECT(rc);
686 return true;
687 }
688 else
689 {
690 // couldn't retrieve rect: for example, item isn't visible
691 return false;
692 }
693 }
694
695 bool wxListBox::RefreshItem(size_t n)
696 {
697 wxRect rect;
698 if ( !GetItemRect(n, rect) )
699 return false;
700
701 RECT rc;
702 wxCopyRectToRECT(rect, rc);
703
704 return ::InvalidateRect((HWND)GetHWND(), &rc, FALSE) == TRUE;
705 }
706
707
708 // drawing
709 // -------
710
711 namespace
712 {
713 // space beneath/above each row in pixels
714 static const int LISTBOX_EXTRA_SPACE = 1;
715
716 } // anonymous namespace
717
718 // the height is the same for all items
719 // TODO should be changed for LBS_OWNERDRAWVARIABLE style listboxes
720
721 // NB: can't forward this to wxListBoxItem because LB_SETITEMDATA
722 // message is not yet sent when we get here!
723 bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
724 {
725 // only owner-drawn control should receive this message
726 wxCHECK( HasFlag(wxLB_OWNERDRAW), false );
727
728 MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item;
729
730 #ifdef __WXWINCE__
731 HDC hdc = GetDC(NULL);
732 #else
733 HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0);
734 #endif
735
736 {
737 wxDCTemp dc((WXHDC)hdc);
738 dc.SetFont(GetFont());
739
740 pStruct->itemHeight = dc.GetCharHeight() + 2 * LISTBOX_EXTRA_SPACE;
741 pStruct->itemWidth = dc.GetCharWidth();
742 }
743
744 #ifdef __WXWINCE__
745 ReleaseDC(NULL, hdc);
746 #else
747 DeleteDC(hdc);
748 #endif
749
750 return true;
751 }
752
753 // forward the message to the appropriate item
754 bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
755 {
756 // only owner-drawn control should receive this message
757 wxCHECK( HasFlag(wxLB_OWNERDRAW), false );
758
759 DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item;
760
761 // the item may be -1 for an empty listbox
762 if ( pStruct->itemID == (UINT)-1 )
763 return false;
764
765 wxListBoxItem *pItem = (wxListBoxItem *)m_aItems[pStruct->itemID];
766
767 wxDCTemp dc((WXHDC)pStruct->hDC);
768
769 return pItem->OnDrawItem(dc, wxRectFromRECT(pStruct->rcItem),
770 (wxOwnerDrawn::wxODAction)pStruct->itemAction,
771 (wxOwnerDrawn::wxODStatus)(pStruct->itemState | wxOwnerDrawn::wxODHidePrefix));
772 }
773
774 #endif // wxUSE_OWNER_DRAWN
775
776 #endif // wxUSE_LISTBOX