// Name: src/osx/dataview_osx.cpp
// Purpose: wxDataViewCtrl native mac implementation
// Author:
-// Id: $Id: dataview_osx.cpp 58317 2009-01-27
+// Id: $Id$
// Copyright: (c) 2009
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
delete m_DCPtr;
}
-void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state )
-{
- wxDataViewCtrl *view = GetOwner()->GetOwner();
-
- wxColour col = (state & wxDATAVIEW_CELL_SELECTED) ? *wxWHITE : view->GetForegroundColour();
- dc->SetTextForeground(col);
- dc->DrawText( text, cell.x + xoffset, cell.y + ((cell.height - dc->GetCharHeight()) / 2));
-}
-
wxDC* wxDataViewCustomRenderer::GetDC()
{
if ((m_DCPtr == NULL) && (GetOwner() != NULL) && (GetOwner()->GetOwner() != NULL))
m_cgContext = NULL;
}
-bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator )
+bool wxDataViewCtrl::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
{
- if (!(wxControl::Create(parent,id,pos,size,style & ~(wxHSCROLL | wxVSCROLL),validator)))
+ if (!(wxControl::Create(parent,id,pos,size,style,validator,name)))
return false;
m_peer = ::CreateDataView(this,parent,id,pos,size,style,GetExtraStyle());
return GetDataViewPeer()->GetCount();
}
+wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
+{
+ return GetDataViewPeer()->GetCurrentItem();
+}
+
+void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
+{
+ GetDataViewPeer()->SetCurrentItem(item);
+}
+
wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
{
if (item.IsOk() && (columnPtr != NULL))
attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX );
- attr.font.CreateSystemFont(wxOSX_SYSTEM_FONT_VIEWS);
+ static wxFont font = wxFont(wxOSX_SYSTEM_FONT_VIEWS);
+ attr.font = font;
return attr;
}