/////////////////////////////////////////////////////////////////////////////
-// Name: src/mac/listctrl_mac.cpp
+// Name: src/osx/listctrl_mac.cpp
// Purpose: wxListCtrl
// Author: Julian Smart
// Modified by: Agron Selimaj
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacListCtrlEventHandler )
-class wxMacListCtrlItem : public wxMacListBoxItem
+class wxMacListCtrlItem : public wxMacDataItem
{
public:
wxMacListCtrlItem();
// create a list item (can be a subclass of wxMacListBoxItem)
- virtual wxMacDataItem* CreateItem();
-
virtual void MacInsertItem( unsigned int n, wxListItem* item );
virtual void MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item );
virtual void MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item );
// implementation
// ============================================================================
-wxMacListControl* wxListCtrl::GetPeer() const
+wxMacDataBrowserListCtrlControl* wxListCtrl::GetListPeer() const
{
- wxMacDataBrowserListCtrlControl *lb = wxDynamicCast(m_peer,wxMacDataBrowserListCtrlControl);
- return lb ? wx_static_cast(wxMacListControl*,lb) : 0 ;
+ return dynamic_cast<wxMacDataBrowserListCtrlControl*> ( GetPeer() );
}
// ----------------------------------------------------------------------------
return rv;
}
-wxColour wxListCtrl::GetBackgroundColour()
+wxColour wxListCtrl::GetBackgroundColour() const
{
if (m_genericImpl)
return m_genericImpl->GetBackgroundColour();
// we want to depend on as little as possible to make sure tear-down of controls is safe
if ( message == kDataBrowserItemRemoved)
{
- if ( lb != NULL && lb->GetClientDataType() == wxClientData_Object )
- {
- delete (wxClientData*) (m_data);
- }
-
delete this;
return;
}
return ;
}
- wxListCtrl *list = wxDynamicCast( owner->GetPeer() , wxListCtrl );
+ wxListCtrl *list = wxDynamicCast( owner->GetWXPeer() , wxListCtrl );
if ( list && lb )
{
bool trigger = false;
int imgIndex = -1;
short listColumn = property - kMinColumnId;
- wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
+ wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
wxMacListCtrlItem* lcItem;
wxColour color = *wxBLACK;
wxColour bgColor = wxNullColour;
HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft;
HIThemeTextInfo info;
bool setup = false;
-#if wxMAC_USE_CORE_TEXT
+#if wxOSX_USE_CORE_TEXT
if ( UMAGetSystemVersion() >= 0x1050 )
{
info.version = kHIThemeTextInfoVersionOne;
}
}
#endif
-#if wxMAC_USE_ATSU_TEXT
+#if wxOSX_USE_ATSU_TEXT
if ( !setup )
{
info.version = kHIThemeTextInfoVersionZero;
short listColumn = property - kMinColumnId;
OSStatus err = errDataBrowserPropertyNotSupported;
- wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
+ wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
wxMacListCtrlItem* lcItem = NULL;
if (listColumn >= 0)
return ;
}
- wxListCtrl *list = wxDynamicCast( GetPeer() , wxListCtrl );
+ wxListCtrl *list = wxDynamicCast( GetWXPeer() , wxListCtrl );
if ( list )
{
bool trigger = false;
int colId = sortProperty - kMinColumnId;
- wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
+ wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
DataBrowserSortOrder sort;
verify_noerr(GetSortOrder(&sort));
wxMacListCtrlItem* otherItem = (wxMacListCtrlItem*)itemTwoID;
itemOrder = item->GetOrder();
- otherItemOrder = item->GetOrder();
+ otherItemOrder = otherItem->GetOrder();
wxListCtrlCompare func = list->GetCompareFunc();
if (func != NULL)
{
+
long item1 = -1;
long item2 = -1;
if (item && item->HasColumnInfo(0))
wxASSERT_MSG( dataItem, _T("could not obtain wxMacDataItem for row in MacSetColumnInfo. Is row a valid wxListCtrl row?") );
if (item)
{
- wxMacListCtrlItem* listItem = wx_static_cast(wxMacListCtrlItem*,dataItem);
+ wxMacListCtrlItem* listItem = static_cast<wxMacListCtrlItem *>(dataItem);
bool hasInfo = listItem->HasColumnInfo( column );
listItem->SetColumnInfo( column, item );
listItem->SetOrder(row);
UpdateState(dataItem, item);
- wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
+ wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
// NB: When this call was made before a control was completely shown, it would
// update the item prematurely (i.e. no text would be listed) and, on show,
// CS should this guard against dataItem = 0 ? , as item is not a pointer if (item) is not appropriate
//if (item)
{
- wxMacListCtrlItem* listItem =wx_static_cast(wxMacListCtrlItem*,dataItem);
+ wxMacListCtrlItem* listItem = static_cast<wxMacListCtrlItem *>(dataItem);
if (!listItem->HasColumnInfo( column ))
return;
}
}
}
-
+
void wxMacDataBrowserListCtrlControl::MacInsertItem( unsigned int n, wxListItem* item )
{
- wxMacDataItemBrowserControl::MacInsert(n, item->GetText());
+
+ wxMacDataItemBrowserControl::MacInsert(n, new wxMacListCtrlItem() );
MacSetColumnInfo(n, 0, item);
}
-wxMacDataItem* wxMacDataBrowserListCtrlControl::CreateItem()
-{
- return new wxMacListCtrlItem();
-}
-
wxMacListCtrlItem::wxMacListCtrlItem()
{
m_rowItems = wxListItemList();
wxString wxMacListCtrlItem::GetColumnTextValue( unsigned int column )
{
+/* TODO CHECK REMOVE
if ( column == 0 )
return GetLabel();
-
+*/
if ( HasColumnInfo(column) )
return GetColumnInfo(column)->GetText();
if ( HasColumnInfo(column) )
GetColumnInfo(column)->SetText(text);
+/* TODO CHECK REMOVE
// for compatibility with superclass APIs
if ( column == 0 )
SetLabel(text);
+*/
}
wxListItem* wxMacListCtrlItem::GetColumnInfo( unsigned int column )