#ifdef __WXDEBUG__
void wxDataViewItem::Print(const wxString& text) const
{
- wxPrintf("item %s: %l\n", text, (long)m_id);
+ wxPrintf(wxT("item %s: %l\n"), text.GetData(), (long)m_id);
}
#endif
{
}
+void wxDataViewIndexListModel::Reset( unsigned int new_size )
+{
+ if (m_useHash)
+ {
+ m_hash.Clear();
+
+ // IDs are ordered until an item gets deleted or inserted
+ m_ordered = true;
+
+ // build initial index
+ unsigned int i;
+ for (i = 1; i < new_size+1; i++)
+ m_hash.Add( (void*) i );
+ m_lastIndex = new_size + 1;
+ }
+ else
+ {
+ m_lastIndex = new_size-1;
+ }
+
+ wxDataViewModel::Cleared();
+}
+
void wxDataViewIndexListModel::RowPrepended()
{
if (m_useHash)
return 0;
children = m_hash;
-
+
return m_hash.GetCount();
}
SetSortable((flags & wxDATAVIEW_COL_SORTABLE) != 0);
SetResizeable((flags & wxDATAVIEW_COL_RESIZABLE) != 0);
SetHidden((flags & wxDATAVIEW_COL_HIDDEN) != 0);
+ SetReorderable((flags & wxDATAVIEW_COL_REORDERABLE) != 0);
}
// ---------------------------------------------------------
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED)
// -------------------------------------
// -------------------------------------
wxDataViewSpinRenderer::wxDataViewSpinRenderer( int min, int max, wxDataViewCellMode mode, int alignment ) :
- wxDataViewCustomRenderer( "long", mode, alignment )
+ wxDataViewCustomRenderer(wxT("long"), mode, alignment )
{
m_min = min;
m_max = max;
wxControl* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
{
long l = value;
- return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
- labelRect.GetTopLeft(), labelRect.GetSize(), wxSP_ARROW_KEYS, m_min, m_max, l );
+ wxSize size = labelRect.GetSize();
+#ifdef __WXMAC__
+ size = wxSize( wxMax(70,labelRect.width ), -1 );
+#endif
+ wxString str;
+ str.Printf( wxT("%d\n"), (int) l );
+ wxSpinCtrl *sc = new wxSpinCtrl( parent, wxID_ANY, str,
+ labelRect.GetTopLeft(), size, wxSP_ARROW_KEYS, m_min, m_max, l );
+#ifdef __WXMAC__
+ size = sc->GetSize();
+ wxPoint pt = sc->GetPosition();
+ sc->SetSize( pt.x - 4, pt.y - 4, size.x, size.y );
+#endif
+
+ return sc;
}
bool wxDataViewSpinRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value )
bool wxDataViewSpinRenderer::Render( wxRect rect, wxDC *dc, int state )
{
wxString str;
- str.Printf( "%d", (int) m_data );
+ str.Printf(wxT("%d"), (int) m_data );
RenderText( str, 0, rect, dc, state );
return true;
}
AssociateModel( store );
store->DecRef();
-#if !defined(__WXGTK20__) || defined(wxUSE_GENERICDATAVIEWCTRL)
- wxDataViewColumn *col = AppendIconTextColumn( "", 0, wxDATAVIEW_CELL_INERT, 40 );
-
- wxSize cient_size = GetClientSize();
- col->SetWidth( size.x );
-#else
- AppendIconTextColumn( "", 0, wxDATAVIEW_CELL_INERT, 40 );
-#endif
+ AppendIconTextColumn(wxString(),0,wxDATAVIEW_CELL_INERT,-1);
}
wxDataViewTreeCtrl::~wxDataViewTreeCtrl()
void wxDataViewTreeCtrl::OnSize( wxSizeEvent &event )
{
-#if !defined(__WXGTK20__) || defined(wxUSE_GENERICDATAVIEWCTRL)
+#if defined(wxUSE_GENERICDATAVIEWCTRL)
wxSize size = GetClientSize();
wxDataViewColumn *col = GetColumn( 0 );
- if (col) col->SetWidth( size.x );
+ if (col)
+ col->SetWidth( size.x );
#endif
event.Skip( true );
}