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