m_sort = false;
m_sortAscending = true;
}
-
+
void wxDataViewColumn::UpdateDisplay()
{
if (m_owner)
void ScrollWindow( int dx, int dy, const wxRect *rect = NULL );
void ScrollTo( int rows, int column );
+ unsigned GetCurrentRow() const { return m_currentRow; }
bool HasCurrentRow() { return m_currentRow != (unsigned int)-1; }
void ChangeCurrentRow( unsigned int row );
bool wxDataViewMainWindow::Cleared()
{
DestroyTree();
+ m_selection.Clear();
SortPrepare();
BuildTree( GetOwner()->GetModel() );
return;
}
+ // set the focus to ourself if any of the mouse buttons are pressed
+ if(event.ButtonDown() && !HasFocus())
+ SetFocus();
+
int x = event.GetX();
int y = event.GetY();
m_owner->CalcUnscrolledPosition( x, y, &x, &y );
}
else if ((event.LeftDown() || simulateClick) && !hoverOverExpander)
{
- SetFocus();
-
m_lineBeforeLastClicked = m_lineLastClicked;
m_lineLastClicked = current;
else if ( align & wxALIGN_BOTTOM )
rectItem.y += cell_rect.height - size.y;
// else: wxALIGN_TOP is the default
- }
+ }
}
wxPoint pos( event.GetPosition() );
if (column==col)
return i;
}
-
+
return wxNOT_FOUND;
#else
// This returns the position in pixels which is not what we want.
: GetColumn(m_sortingColumnIdx);
}
+wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
+{
+ return GetItemByRow(m_clientArea->GetCurrentRow());
+}
+
+void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
+{
+ const int row = m_clientArea->GetRowByItem(item);
+
+ const unsigned oldCurrent = m_clientArea->GetCurrentRow();
+ if ( static_cast<unsigned>(row) != oldCurrent )
+ {
+ m_clientArea->ChangeCurrentRow(row);
+ m_clientArea->RefreshRow(oldCurrent);
+ m_clientArea->RefreshRow(row);
+ }
+}
+
// Selection code with wxDataViewItem as parameters
wxDataViewItem wxDataViewCtrl::GetSelection() const
{
// Unselect all rows before select another in the single select mode
if (m_clientArea->IsSingleSel())
m_clientArea->SelectAllRows(false);
-
+
m_clientArea->SelectRow(row, true);
-
+
// Also set focus to the selected item
m_clientArea->ChangeCurrentRow( row );
}
void wxDataViewCtrl::Expand( const wxDataViewItem & item )
{
+ ExpandAncestors( item );
+
int row = m_clientArea->GetRowByItem( item );
if (row != -1)
m_clientArea->Expand(row);