// for now, we'll always use the generic list control for ICON and LIST views,
// because they dynamically change the number of columns on resize.
// Also, allow the user to set it to use the list ctrl as well.
- // Also, use generic list control in VIRTUAL mode.
if ( (wxSystemOptions::HasOption( wxMAC_ALWAYS_USE_GENERIC_LISTCTRL )
&& (wxSystemOptions::GetOptionInt( wxMAC_ALWAYS_USE_GENERIC_LISTCTRL ) == 1)) ||
(style & wxLC_ICON) || (style & wxLC_SMALL_ICON) || (style & wxLC_LIST) )
}
wxListCtrl *list = wxDynamicCast( owner->GetPeer() , wxListCtrl );
- if ( list )
+ if ( list && lb )
{
bool trigger = false;
if ( gDataBrowserDrawItemUPP == NULL )
gDataBrowserDrawItemUPP = NewDataBrowserDrawItemUPP(DataBrowserDrawItemProc);
-// if ( gDataBrowserEditItemUPP == NULL )
-// gDataBrowserEditItemUPP = NewDataBrowserEditItemUPP(DataBrowserEditTextProc);
-
if ( gDataBrowserHitTestUPP == NULL )
gDataBrowserHitTestUPP = NewDataBrowserHitTestUPP(DataBrowserHitTestProc);
callbacks.u.v1.drawItemCallback = gDataBrowserDrawItemUPP;
-// callbacks.u.v1.editTextCallback = gDataBrowserEditItemUPP;
callbacks.u.v1.hitTestCallback = gDataBrowserHitTestUPP;
SetDataBrowserCustomCallbacks( GetControlRef(), &callbacks );
Rect *maxEditTextRect,
Boolean *shrinkToFit)
{
- //wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
return false;
}
enclosingRect.bottom - enclosingRect.top);
active = IsControlActive(GetControlRef());
-
+
+ // don't paint the background over the vertical rule line
+ if ( list->GetWindowStyleFlag() & wxLC_VRULES )
+ {
+ enclosingCGRect.origin.x += 1;
+ enclosingCGRect.size.width -= 1;
+ }
if (itemState == kDataBrowserItemIsSelected)
{
RGBColor foregroundColor;
if (!m_isVirtual)
{
lcItem = (wxMacListCtrlItem*) itemID;
- if (lcItem->HasColumnInfo(listColumn)){
+ if (lcItem && lcItem->HasColumnInfo(listColumn)){
wxListItem* item = lcItem->GetColumnInfo(listColumn);
if (item->GetMask() & wxLIST_MASK_TEXT)
text = item->GetText();
void wxMacDataBrowserListCtrlControl::MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item )
{
wxMacDataItem* dataItem = GetItemFromLine(row);
+ wxASSERT_MSG( dataItem, _T("could not obtain wxMacDataItem for row in MacSetColumnInfo. Is row a valid wxListCtrl row?") );
if (item)
{
wxMacListCtrlItem* listItem = dynamic_cast<wxMacListCtrlItem*>(dataItem);
void wxMacDataBrowserListCtrlControl::MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item )
{
wxMacDataItem* dataItem = GetItemFromLine(row);
+ wxASSERT_MSG( dataItem, _T("could not obtain wxMacDataItem in MacGetColumnInfo. Is row a valid wxListCtrl row?") );
// CS should this guard against dataItem = 0 ? , as item is not a pointer if (item) is not appropriate
//if (item)
{
wxMacListCtrlItem::wxMacListCtrlItem()
{
- m_rowItems = wxListItemList();
+ m_rowItems = wxListItemList( wxKEY_INTEGER );
}
int wxMacListCtrlItem::GetColumnImageValue( unsigned int column )
{
- return GetColumnInfo(column)->GetImage();
+ if ( HasColumnInfo(column) )
+ return GetColumnInfo(column)->GetImage();
+
+ return -1;
}
void wxMacListCtrlItem::SetColumnImageValue( unsigned int column, int imageIndex )
{
- GetColumnInfo(column)->SetImage(imageIndex);
+ if ( HasColumnInfo(column) )
+ GetColumnInfo(column)->SetImage(imageIndex);
}
const wxString& wxMacListCtrlItem::GetColumnTextValue( unsigned int column )
if ( column == 0 )
return GetLabel();
- return GetColumnInfo(column)->GetText();
+ if ( HasColumnInfo(column) )
+ return GetColumnInfo(column)->GetText();
+
+ return wxEmptyString;
}
void wxMacListCtrlItem::SetColumnTextValue( unsigned int column, const wxString& text )
{
- GetColumnInfo(column)->SetText(text);
+ if ( HasColumnInfo(column) )
+ GetColumnInfo(column)->SetText(text);
// for compatibility with superclass APIs
if ( column == 0 )
wxListItem* wxMacListCtrlItem::GetColumnInfo( unsigned int column )
{
- wxListItemList::compatibility_iterator node = m_rowItems.Item( column );
+ wxListItemList::compatibility_iterator node = m_rowItems.Find( column );
wxASSERT_MSG( node, _T("invalid column index in wxMacListCtrlItem") );
return node->GetData();
bool wxMacListCtrlItem::HasColumnInfo( unsigned int column )
{
- return m_rowItems.GetCount() > column;
+ return m_rowItems.Find( column ) != NULL;
}
void wxMacListCtrlItem::SetColumnInfo( unsigned int column, wxListItem* item )
{
- if ( column >= m_rowItems.GetCount() )
+ if ( !HasColumnInfo(column) )
{
wxListItem* listItem = new wxListItem(*item);
- m_rowItems.Append( listItem );
+ m_rowItems.Append( column, listItem );
}
else
{