git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47493
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
class WXDLLIMPEXP_ADV wxDataViewItem
{
public:
class WXDLLIMPEXP_ADV wxDataViewItem
{
public:
- wxDataViewItem( wxUint32 id = 0 )
- { m_id = id; m_reserved1 = 0; m_reserved2 = NULL; }
+ wxDataViewItem( void* id = NULL )
+ { m_id = id; }
wxDataViewItem( const wxDataViewItem &item )
wxDataViewItem( const wxDataViewItem &item )
- { m_id = item.m_id; m_reserved1 = item.m_reserved1; m_reserved2 = item.m_reserved2; }
- bool IsOk() const { return m_id != 0; }
- wxUint32 GetID() const { return m_id; }
-
-public:
- wxUint32 m_reserved1;
- void* m_reserved2;
+ { m_id = item.m_id; }
+ bool IsOk() const { return m_id != NULL; }
+ void* GetID() const { return m_id; }
};
bool operator == (const wxDataViewItem &left, const wxDataViewItem &right);
};
bool operator == (const wxDataViewItem &left, const wxDataViewItem &right);
if (m_classicalMusicIsKnownToControl)
{
// notify control
if (m_classicalMusicIsKnownToControl)
{
// notify control
- wxDataViewItem child( child_node->GetID() );
- wxDataViewItem parent( m_classical->GetID() );
+ wxDataViewItem child( (void*) child_node->GetID() );
+ wxDataViewItem parent( (void*) m_classical->GetID() );
ItemAdded( parent, child );
}
}
ItemAdded( parent, child );
}
}
virtual wxDataViewItem GetFirstChild( const wxDataViewItem &parent ) const
{
if (parent.GetID() == 0)
virtual wxDataViewItem GetFirstChild( const wxDataViewItem &parent ) const
{
if (parent.GetID() == 0)
- return wxDataViewItem( m_root->GetID() );
+ return wxDataViewItem( (void*) m_root->GetID() );
MyMusicModelNode *node = FindNode( parent );
MyMusicModelNode *node = FindNode( parent );
}
MyMusicModelNode *first_child = node->GetChildren().Item( 0 );
}
MyMusicModelNode *first_child = node->GetChildren().Item( 0 );
- return wxDataViewItem( first_child->GetID() );
+ return wxDataViewItem( (void*) first_child->GetID() );
}
virtual wxDataViewItem GetNextSibling( const wxDataViewItem &item ) const
}
virtual wxDataViewItem GetNextSibling( const wxDataViewItem &item ) const
return wxDataViewItem(0);
node = parent->GetChildren().Item( pos+1 );
return wxDataViewItem(0);
node = parent->GetChildren().Item( pos+1 );
- return wxDataViewItem( node->GetID() );
+ return wxDataViewItem( (void*) node->GetID() );
MyMusicModelNode *FindNodeRec( MyMusicModelNode *node, const wxDataViewItem &item ) const
{
MyMusicModelNode *FindNodeRec( MyMusicModelNode *node, const wxDataViewItem &item ) const
{
- if (node->GetID() == item.GetID())
+ if (node->GetID() == (wxUint32) item.GetID())
return node;
size_t count = node->GetChildCount();
return node;
size_t count = node->GetChildCount();
GetOwner()->CalcScrolledPosition( labelRect.x, labelRect.y,
&labelRect.x, &labelRect.y);
GetOwner()->CalcScrolledPosition( labelRect.x, labelRect.y,
&labelRect.x, &labelRect.y);
+ // TODO get wxDataViewItem from m_currentRow
m_currentCol->GetRenderer()->StartEditing( m_currentRow, labelRect );
}
m_currentCol->GetRenderer()->StartEditing( m_currentRow, labelRect );
}
{
wxVariant variant;
g_value_init( value, G_TYPE_STRING );
{
wxVariant variant;
g_value_init( value, G_TYPE_STRING );
- wxDataViewItem item( (wxUint32) iter->user_data );
+ wxDataViewItem item( (void*) iter->user_data );
model->GetValue( variant, item, (unsigned int) column );
g_value_set_string( value, variant.GetString().utf8_str() );
model->GetValue( variant, item, (unsigned int) column );
g_value_set_string( value, variant.GetString().utf8_str() );
gboolean wxGtkTreeModel::iter_next( GtkTreeIter *iter )
{
gboolean wxGtkTreeModel::iter_next( GtkTreeIter *iter )
{
- wxDataViewItem item( (wxUint32) iter->user_data );
+ wxDataViewItem item( (void*) iter->user_data );
item = m_wx_model->GetNextSibling( item );
if (!item.IsOk())
return FALSE;
item = m_wx_model->GetNextSibling( item );
if (!item.IsOk())
return FALSE;
gboolean wxGtkTreeModel::iter_children( GtkTreeIter *iter, GtkTreeIter *parent )
{
gboolean wxGtkTreeModel::iter_children( GtkTreeIter *iter, GtkTreeIter *parent )
{
- wxDataViewItem item( (wxUint32) parent->user_data );
+ wxDataViewItem item( (void*) parent->user_data );
if (!m_wx_model->HasChildren( item ))
return FALSE;
if (!m_wx_model->HasChildren( item ))
return FALSE;
gboolean wxGtkTreeModel::iter_has_child( GtkTreeIter *iter )
{
gboolean wxGtkTreeModel::iter_has_child( GtkTreeIter *iter )
{
- wxDataViewItem item( (wxUint32) iter->user_data );
+ wxDataViewItem item( (void*) iter->user_data );
return m_wx_model->HasChildren( item );
}
gint wxGtkTreeModel::iter_n_children( GtkTreeIter *iter )
{
return m_wx_model->HasChildren( item );
}
gint wxGtkTreeModel::iter_n_children( GtkTreeIter *iter )
{
- wxDataViewItem item( (wxUint32) iter->user_data );
+ wxDataViewItem item( (void*) iter->user_data );
if (!m_wx_model->HasChildren( item ))
return 0;
if (!m_wx_model->HasChildren( item ))
return 0;
gboolean wxGtkTreeModel::iter_nth_child( GtkTreeIter *iter, GtkTreeIter *parent, gint n )
{
gboolean wxGtkTreeModel::iter_nth_child( GtkTreeIter *iter, GtkTreeIter *parent, gint n )
{
- wxUint32 id = 0;
- if (parent) id = (wxUint32) parent->user_data;
+ void* id = NULL;
+ if (parent) id = (void*) parent->user_data;
wxDataViewItem item( id );
if (!m_wx_model->HasChildren( item ))
wxDataViewItem item( id );
if (!m_wx_model->HasChildren( item ))
gboolean wxGtkTreeModel::iter_parent( GtkTreeIter *iter, GtkTreeIter *child )
{
gboolean wxGtkTreeModel::iter_parent( GtkTreeIter *iter, GtkTreeIter *child )
{
- wxDataViewItem item( (wxUint32) child->user_data );
+ wxDataViewItem item( (void*) child->user_data );
wxGtkTreeModelNode *node = FindNode( child );
node = node->GetParent();
wxGtkTreeModelNode *node = FindNode( child );
node = node->GetParent();
if (!iter)
return m_root;
if (!iter)
return m_root;
- wxDataViewItem item( (wxUint32) iter->user_data );
+ wxDataViewItem item( (void*) iter->user_data );
wxGtkTreeModelNode *result = wxGtkTreeModel_FindNode( m_root, item );
wxGtkTreeModelNode *result = wxGtkTreeModel_FindNode( m_root, item );
// wxDataViewListModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
// wxDataViewListModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
- unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (treepath)[0];
+ // TODO
+ wxDataViewItem item;
gtk_tree_path_free( treepath );
gtk_tree_path_free( treepath );
- cell->StartEditing( model_row, renderrect );
+ cell->StartEditing( item, renderrect );
wxDataViewModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
wxDataViewModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *treepath = gtk_tree_path_new_from_string( path );
- unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (treepath)[0];
+ // TODO
+ wxDataViewItem item;
gtk_tree_path_free( treepath );
unsigned int model_col = cell->GetOwner()->GetModelColumn();
gtk_tree_path_free( treepath );
unsigned int model_col = cell->GetOwner()->GetModelColumn();
bool ret = false;
// activated by <ENTER>
bool ret = false;
// activated by <ENTER>
- if (cell->Activate( renderrect, model, model_col, model_row ))
+ if (cell->Activate( renderrect, model, item, model_col ))
bool ret = false;
if (button_event->button == 1)
{
bool ret = false;
if (button_event->button == 1)
{
- if (cell->LeftClick( pt, renderrect, model, model_col, model_row ))
+ if (cell->LeftClick( pt, renderrect, model, item, model_col ))
ret = true;
// TODO: query system double-click time
if (button_event->time - wxrenderer->last_click < 400)
ret = true;
// TODO: query system double-click time
if (button_event->time - wxrenderer->last_click < 400)
- if (cell->Activate( renderrect, model, model_col, model_row ))
+ if (cell->Activate( renderrect, model, item, model_col ))
ret = true;
}
if (button_event->button == 3)
{
ret = true;
}
if (button_event->button == 3)
{
- if (cell->RightClick( pt, renderrect, model, model_col, model_row ))
+ if (cell->RightClick( pt, renderrect, model, item, model_col ))
wxDataViewModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *path = gtk_tree_path_new_from_string( arg1 );
wxDataViewModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *path = gtk_tree_path_new_from_string( arg1 );
- unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (path)[0];
+ GtkTreeIter iter;
+ // TODO
+ wxDataViewItem item;
gtk_tree_path_free( path );
unsigned int model_col = cell->GetOwner()->GetModelColumn();
gtk_tree_path_free( path );
unsigned int model_col = cell->GetOwner()->GetModelColumn();
- model->SetValue( value, model_col, model_row );
- model->ValueChanged( model_col, model_row );
+ model->SetValue( value, item, model_col );
+ model->ValueChanged( item, model_col );
}
IMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer)
}
IMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer)
wxDataViewModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *gtk_path = gtk_tree_path_new_from_string( path );
wxDataViewModel *model = cell->GetOwner()->GetOwner()->GetModel();
GtkTreePath *gtk_path = gtk_tree_path_new_from_string( path );
- unsigned int model_row = (unsigned int)gtk_tree_path_get_indices (gtk_path)[0];
+ // TODO
+ wxDataViewItem item;
gtk_tree_path_free( gtk_path );
unsigned int model_col = cell->GetOwner()->GetModelColumn();
gtk_tree_path_free( gtk_path );
unsigned int model_col = cell->GetOwner()->GetModelColumn();
- model->SetValue( value, model_col, model_row );
- model->ValueChanged( model_col, model_row );
+ model->SetValue( value, item, model_col );
+ model->ValueChanged( item, model_col );
}
IMPLEMENT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer)
}
IMPLEMENT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer)
wxDataViewRenderer *cell = (wxDataViewRenderer*) data;
wxDataViewRenderer *cell = (wxDataViewRenderer*) data;
- wxDataViewItem item( (wxUint32) iter->user_data );
+ wxDataViewItem item( (void*) iter->user_data );
wxVariant value;
tree_model->model->GetDataViewModel()->GetValue( value, item, cell->GetOwner()->GetModelColumn() );
wxVariant value;
tree_model->model->GetDataViewModel()->GetValue( value, item, cell->GetOwner()->GetModelColumn() );
GtkTreeIter iter;
if (gtk_tree_selection_get_selected( selection, NULL, &iter ))
{
GtkTreeIter iter;
if (gtk_tree_selection_get_selected( selection, NULL, &iter ))
{
- wxDataViewItem item( (wxUint32) iter.user_data );
+ wxDataViewItem item( (void*) iter.user_data );