unsigned int GetFirstVisibleRow() const;
//I change this method to un const because in the tree view, the displaying number of the tree are changing along with the expanding/collapsing of the tree nodes
unsigned int GetLastVisibleRow();
unsigned int GetFirstVisibleRow() const;
//I change this method to un const because in the tree view, the displaying number of the tree are changing along with the expanding/collapsing of the tree nodes
unsigned int GetLastVisibleRow();
//We did not need this temporarily
//wxDataViewTreeNode * GetTreeNodeByItem( const wxDataViewItem & item );
//We did not need this temporarily
//wxDataViewTreeNode * GetTreeNodeByItem( const wxDataViewItem & item );
wxDataViewEvent SendExpanderEvent( wxEventType type, const wxDataViewItem & item );
void OnExpanding( unsigned int row );
wxDataViewEvent SendExpanderEvent( wxEventType type, const wxDataViewItem & item );
void OnExpanding( unsigned int row );
m_buttonHeight = wxRendererNative::Get().GetHeaderButtonHeight( this );
int x = pos.x == wxDefaultCoord ? 0 : pos.x,
m_buttonHeight = wxRendererNative::Get().GetHeaderButtonHeight( this );
int x = pos.x == wxDefaultCoord ? 0 : pos.x,
// we need to subclass the m_hWnd to force wxWindow::HandleNotify
// to call wxDataViewHeaderWindow::MSWOnNotify
// we need to subclass the m_hWnd to force wxWindow::HandleNotify
// to call wxDataViewHeaderWindow::MSWOnNotify
- // user has started to reorder a column
- if ((nmHDR->iItem != -1) && (!GetColumn(nmHDR->iItem)->IsReorderable()))
+ // valid column
+ if (nmHDR->iItem != -1)
+ {
+ // user has started to reorder a valid column
+ if ((m_vetoColumnDrag == true) || (!GetColumn(nmHDR->iItem)->IsReorderable()))
+ {
+ // veto it!
+ *result = TRUE;
+ m_vetoColumnDrag = true;
+ }
+ }
+ else
m_root->SetHasChildren(true);
//Make m_count = -1 will cause the class recaculate the real displaying number of rows.
m_root->SetHasChildren(true);
//Make m_count = -1 will cause the class recaculate the real displaying number of rows.
// change the cell_rect.x to the appropriate pos
int expander_x = indent + EXPANDER_MARGIN;
int expander_y = cell_rect.y + EXPANDER_MARGIN + (GetLineHeight(item) / 2) - (expander_width/2) - EXPANDER_OFFSET;
// change the cell_rect.x to the appropriate pos
int expander_x = indent + EXPANDER_MARGIN;
int expander_y = cell_rect.y + EXPANDER_MARGIN + (GetLineHeight(item) / 2) - (expander_width/2) - EXPANDER_OFFSET;
dc.SetPen( m_penExpander );
dc.SetBrush( wxNullBrush );
if( node->HasChildren() )
dc.SetPen( m_penExpander );
dc.SetBrush( wxNullBrush );
if( node->HasChildren() )
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
//The return value control how the tree-walker tranverse the tree
// 0: Job done, stop tranverse and return
// 1: Ignore the current node's subtree and continue
// 2: Job not done, continue
enum { OK = 0 , IGR = 1, CONT = 2 };
//The return value control how the tree-walker tranverse the tree
// 0: Job done, stop tranverse and return
// 1: Ignore the current node's subtree and continue
// 2: Job not done, continue
enum { OK = 0 , IGR = 1, CONT = 2 };
wxDataViewTreeNode * n = NULL;
wxDataViewTreeNodes nodes = node->GetNodes();
int len = nodes.GetCount();
wxDataViewTreeNode * n = NULL;
wxDataViewTreeNodes nodes = node->GetNodes();
int len = nodes.GetCount();
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
{
// Yes, if the node does not have any child, it must be a leaf which
// mean that it is a temporarily created by GetTreeNodeByRow
- RowToItemJob( unsigned int row , int current ) { this->row = row; this->current = current ;}
- virtual ~RowToItemJob(){};
+ RowToItemJob( unsigned int row , int current ) { this->row = row; this->current = current;}
+ virtual ~RowToItemJob() { }
//Find the item along the parent-chain.
//This algorithm is designed to speed up the node-finding method
wxDataViewTreeNode * node = m_root;
//Find the item along the parent-chain.
//This algorithm is designed to speed up the node-finding method
wxDataViewTreeNode * node = m_root;
- ItemToRowJob(const wxDataViewItem & item, ItemList::const_iterator iter )
- { this->item = item ; ret = -1 ; m_iter = iter ; }
- virtual ~ItemToRowJob(){};
+ ItemToRowJob(const wxDataViewItem& item_, ItemList::const_iterator iter)
+ : m_iter(iter),
+ item(item_)
+ {
+ ret = -1;
+ }
//Maybe binary search will help to speed up this process
virtual int operator() ( wxDataViewTreeNode * node)
//Maybe binary search will help to speed up this process
virtual int operator() ( wxDataViewTreeNode * node)
static void BuildTreeHelper( wxDataViewModel * model, wxDataViewItem & item, wxDataViewTreeNode * node)
{
if( !model->IsContainer( item ) )
static void BuildTreeHelper( wxDataViewModel * model, wxDataViewItem & item, wxDataViewTreeNode * node)
{
if( !model->IsContainer( item ) )
wxDataViewItemArray children;
unsigned int num = model->GetChildren( item, children);
wxDataViewItemArray children;
unsigned int num = model->GetChildren( item, children);
void wxDataViewCtrl::ColumnMoved( wxDataViewColumn* col, unsigned int new_pos )
{
if (new_pos > m_cols.GetCount()) return;
void wxDataViewCtrl::ColumnMoved( wxDataViewColumn* col, unsigned int new_pos )
{
if (new_pos > m_cols.GetCount()) return;
m_cols.DeleteObject( col );
m_cols.Insert( new_pos, col );
m_cols.DeleteObject( col );
m_cols.Insert( new_pos, col );