#include "wx/window.h"
#endif
+#include "wx/os2/dcclient.h"
#include "wx/os2/private.h"
#define INCL_M
#include "wx/ownerdrw.h"
#endif
- IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems)
// ============================================================================
// list box item declaration and implementation
n = (int)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)items[i].wx_str());
if (n < 0)
{
- wxLogLastError(_T("WinSendMsg(LM_INSERTITEM)"));
+ wxLogLastError(wxT("WinSendMsg(LM_INSERTITEM)"));
n = wxNOT_FOUND;
break;
}
{
wxOwnerDrawn* pNewItem = CreateItem(n); // dummy argument
wxScreenDC vDc; // FIXME: is it really needed here?
-
+
pNewItem->SetName(items[i]);
m_aItems.Insert(pNewItem, n);
- ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, (MPARAM)n, MPFROMP(pNewItem));
pNewItem->SetFont(GetFont());
}
#endif
wxCHECK_RET( IsValid(n),
wxT("invalid index in wxListBox::SetClientData") );
-#if wxUSE_OWNER_DRAWN
- if ( m_windowStyle & wxLB_OWNERDRAW )
- {
- //
- // Client data must be pointer to wxOwnerDrawn, otherwise we would crash
- // in OnMeasure/OnDraw.
- //
- wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
- }
-#endif // wxUSE_OWNER_DRAWN
-
::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(n), MPFROMP(pClientData));
} // end of wxListBox::DoSetItemClientData
void* pOldData = NULL;
wxClientData* pOldObjData = NULL;
- if (m_clientDataItemsType == wxClientData_Void)
+ if ( HasClientUntypedData() )
pOldData = GetClientData(n);
- else if (m_clientDataItemsType == wxClientData_Object)
+ else if ( HasClientObjectData() )
pOldObjData = GetClientObject(n);
//
n = -1;
}
vEvent.SetInt(n);
- return GetEventHandler()->ProcessEvent(vEvent);
+ return HandleWindowEvent(vEvent);
} // end of wxListBox::OS2Command
// ----------------------------------------------------------------------------
)
{
POWNERITEM pDrawStruct = (POWNERITEM)pItem;
- LONG lItemID = pDrawStruct->idItem;
int eAction = 0;
int eStatus = 0;
//
// The item may be -1 for an empty listbox
//
- if (lItemID == -1L)
+ if (pDrawStruct->idItem == -1L)
return false;
- wxListBoxItem* pData = (wxListBoxItem*)PVOIDFROMMR( ::WinSendMsg( GetHwnd()
- ,LM_QUERYITEMHANDLE
- ,MPFROMLONG(pDrawStruct->idItem)
- ,(MPARAM)0
- )
- );
-
- wxCHECK(pData, false );
+ wxListBoxItem* pData = (wxListBoxItem*)m_aItems[pDrawStruct->idItem];
- wxDC vDc;
+ wxClientDC vDc(this);
+ wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop );
wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom );
wxRect vRect( pt1, pt2 );
- vDc.SetHPS(pDrawStruct->hps);
+ impl->SetHPS(pDrawStruct->hps);
if (pDrawStruct->fsAttribute == pDrawStruct->fsAttributeOld)
{