]> git.saurik.com Git - wxWidgets.git/blob - src/os2/listbox.cpp
Fix bug in Unix wxFileSystemWatcher implementation when watch is deleted.
[wxWidgets.git] / src / os2 / listbox.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/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 #if wxUSE_LISTBOX
16
17 #include "wx/listbox.h"
18
19 #ifndef WX_PRECOMP
20 #include "wx/dynarray.h"
21 #include "wx/settings.h"
22 #include "wx/brush.h"
23 #include "wx/font.h"
24 #include "wx/dc.h"
25 #include "wx/dcscreen.h"
26 #include "wx/utils.h"
27 #include "wx/scrolwin.h"
28 #include "wx/log.h"
29 #include "wx/window.h"
30 #endif
31
32 #include "wx/os2/dcclient.h"
33 #include "wx/os2/private.h"
34
35 #define INCL_M
36 #include <os2.h>
37
38 #if wxUSE_OWNER_DRAWN
39 #include "wx/ownerdrw.h"
40 #endif
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(wxListBox *parent)
52 { m_parent = parent; }
53
54 wxListBox *GetParent() const
55 { return m_parent; }
56
57 int GetIndex() const
58 { return m_parent->GetItemIndex(const_cast<wxListBoxItem*>(this)); }
59
60 wxString GetName() const
61 { return m_parent->GetString(GetIndex()); }
62
63 private:
64 wxListBox *m_parent;
65 };
66
67 wxOwnerDrawn* wxListBox::CreateItem( size_t WXUNUSED(n) )
68 {
69 return new wxListBoxItem(this);
70 } // end of wxListBox::CreateItem
71
72 #endif //USE_OWNER_DRAWN
73
74 // ============================================================================
75 // list box control implementation
76 // ============================================================================
77
78 // Listbox item
79 wxListBox::wxListBox()
80 {
81 m_nNumItems = 0;
82 m_nSelected = 0;
83 } // end of wxListBox::wxListBox
84
85 bool wxListBox::Create(
86 wxWindow* pParent
87 , wxWindowID vId
88 , const wxPoint& rPos
89 , const wxSize& rSize
90 , const wxArrayString& asChoices
91 , long lStyle
92 , const wxValidator& rValidator
93 , const wxString& rsName
94 )
95 {
96 wxCArrayString chs(asChoices);
97
98 return Create(pParent, vId, rPos, rSize, chs.GetCount(), chs.GetStrings(),
99 lStyle, rValidator, rsName);
100 }
101
102 bool wxListBox::Create( wxWindow* pParent,
103 wxWindowID vId,
104 const wxPoint& rPos,
105 const wxSize& rSize,
106 int n,
107 const wxString asChoices[],
108 long lStyle,
109 const wxValidator& rValidator,
110 const wxString& rsName )
111 {
112 m_nNumItems = 0;
113 m_hWnd = 0;
114 m_nSelected = 0;
115
116 SetName(rsName);
117 #if wxUSE_VALIDATORS
118 SetValidator(rValidator);
119 #endif
120
121 if (pParent)
122 pParent->AddChild(this);
123
124 wxSystemSettings vSettings;
125
126 SetBackgroundColour(vSettings.GetColour(wxSYS_COLOUR_WINDOW));
127 SetForegroundColour(pParent->GetForegroundColour());
128
129 m_windowId = (vId == -1) ? (int)NewControlId() : vId;
130
131 int nX = rPos.x;
132 int nY = rPos.y;
133 int nWidth = rSize.x;
134 int nHeight = rSize.y;
135
136 m_windowStyle = lStyle;
137
138 lStyle = WS_VISIBLE;
139
140 if (m_windowStyle & wxCLIP_SIBLINGS )
141 lStyle |= WS_CLIPSIBLINGS;
142 if (m_windowStyle & wxLB_MULTIPLE)
143 lStyle |= LS_MULTIPLESEL;
144 else if (m_windowStyle & wxLB_EXTENDED)
145 lStyle |= LS_EXTENDEDSEL;
146 if (m_windowStyle & wxLB_HSCROLL)
147 lStyle |= LS_HORZSCROLL;
148 if (m_windowStyle & wxLB_OWNERDRAW)
149 lStyle |= LS_OWNERDRAW;
150
151 //
152 // Without this style, you get unexpected heights, so e.g. constraint layout
153 // doesn't work properly
154 //
155 lStyle |= LS_NOADJUSTPOS;
156
157 m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent) // Parent
158 ,WC_LISTBOX // Default Listbox class
159 ,"LISTBOX" // Control's name
160 ,lStyle // Initial Style
161 ,0, 0, 0, 0 // Position and size
162 ,GetWinHwnd(pParent) // Owner
163 ,HWND_TOP // Z-Order
164 ,(HMENU)m_windowId // Id
165 ,NULL // Control Data
166 ,NULL // Presentation Parameters
167 );
168 if (m_hWnd == 0)
169 {
170 return false;
171 }
172
173 //
174 // Subclass again for purposes of dialog editing mode
175 //
176 SubclassWin(m_hWnd);
177
178 LONG lUi;
179
180 for (lUi = 0; lUi < (LONG)n; lUi++)
181 {
182 Append(asChoices[lUi]);
183 }
184 wxFont* pTextFont = new wxFont( 10
185 ,wxMODERN
186 ,wxNORMAL
187 ,wxNORMAL
188 );
189 SetFont(*pTextFont);
190
191 //
192 // Set OS/2 system colours for Listbox items and highlighting
193 //
194 wxColour vColour;
195
196 vColour = wxSystemSettingsNative::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
197
198 LONG lColor = (LONG)vColour.GetPixel();
199
200 ::WinSetPresParam( m_hWnd
201 ,PP_HILITEFOREGROUNDCOLOR
202 ,sizeof(LONG)
203 ,(PVOID)&lColor
204 );
205 vColour = wxSystemSettingsNative::GetColour(wxSYS_COLOUR_HIGHLIGHT);
206 lColor = (LONG)vColour.GetPixel();
207 ::WinSetPresParam( m_hWnd
208 ,PP_HILITEBACKGROUNDCOLOR
209 ,sizeof(LONG)
210 ,(PVOID)&lColor
211 );
212
213 SetXComp(0);
214 SetYComp(0);
215 SetSize( nX
216 ,nY
217 ,nWidth
218 ,nHeight
219 );
220 delete pTextFont;
221 return true;
222 } // end of wxListBox::Create
223
224 wxListBox::~wxListBox()
225 {
226 Clear();
227 } // end of wxListBox::~wxListBox
228
229 void wxListBox::SetupColours()
230 {
231 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
232 SetForegroundColour(GetParent()->GetForegroundColour());
233 } // end of wxListBox::SetupColours
234
235 // ----------------------------------------------------------------------------
236 // implementation of wxListBoxBase methods
237 // ----------------------------------------------------------------------------
238
239 void wxListBox::DoSetFirstItem(int N)
240 {
241 wxCHECK_RET( IsValid(N),
242 wxT("invalid index in wxListBox::SetFirstItem") );
243
244 ::WinSendMsg(GetHwnd(), LM_SETTOPINDEX, MPFROMLONG(N), (MPARAM)0);
245 } // end of wxListBox::DoSetFirstItem
246
247 void wxListBox::DoDeleteOneItem(unsigned int n)
248 {
249 wxCHECK_RET( IsValid(n),
250 wxT("invalid index in wxListBox::Delete") );
251
252 #if wxUSE_OWNER_DRAWN
253 delete m_aItems[n];
254 m_aItems.RemoveAt(n);
255 #endif // wxUSE_OWNER_DRAWN
256
257 ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, (MPARAM)0);
258 m_nNumItems--;
259 } // end of wxListBox::DoSetFirstItem
260
261 int wxListBox::DoInsertItems(const wxArrayStringsAdapter & items,
262 unsigned int pos,
263 void **clientData,
264 wxClientDataType type)
265 {
266 LONG lIndexType = 0;
267 bool incrementPos = false;
268
269 if (IsSorted())
270 lIndexType = LIT_SORTASCENDING;
271 else if (pos == GetCount())
272 lIndexType = LIT_END;
273 else
274 {
275 lIndexType = (LONG)pos;
276 incrementPos = true;
277 }
278
279 int n = wxNOT_FOUND;
280
281 unsigned int count = items.GetCount();
282 for (unsigned int i = 0; i < count; i++)
283 {
284 n = (int)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)items[i].wx_str());
285 if (n < 0)
286 {
287 wxLogLastError(wxT("WinSendMsg(LM_INSERTITEM)"));
288 n = wxNOT_FOUND;
289 break;
290 }
291 ++m_nNumItems;
292
293 #if wxUSE_OWNER_DRAWN
294 if (HasFlag(wxLB_OWNERDRAW))
295 {
296 wxOwnerDrawn* pNewItem = CreateItem(n); // dummy argument
297 pNewItem->SetFont(GetFont());
298 m_aItems.Insert(pNewItem, n);
299 }
300 #endif
301 AssignNewItemClientData(n, clientData, i, type);
302
303 if (incrementPos)
304 ++lIndexType;
305 }
306
307 return n;
308 } // end of wxListBox::DoInsertAppendItemsWithData
309
310 void wxListBox::DoClear()
311 {
312 #if wxUSE_OWNER_DRAWN
313 if ( m_windowStyle & wxLB_OWNERDRAW )
314 {
315 WX_CLEAR_ARRAY(m_aItems);
316 }
317 #endif // wxUSE_OWNER_DRAWN
318 ::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0);
319
320 m_nNumItems = 0;
321 } // end of wxListBox::Clear
322
323 void wxListBox::DoSetSelection( int N, bool bSelect)
324 {
325 wxCHECK_RET( IsValid(N),
326 wxT("invalid index in wxListBox::SetSelection") );
327 ::WinSendMsg( GetHwnd()
328 ,LM_SELECTITEM
329 ,MPFROMLONG(N)
330 ,(MPARAM)bSelect
331 );
332 if(m_windowStyle & wxLB_OWNERDRAW)
333 Refresh();
334 } // end of wxListBox::SetSelection
335
336 bool wxListBox::IsSelected( int N ) const
337 {
338 wxCHECK_MSG( IsValid(N), false,
339 wxT("invalid index in wxListBox::Selected") );
340
341 LONG lItem;
342
343 if (GetWindowStyleFlag() & wxLB_EXTENDED)
344 {
345 if (N == 0)
346 lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)LIT_FIRST, (MPARAM)0));
347 else
348 lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)(N - 1), (MPARAM)0));
349 }
350 else
351 {
352 lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)LIT_FIRST, (MPARAM)0));
353 }
354 return (lItem == (LONG)N && lItem != LIT_NONE);
355 } // end of wxListBox::IsSelected
356
357 void* wxListBox::DoGetItemClientData(unsigned int n) const
358 {
359 wxCHECK_MSG( IsValid(n), NULL,
360 wxT("invalid index in wxListBox::GetClientData") );
361
362 return((void *)::WinSendMsg(GetHwnd(), LM_QUERYITEMHANDLE, MPFROMLONG(n), (MPARAM)0));
363 } // end of wxListBox::DoGetItemClientData
364
365 void wxListBox::DoSetItemClientData(unsigned int n, void* pClientData)
366 {
367 wxCHECK_RET( IsValid(n),
368 wxT("invalid index in wxListBox::SetClientData") );
369
370 ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(n), MPFROMP(pClientData));
371 } // end of wxListBox::DoSetItemClientData
372
373 bool wxListBox::HasMultipleSelection() const
374 {
375 return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
376 } // end of wxListBox::HasMultipleSelection
377
378 int wxListBox::GetSelections( wxArrayInt& raSelections ) const
379 {
380 int nCount = 0;
381 LONG lItem;
382
383
384 raSelections.Empty();
385 if (HasMultipleSelection())
386 {
387 lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
388 ,LM_QUERYSELECTION
389 ,(MPARAM)LIT_FIRST
390 ,(MPARAM)0
391 )
392 );
393 if (lItem != LIT_NONE)
394 {
395 nCount++;
396 while ((lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
397 ,LM_QUERYSELECTION
398 ,(MPARAM)lItem
399 ,(MPARAM)0
400 )
401 )) != LIT_NONE)
402 {
403 nCount++;
404 }
405 raSelections.Alloc(nCount);
406 lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
407 ,LM_QUERYSELECTION
408 ,(MPARAM)LIT_FIRST
409 ,(MPARAM)0
410 )
411 );
412
413 raSelections.Add((int)lItem);
414 while ((lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
415 ,LM_QUERYSELECTION
416 ,(MPARAM)lItem
417 ,(MPARAM)0
418 )
419 )) != LIT_NONE)
420 {
421 raSelections.Add((int)lItem);
422 }
423 return nCount;
424 }
425 }
426 else // single-selection listbox
427 {
428 lItem = LONGFROMMR(::WinSendMsg( GetHwnd()
429 ,LM_QUERYSELECTION
430 ,(MPARAM)LIT_FIRST
431 ,(MPARAM)0
432 )
433 );
434 raSelections.Add((int)lItem);
435 return 1;
436 }
437 return 0;
438 } // end of wxListBox::GetSelections
439
440 int wxListBox::GetSelection() const
441 {
442 wxCHECK_MSG( !HasMultipleSelection(),
443 -1,
444 wxT("GetSelection() can't be used with multiple-selection "
445 "listboxes, use GetSelections() instead.") );
446
447 return(LONGFROMMR(::WinSendMsg( GetHwnd()
448 ,LM_QUERYSELECTION
449 ,(MPARAM)LIT_FIRST
450 ,(MPARAM)0
451 )
452 ));
453 } // end of wxListBox::GetSelection
454
455 wxString wxListBox::GetString(unsigned int n) const
456 {
457 LONG lLen = 0;
458 wxChar* zBuf;
459 wxString sResult;
460
461 wxCHECK_MSG( IsValid(n), wxEmptyString,
462 wxT("invalid index in wxListBox::GetClientData") );
463
464 lLen = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)n, (MPARAM)0));
465 zBuf = new wxChar[lLen + 1];
466 ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT((SHORT)n, (SHORT)lLen), (MPARAM)zBuf);
467 zBuf[lLen] = '\0';
468 sResult = zBuf;
469 delete [] zBuf;
470 return sResult;
471 } // end of wxListBox::GetString
472
473 void wxListBox::SetString(unsigned int n, const wxString& rsString)
474 {
475 wxCHECK_RET( IsValid(n),
476 wxT("invalid index in wxListBox::SetString") );
477
478 //
479 // Remember the state of the item
480 //
481 bool bWasSelected = IsSelected(n);
482 void* pOldData = NULL;
483 wxClientData* pOldObjData = NULL;
484
485 if ( HasClientUntypedData() )
486 pOldData = GetClientData(n);
487 else if ( HasClientObjectData() )
488 pOldObjData = GetClientObject(n);
489
490 //
491 // Delete and recreate it
492 //
493 ::WinSendMsg( GetHwnd()
494 ,LM_DELETEITEM
495 ,(MPARAM)n
496 ,(MPARAM)0
497 );
498
499 int nNewN = n;
500
501 if (n == (m_nNumItems - 1))
502 nNewN = -1;
503
504 ::WinSendMsg( GetHwnd()
505 ,LM_INSERTITEM
506 ,(MPARAM)nNewN
507 ,(MPARAM)rsString.wx_str()
508 );
509
510 //
511 // Restore the client data
512 //
513 if (pOldData)
514 SetClientData(n, pOldData);
515 else if (pOldObjData)
516 SetClientObject(n, pOldObjData);
517
518 //
519 // We may have lost the selection
520 //
521 if (bWasSelected)
522 Select(n);
523 } // end of wxListBox::SetString
524
525 unsigned int wxListBox::GetCount() const
526 {
527 return m_nNumItems;
528 }
529
530 // ----------------------------------------------------------------------------
531 // helpers
532 // ----------------------------------------------------------------------------
533
534 wxSize wxListBox::DoGetBestSize() const
535 {
536 //
537 // Find the widest string
538 //
539 int nLine;
540 int nListbox = 0;
541 int nCx;
542 int nCy;
543 wxFont vFont = (wxFont)GetFont();
544
545 for (unsigned int i = 0; i < m_nNumItems; i++)
546 {
547 wxString vStr(GetString(i));
548
549 GetTextExtent( vStr, &nLine, NULL );
550 if (nLine > nListbox)
551 nListbox = nLine;
552 }
553
554 //
555 // Give it some reasonable default value if there are no strings in the
556 // list.
557 //
558 if (nListbox == 0)
559 nListbox = 100;
560
561 //
562 // The listbox should be slightly larger than the widest string
563 //
564 wxGetCharSize( GetHWND()
565 ,&nCx
566 ,&nCy
567 ,&vFont
568 );
569 nListbox += 3 * nCx;
570
571 int hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy) * (wxMax(m_nNumItems, 7));
572
573 return wxSize( nListbox
574 ,hListbox
575 );
576 } // end of wxListBox::DoGetBestSize
577
578 // ----------------------------------------------------------------------------
579 // callbacks
580 // ----------------------------------------------------------------------------
581
582 bool wxListBox::OS2Command(
583 WXUINT uParam
584 , WXWORD WXUNUSED(wId))
585 {
586 wxEventType eEvtType;
587
588 if (uParam == LN_SELECT)
589 {
590 eEvtType = wxEVT_COMMAND_LISTBOX_SELECTED;
591 }
592 else if (uParam == LN_ENTER)
593 {
594 eEvtType = wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
595 }
596 else
597 {
598 //
599 // Some event we're not interested in
600 //
601 return false;
602 }
603 wxCommandEvent vEvent( eEvtType
604 ,m_windowId
605 );
606
607 vEvent.SetEventObject(this);
608
609 wxArrayInt aSelections;
610 int n;
611 int nCount = GetSelections(aSelections);
612
613 if (nCount > 0)
614 {
615 n = aSelections[0];
616 if (HasClientObjectData())
617 vEvent.SetClientObject(GetClientObject(n));
618 else if ( HasClientUntypedData() )
619 vEvent.SetClientData(GetClientData(n));
620 vEvent.SetString(GetString(n));
621 }
622 else
623 {
624 n = -1;
625 }
626 vEvent.SetInt(n);
627 return HandleWindowEvent(vEvent);
628 } // end of wxListBox::OS2Command
629
630 // ----------------------------------------------------------------------------
631 // wxCheckListBox support
632 // ----------------------------------------------------------------------------
633
634 #if wxUSE_OWNER_DRAWN
635
636 //
637 // Drawing
638 // -------
639 //
640 #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1)
641
642 long wxListBox::OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem)
643 {
644 if (!pItem)
645 pItem = (WXMEASUREITEMSTRUCT*)new OWNERITEM;
646
647 POWNERITEM pMeasureStruct = (POWNERITEM)pItem;
648 wxScreenDC vDc;
649
650 //
651 // Only owner-drawn control should receive this message
652 //
653 wxCHECK( ((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE );
654
655 vDc.SetFont(GetFont());
656
657 wxCoord vHeight;
658 wxCoord vWidth;
659
660 GetSize( &vWidth
661 ,NULL
662 );
663
664 pMeasureStruct->rclItem.xRight = (USHORT)vWidth;
665 pMeasureStruct->rclItem.xLeft = 0;
666 pMeasureStruct->rclItem.yTop = 0;
667 pMeasureStruct->rclItem.yBottom = 0;
668
669 vHeight = (wxCoord)(vDc.GetCharHeight() * 2.5);
670 pMeasureStruct->rclItem.yTop = (USHORT)vHeight;
671
672 return long(MRFROM2SHORT((USHORT)vHeight, (USHORT)vWidth));
673 } // end of wxListBox::OS2OnMeasure
674
675 bool wxListBox::OS2OnDraw (
676 WXDRAWITEMSTRUCT* pItem
677 )
678 {
679 POWNERITEM pDrawStruct = (POWNERITEM)pItem;
680 int eAction = 0;
681 int eStatus = 0;
682
683 //
684 // Only owner-drawn control should receive this message
685 //
686 wxCHECK(((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false);
687
688
689 //
690 // The item may be -1 for an empty listbox
691 //
692 if (pDrawStruct->idItem == -1L)
693 return false;
694
695 wxListBoxItem* pData = (wxListBoxItem*)m_aItems[pDrawStruct->idItem];
696
697 wxClientDC vDc(this);
698 wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
699 wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop );
700 wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom );
701 wxRect vRect( pt1, pt2 );
702
703 impl->SetHPS(pDrawStruct->hps);
704
705 if (pDrawStruct->fsAttribute == pDrawStruct->fsAttributeOld)
706 {
707 //
708 // Entire Item needs to be redrawn (either it has reappeared from
709 // behind another window or is being displayed for the first time
710 //
711 eAction = wxOwnerDrawn::wxODDrawAll;
712
713 if (pDrawStruct->fsAttribute & MIA_HILITED)
714 {
715 //
716 // If it is currently selected we let the system handle it
717 //
718 eStatus |= wxOwnerDrawn::wxODSelected;
719 }
720 if (pDrawStruct->fsAttribute & MIA_CHECKED)
721 {
722 //
723 // If it is currently checked we draw our own
724 //
725 eStatus |= wxOwnerDrawn::wxODChecked;
726 pDrawStruct->fsAttributeOld = pDrawStruct->fsAttribute &= ~MIA_CHECKED;
727 }
728 if (pDrawStruct->fsAttribute & MIA_DISABLED)
729 {
730 //
731 // If it is currently disabled we let the system handle it
732 //
733 eStatus |= wxOwnerDrawn::wxODDisabled;
734 }
735 //
736 // Don't really care about framed (indicationg focus) or NoDismiss
737 //
738 }
739 else
740 {
741 if (pDrawStruct->fsAttribute & MIA_HILITED)
742 {
743 eAction = wxOwnerDrawn::wxODDrawAll;
744 eStatus |= wxOwnerDrawn::wxODSelected;
745 //
746 // Keep the system from trying to highlight with its bogus colors
747 //
748 pDrawStruct->fsAttributeOld = pDrawStruct->fsAttribute &= ~MIA_HILITED;
749 }
750 else if (!(pDrawStruct->fsAttribute & MIA_HILITED))
751 {
752 eAction = wxOwnerDrawn::wxODDrawAll;
753 eStatus = 0;
754 //
755 // Keep the system from trying to highlight with its bogus colors
756 //
757 pDrawStruct->fsAttribute = pDrawStruct->fsAttributeOld &= ~MIA_HILITED;
758 }
759 else
760 {
761 //
762 // For now we don't care about anything else
763 // just ignore the entire message!
764 //
765 return true;
766 }
767 }
768 return pData->OnDrawItem( vDc
769 ,vRect
770 ,(wxOwnerDrawn::wxODAction)eAction
771 ,(wxOwnerDrawn::wxODStatus)(eStatus | wxOwnerDrawn::wxODHidePrefix)
772 );
773 } // end of wxListBox::OS2OnDraw
774
775 #endif // ndef for wxUSE_OWNER_DRAWN
776
777 #endif // wxUSE_LISTBOX