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