]> git.saurik.com Git - wxWidgets.git/blob - src/os2/listbox.cpp
toplevel fixes to deal with base class fixes. Create interface change to support...
[wxWidgets.git] / src / os2 / listbox.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: listbox.cpp
3 // Purpose: wxListBox
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/09/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #include "wx/window.h"
16 #include "wx/os2/private.h"
17
18 #ifndef WX_PRECOMP
19 #include "wx/listbox.h"
20 #include "wx/settings.h"
21 #include "wx/brush.h"
22 #include "wx/font.h"
23 #include "wx/dc.h"
24 #include "wx/utils.h"
25 #endif
26
27 #define INCL_M
28 #include <os2.h>
29
30 #include "wx/dynarray.h"
31 #include "wx/log.h"
32
33 #if wxUSE_LISTBOX
34
35 #if wxUSE_OWNER_DRAWN
36 #include "wx/ownerdrw.h"
37 #endif
38
39 IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
40
41 // ============================================================================
42 // list box item declaration and implementation
43 // ============================================================================
44
45 #if wxUSE_OWNER_DRAWN
46
47 class wxListBoxItem : public wxOwnerDrawn
48 {
49 public:
50 wxListBoxItem(const wxString& rsStr = "");
51 };
52
53 wxListBoxItem::wxListBoxItem(
54 const wxString& rsStr
55 )
56 : wxOwnerDrawn( rsStr
57 ,FALSE
58 )
59 {
60 //
61 // No bitmaps/checkmarks
62 //
63 SetMarginWidth(0);
64 } // end of wxListBoxItem::wxListBoxItem
65
66 wxOwnerDrawn* wxListBox::CreateItem(
67 size_t n
68 )
69 {
70 return new wxListBoxItem();
71 } // end of wxListBox::CreateItem
72
73 #endif //USE_OWNER_DRAWN
74
75 // ============================================================================
76 // list box control implementation
77 // ============================================================================
78
79 // Listbox item
80 wxListBox::wxListBox()
81 {
82 m_nNumItems = 0;
83 m_nSelected = 0;
84 } // end of wxListBox::wxListBox
85
86 bool wxListBox::Create(
87 wxWindow* pParent
88 , wxWindowID vId
89 , const wxPoint& rPos
90 , const wxSize& rSize
91 , int n
92 , const wxString asChoices[]
93 , long lStyle
94 #if wxUSE_VALIDATORS
95 , const wxValidator& rValidator
96 #endif
97 , const wxString& rsName
98 )
99 {
100 m_nNumItems = 0;
101 m_hWnd = 0;
102 m_nSelected = 0;
103
104 SetName(rsName);
105 #if wxUSE_VALIDATORS
106 SetValidator(rValidator);
107 #endif
108
109 if (pParent)
110 pParent->AddChild(this);
111
112 wxSystemSettings vSettings;
113
114 SetBackgroundColour(vSettings.GetSystemColour(wxSYS_COLOUR_WINDOW));
115 SetForegroundColour(pParent->GetForegroundColour());
116
117 m_windowId = (vId == -1) ? (int)NewControlId() : vId;
118
119 int nX = rPos.x;
120 int nY = rPos.y;
121 int nWidth = rSize.x;
122 int nHeight = rSize.y;
123
124 m_windowStyle = lStyle;
125
126 lStyle = WS_VISIBLE;
127
128 if (m_windowStyle & wxCLIP_SIBLINGS )
129 lStyle |= WS_CLIPSIBLINGS;
130 if (m_windowStyle & wxLB_MULTIPLE)
131 lStyle |= LS_MULTIPLESEL;
132 else if (m_windowStyle & wxLB_EXTENDED)
133 lStyle |= LS_EXTENDEDSEL;
134 if (m_windowStyle & wxLB_HSCROLL)
135 lStyle |= LS_HORZSCROLL;
136 if (m_windowStyle & wxLB_OWNERDRAW)
137 lStyle |= LS_OWNERDRAW;
138
139 //
140 // Without this style, you get unexpected heights, so e.g. constraint layout
141 // doesn't work properly
142 //
143 lStyle |= LS_NOADJUSTPOS;
144
145 //
146 // If the parent is a scrolled window the controls must
147 // have this style or they will overlap the scrollbars
148 //
149 if (pParent)
150 if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
151 pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
152 lStyle |= WS_CLIPSIBLINGS;
153
154 m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent) // Parent
155 ,WC_LISTBOX // Default Listbox class
156 ,"LISTBOX" // Control's name
157 ,lStyle // Initial Style
158 ,0, 0, 0, 0 // Position and size
159 ,GetWinHwnd(pParent) // Owner
160 ,HWND_TOP // Z-Order
161 ,(HMENU)m_windowId // Id
162 ,NULL // Control Data
163 ,NULL // Presentation Parameters
164 );
165 if (m_hWnd == 0)
166 {
167 return FALSE;
168 }
169
170 //
171 // Subclass again for purposes of dialog editing mode
172 //
173 SubclassWin(m_hWnd);
174
175 LONG lUi;
176
177 for (lUi = 0; lUi < (LONG)n; lUi++)
178 {
179 Append(asChoices[lUi]);
180 }
181 SetFont(pParent->GetFont());
182
183 //
184 // Set standard wxWindows colors for Listbox items and highlighting
185 //
186 wxColour vColour;
187
188 vColour.Set(wxString("WHITE"));
189
190 LONG lColor = (LONG)vColour.GetPixel();
191
192 ::WinSetPresParam( m_hWnd
193 ,PP_HILITEFOREGROUNDCOLOR
194 ,sizeof(LONG)
195 ,(PVOID)&lColor
196 );
197 vColour.Set(wxString("NAVY"));
198 lColor = (LONG)vColour.GetPixel();
199 ::WinSetPresParam( m_hWnd
200 ,PP_HILITEBACKGROUNDCOLOR
201 ,sizeof(LONG)
202 ,(PVOID)&lColor
203 );
204
205 SetSize( nX
206 ,nY
207 ,nWidth
208 ,nHeight
209 );
210 return TRUE;
211 } // end of wxListBox::Create
212
213 wxListBox::~wxListBox()
214 {
215 #if wxUSE_OWNER_DRAWN
216 size_t lUiCount = m_aItems.Count();
217
218 while (lUiCount-- != 0)
219 {
220 delete m_aItems[lUiCount];
221 }
222 #endif // wxUSE_OWNER_DRAWN
223 } // end of wxListBox::~wxListBox
224
225 void wxListBox::SetupColours()
226 {
227 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
228 SetForegroundColour(GetParent()->GetForegroundColour());
229 } // end of wxListBox::SetupColours
230
231 // ----------------------------------------------------------------------------
232 // implementation of wxListBoxBase methods
233 // ----------------------------------------------------------------------------
234
235 void wxListBox::DoSetFirstItem(
236 int N
237 )
238 {
239 wxCHECK_RET( N >= 0 && N < m_nNumItems,
240 wxT("invalid index in wxListBox::SetFirstItem") );
241
242 ::WinSendMsg(GetHwnd(), LM_SETTOPINDEX, MPFROMLONG(N), (MPARAM)0);
243 } // end of wxListBox::DoSetFirstItem
244
245 void wxListBox::Delete(
246 int N
247 )
248 {
249 wxCHECK_RET( N >= 0 && N < m_nNumItems,
250 wxT("invalid index in wxListBox::Delete") );
251
252 #if wxUSE_OWNER_DRAWN
253 delete m_aItems[N];
254 m_aItems.RemoveAt(N);
255 #else // !wxUSE_OWNER_DRAWN
256 if (HasClientObjectData())
257 {
258 delete GetClientObject(N);
259 }
260 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
261
262 ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)N, (MPARAM)0);
263 m_nNumItems--;
264 } // end of wxListBox::DoSetFirstItem
265
266 int wxListBox::DoAppend(
267 const wxString& rsItem
268 )
269 {
270 int nIndex = 0;
271 SHORT nIndexType = 0;
272
273 if (m_windowStyle & wxLB_SORT)
274 nIndexType = LIT_SORTASCENDING;
275 else
276 nIndexType = LIT_END;
277 nIndex = (int)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)nIndexType, (MPARAM)rsItem.c_str());
278 m_nNumItems++;
279
280 #if wxUSE_OWNER_DRAWN
281 if (m_windowStyle & wxLB_OWNERDRAW)
282 {
283 wxOwnerDrawn* pNewItem = CreateItem(nIndex); // dummy argument
284
285 pNewItem->SetName(rsItem);
286 m_aItems.Add(pNewItem);
287 ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, (MPARAM)((SHORT)nIndex), MPFROMP(pNewItem));
288 pNewItem->SetFont(GetFont());
289 }
290 #endif
291 return nIndex;
292 } // end of wxListBox::DoAppend
293
294 void wxListBox::DoSetItems(
295 const wxArrayString& raChoices
296 , void** ppClientData
297 )
298 {
299 BOOL bHideAndShow = IsShown();
300 int nCount = 0;
301 int i;
302 SHORT nIndexType = 0;
303
304 if (bHideAndShow)
305 {
306 ::WinShowWindow(GetHwnd(), FALSE);
307 }
308 ::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0);
309 m_nNumItems = raChoices.GetCount();
310 for (i = 0; i < m_nNumItems; i++)
311 {
312
313 if (m_windowStyle & wxLB_SORT)
314 nIndexType = LIT_SORTASCENDING;
315 else
316 nIndexType = LIT_END;
317 ::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)nIndexType, (MPARAM)raChoices[i].c_str());
318
319 if (ppClientData)
320 {
321 #if wxUSE_OWNER_DRAWN
322 wxASSERT_MSG(ppClientData[i] == NULL,
323 wxT("Can't use client data with owner-drawn listboxes"));
324 #else // !wxUSE_OWNER_DRAWN
325 ::WinSendMsg(WinUtil_GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(lCount), MPFROMP(ppClientData[i]));
326 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
327 }
328 }
329
330 #if wxUSE_OWNER_DRAWN
331 if ( m_windowStyle & wxLB_OWNERDRAW )
332 {
333 //
334 // First delete old items
335 //
336 size_t lUi = m_aItems.Count();
337
338 while (lUi-- != 0)
339 {
340 delete m_aItems[lUi];
341 }
342 m_aItems.Empty();
343
344 //
345 // Then create new ones
346 //
347 for (lUi = 0; lUi < (size_t)m_nNumItems; lUi++)
348 {
349 wxOwnerDrawn* pNewItem = CreateItem(lUi);
350
351 pNewItem->SetName(raChoices[lUi]);
352 m_aItems.Add(pNewItem);
353 ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(lUi), MPFROMP(pNewItem));
354 }
355 }
356 #endif // wxUSE_OWNER_DRAWN
357 ::WinShowWindow(GetHwnd(), TRUE);
358 } // end of wxListBox::DoSetItems
359
360 int wxListBox::FindString(
361 const wxString& rsString
362 ) const
363 {
364 int nPos;
365 LONG lTextLength;
366 PSZ zStr;
367
368
369 for (nPos = 0; nPos < m_nNumItems; nPos++)
370 {
371 lTextLength = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)nPos, (MPARAM)0));
372 zStr = new char[lTextLength + 1];
373 ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT(nPos, (SHORT)lTextLength), (MPARAM)zStr);
374 if (rsString == (char*)zStr)
375 {
376 delete [] zStr;
377 break;
378 }
379 delete [] zStr;
380 }
381 return nPos;
382 } // end of wxListBox::FindString
383
384 void wxListBox::Clear()
385 {
386 #if wxUSE_OWNER_DRAWN
387 size_t lUiCount = m_aItems.Count();
388
389 while (lUiCount-- != 0)
390 {
391 delete m_aItems[lUiCount];
392 }
393
394 m_aItems.Clear();
395 #else // !wxUSE_OWNER_DRAWN
396 if (HasClientObjectData())
397 {
398 for (size_t n = 0; n < (size_t)m_lNumItems; n++)
399 {
400 delete GetClientObject(n);
401 }
402 }
403 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
404 ::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0);
405
406 m_nNumItems = 0;
407 } // end of wxListBox::Clear
408
409 void wxListBox::SetSelection(
410 int N
411 , bool bSelect
412 )
413 {
414 wxCHECK_RET( N >= 0 && N < m_nNumItems,
415 wxT("invalid index in wxListBox::SetSelection") );
416 ::WinSendMsg( GetHwnd()
417 ,LM_SELECTITEM
418 ,MPFROMLONG(N)
419 ,(MPARAM)bSelect
420 );
421 } // end of wxListBox::SetSelection
422
423 bool wxListBox::IsSelected(
424 int N
425 ) const
426 {
427 wxCHECK_MSG( N >= 0 && N < m_nNumItems, FALSE,
428 wxT("invalid index in wxListBox::Selected") );
429
430 LONG lItem;
431
432 lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)N, (MPARAM)0));
433 return (lItem != LIT_NONE);
434 } // end of wxListBox::IsSelected
435
436 wxClientData* wxListBox::DoGetItemClientObject(
437 int n
438 ) const
439 {
440 return (wxClientData *)DoGetItemClientData(n);
441 }
442
443 void* wxListBox::DoGetItemClientData(
444 int n
445 ) const
446 {
447 wxCHECK_MSG( n >= 0 && n < m_nNumItems, NULL,
448 wxT("invalid index in wxListBox::GetClientData") );
449
450 return((void *)::WinSendMsg(GetHwnd(), LM_QUERYITEMHANDLE, MPFROMLONG(n), (MPARAM)0));
451 } // end of wxListBox::DoGetItemClientData
452
453 void wxListBox::DoSetItemClientObject(
454 int n
455 , wxClientData* pClientData
456 )
457 {
458 DoSetItemClientData( n
459 ,pClientData
460 );
461 } // end of wxListBox::DoSetItemClientObject
462
463 void wxListBox::DoSetItemClientData(
464 int n
465 , void* pClientData
466 )
467 {
468 wxCHECK_RET( n >= 0 && n < m_nNumItems,
469 wxT("invalid index in wxListBox::SetClientData") );
470
471 #if wxUSE_OWNER_DRAWN
472 if ( m_windowStyle & wxLB_OWNERDRAW )
473 {
474 //
475 // Client data must be pointer to wxOwnerDrawn, otherwise we would crash
476 // in OnMeasure/OnDraw.
477 //
478 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
479 }
480 #endif // wxUSE_OWNER_DRAWN
481
482 ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(n), MPFROMP(pClientData));
483 } // end of wxListBox::DoSetItemClientData
484
485 bool wxListBox::HasMultipleSelection() const
486 {
487 return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
488 } // end of wxListBox::HasMultipleSelection
489
490 int wxListBox::GetSelections(
491 wxArrayInt& raSelections
492 ) const
493 {
494 int nCount = 0;
495 LONG lItem;
496
497
498 raSelections.Empty();
499 if (HasMultipleSelection())
500 {
501 lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
502 ,LM_QUERYSELECTION
503 ,(MPARAM)LIT_FIRST
504 ,(MPARAM)0
505 )
506 );
507 if (lItem != LIT_NONE)
508 {
509 nCount++;
510 while ((lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
511 ,LM_QUERYSELECTION
512 ,(MPARAM)lItem
513 ,(MPARAM)0
514 )
515 )) != LIT_NONE)
516 {
517 nCount++;
518 }
519 raSelections.Alloc(nCount);
520 lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
521 ,LM_QUERYSELECTION
522 ,(MPARAM)LIT_FIRST
523 ,(MPARAM)0
524 )
525 );
526
527 raSelections.Add((int)lItem);
528 while ((lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
529 ,LM_QUERYSELECTION
530 ,(MPARAM)lItem
531 ,(MPARAM)0
532 )
533 )) != LIT_NONE)
534 {
535 raSelections.Add((int)lItem);
536 }
537 return nCount;
538 }
539 return 0;
540 }
541 else // single-selection listbox
542 {
543 lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
544 ,LM_QUERYSELECTION
545 ,(MPARAM)LIT_FIRST
546 ,(MPARAM)0
547 )
548 );
549 raSelections.Add((int)lItem);
550 return 1;
551 }
552 return 0;
553 } // end of wxListBox::GetSelections
554
555 int wxListBox::GetSelection() const
556 {
557 wxCHECK_MSG( !HasMultipleSelection(),
558 -1,
559 wxT("GetSelection() can't be used with multiple-selection "
560 "listboxes, use GetSelections() instead.") );
561
562 return(LONGFROMMR(::WinSendMsg( GetHwnd()
563 ,LM_QUERYSELECTION
564 ,(MPARAM)LIT_FIRST
565 ,(MPARAM)0
566 )
567 ));
568 } // end of wxListBox::GetSelection
569
570 wxString wxListBox::GetString(
571 int N
572 ) const
573 {
574 LONG lLen = 0;
575 char* zBuf;
576 wxString sResult;
577
578 wxCHECK_MSG( N >= 0 && N < m_nNumItems, "",
579 wxT("invalid index in wxListBox::GetClientData") );
580
581 lLen = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)N, (MPARAM)0));
582 zBuf = new char[lLen + 1];
583 ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT((SHORT)N, (SHORT)lLen), (MPARAM)zBuf);
584 zBuf[lLen] = '\0';
585 sResult = zBuf;
586 delete [] zBuf;
587 return sResult;
588 } // end of wxListBox::GetString
589
590 void wxListBox::DoInsertItems(
591 const wxArrayString& asItems
592 , int nPos
593 )
594 {
595 wxCHECK_RET( nPos >= 0 && nPos <= m_nNumItems,
596 wxT("invalid index in wxListBox::InsertItems") );
597
598 int nItems = asItems.GetCount();
599
600 for (int i = 0; i < nItems; i++)
601 ::WinSendMsg(GetHwnd(), LM_INSERTITEM, MPFROMLONG((LONG)(i + nPos)), (MPARAM)asItems[i].c_str());
602 m_nNumItems += nItems;
603 } // end of wxListBox::DoInsertItems
604
605 void wxListBox::SetString(
606 int N
607 , const wxString& rsString
608 )
609 {
610 wxCHECK_RET( N >= 0 && N < m_nNumItems,
611 wxT("invalid index in wxListBox::SetString") );
612
613 //
614 // Remember the state of the item
615 //
616 bool bWasSelected = IsSelected(N);
617 void* pOldData = NULL;
618 wxClientData* pOldObjData = NULL;
619
620 if (m_clientDataItemsType == wxClientData_Void)
621 pOldData = GetClientData(N);
622 else if (m_clientDataItemsType == wxClientData_Object)
623 pOldObjData = GetClientObject(N);
624
625 //
626 // Delete and recreate it
627 //
628 ::WinSendMsg( GetHwnd()
629 ,LM_DELETEITEM
630 ,(MPARAM)N
631 ,(MPARAM)0
632 );
633
634 int nNewN = N;
635
636 if (N == m_nNumItems - 1)
637 nNewN = -1;
638
639 ::WinSendMsg( GetHwnd()
640 ,LM_INSERTITEM
641 ,(MPARAM)nNewN
642 ,(MPARAM)rsString.c_str()
643 );
644
645 //
646 // Restore the client data
647 //
648 if (pOldData)
649 SetClientData( N
650 ,pOldData
651 );
652 else if (pOldObjData)
653 SetClientObject( N
654 ,pOldObjData
655 );
656
657 //
658 // We may have lost the selection
659 //
660 if (bWasSelected)
661 Select(N);
662
663 #if wxUSE_OWNER_DRAWN
664 if (m_windowStyle & wxLB_OWNERDRAW)
665 //
666 // Update item's text
667 //
668 m_aItems[N]->SetName(rsString);
669 #endif //USE_OWNER_DRAWN
670 } // end of wxListBox::SetString
671
672 int wxListBox::GetCount() const
673 {
674 return m_nNumItems;
675 }
676
677 // ----------------------------------------------------------------------------
678 // helpers
679 // ----------------------------------------------------------------------------
680
681 wxSize wxListBox::DoGetBestSize() const
682 {
683 //
684 // Find the widest string
685 //
686 int nLine;
687 int nListbox = 0;
688 int nCx;
689 int nCy;
690
691 for (int i = 0; i < m_nNumItems; i++)
692 {
693 wxString vStr(GetString(i));
694
695 GetTextExtent( vStr
696 ,&nLine
697 ,NULL
698 );
699 if (nLine > nListbox)
700 nListbox = nLine;
701 }
702
703 //
704 // Give it some reasonable default value if there are no strings in the
705 // list.
706 //
707 if (nListbox == 0)
708 nListbox = 100;
709
710 //
711 // The listbox should be slightly larger than the widest string
712 //
713 wxGetCharSize( GetHWND()
714 ,&nCx
715 ,&nCy
716 ,(wxFont*)&GetFont()
717 );
718 nListbox += 3 * nCx;
719
720 int hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy) * (wxMax(m_nNumItems, 7));
721
722 return wxSize( nListbox
723 ,hListbox
724 );
725 } // end of wxListBox::DoGetBestSize
726
727 // ----------------------------------------------------------------------------
728 // callbacks
729 // ----------------------------------------------------------------------------
730
731 bool wxListBox::OS2Command(
732 WXUINT uParam
733 , WXWORD WXUNUSED(wId))
734 {
735 wxEventType eEvtType;
736
737 if (uParam == LN_SELECT)
738 {
739 eEvtType = wxEVT_COMMAND_LISTBOX_SELECTED;
740 }
741 if (uParam == LN_ENTER)
742 {
743 eEvtType = wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
744 }
745 else
746 {
747 //
748 // Some event we're not interested in
749 //
750 return FALSE;
751 }
752 wxCommandEvent vEvent( eEvtType
753 ,m_windowId
754 );
755
756 vEvent.SetEventObject(this);
757
758 wxArrayInt aSelections;
759 int n;
760 int nCount = GetSelections(aSelections);
761
762 if (nCount > 0)
763 {
764 n = aSelections[0];
765 if (HasClientObjectData())
766 vEvent.SetClientObject(GetClientObject(n));
767 else if ( HasClientUntypedData() )
768 vEvent.SetClientData(GetClientData(n));
769 vEvent.SetString(GetString(n));
770 }
771 else
772 {
773 n = -1;
774 }
775 vEvent.m_commandInt = n;
776 return GetEventHandler()->ProcessEvent(vEvent);
777 } // end of wxListBox::OS2Command
778
779 // ----------------------------------------------------------------------------
780 // wxCheckListBox support
781 // ----------------------------------------------------------------------------
782
783 #if wxUSE_OWNER_DRAWN
784
785 //
786 // Drawing
787 // -------
788 //
789 #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1)
790
791 bool wxListBox::OS2OnMeasure(WXMEASUREITEMSTRUCT *item)
792 {
793 //
794 // TODO: Get to this eventually
795 //
796 return TRUE;
797 }
798
799 bool wxListBox::OS2OnDraw(WXDRAWITEMSTRUCT *item)
800 {
801 //
802 // TODO: Get to this eventually
803 //
804 return FALSE;
805 }
806 #endif // ndef for wxUSE_OWNER_DRAWN
807
808 #endif // ndef for wxUSE_LISTBOX
809