X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7cda9b290e16af1c37c37cafcdb1ce031243cd0..85b6f1c431640d51535955da7d57383684fc0e27:/src/generic/datavgen.cpp diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 794a94a966..ed190733d2 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -153,6 +153,8 @@ public: virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + + virtual bool AcceptsFocusFromKeyboard() const { return false; } protected: virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); @@ -2093,7 +2095,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) // compute which columns needs to be redrawn unsigned int cols = GetOwner()->GetColumnCount(); unsigned int col_start = 0; - unsigned int x_start = 0; + unsigned int x_start; for (x_start = 0; col_start < cols; col_start++) { wxDataViewColumn *col = GetOwner()->GetColumn(col_start); @@ -2651,7 +2653,7 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column ) { wxRect rect = GetClientRect(); int colnum = 0; - int x_start = 0, x_end = 0, w = 0; + int x_start, w = 0; int xx, yy, xe; m_owner->CalcUnscrolledPosition( rect.x, rect.y, &xx, &yy ); for (x_start = 0; colnum < column; colnum++) @@ -2664,7 +2666,7 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column ) x_start += w; } - x_end = x_start + w; + int x_end = x_start + w; xe = xx + rect.width; if( x_end > xe ) { @@ -2691,7 +2693,7 @@ int wxDataViewMainWindow::GetEndOfLastCol() const for (i = 0; i < GetOwner()->GetColumnCount(); i++) { const wxDataViewColumn *c = - wx_const_cast(wxDataViewCtrl*, GetOwner())->GetColumn( i ); + const_cast(GetOwner())->GetColumn( i ); if (!c->IsHidden()) width += c->GetWidth(); @@ -3318,7 +3320,7 @@ void wxDataViewMainWindow::OnCollapsing(unsigned int row) { if (IsVirtualList()) return; - + wxDataViewTreeNode * node = GetTreeNodeByRow(row); if( node != NULL ) { @@ -3414,10 +3416,9 @@ void wxDataViewMainWindow::HitTest( const wxPoint & point, wxDataViewItem & item wxDataViewColumn *col = NULL; unsigned int cols = GetOwner()->GetColumnCount(); unsigned int colnum = 0; - unsigned int x_start = 0; int x, y; m_owner->CalcUnscrolledPosition( point.x, point.y, &x, &y ); - for (x_start = 0; colnum < cols; colnum++) + for (unsigned x_start = 0; colnum < cols; colnum++) { col = GetOwner()->GetColumn(colnum); if (col->IsHidden()) @@ -3536,7 +3537,7 @@ int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const //Compose the a parent-chain of the finding item ItemList list; - wxDataViewItem * pItem = NULL; + wxDataViewItem * pItem; list.DeleteContents( true ); wxDataViewItem it( item ); while( it.IsOk() ) @@ -3631,7 +3632,7 @@ void wxDataViewMainWindow::DestroyTree() void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) { - if ( HandleAsNavigationKey(event) ) + if ( GetParent()->HandleAsNavigationKey(event) ) return; // no item -> nothing to do @@ -4093,6 +4094,10 @@ void wxDataViewCtrl::Init() { m_cols.DeleteContents(true); m_notifier = NULL; + + // No sorting column at start + m_sortingColumn = NULL; + m_headerArea = NULL; } bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, @@ -4102,14 +4107,14 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, if ( (style & wxBORDER_MASK) == 0) style |= wxBORDER_SUNKEN; + Init(); + if (!wxControl::Create( parent, id, pos, size, style | wxScrolledWindowStyle, validator)) return false; SetInitialSize(size); - Init(); - #ifdef __WXMAC__ MacSetClipChildren( true ); #endif @@ -4156,7 +4161,7 @@ wxSize wxDataViewCtrl::GetSizeAvailableForScrollTarget(const wxSize& size) wxSize newsize = size; if (!HasFlag(wxDV_NO_HEADER) && (m_headerArea)) newsize.y -= m_headerArea->GetSize().y; - + return newsize; } @@ -4174,6 +4179,12 @@ void wxDataViewCtrl::OnSize( wxSizeEvent &WXUNUSED(event) ) AdjustScrollbars(); } +void wxDataViewCtrl::SetFocus() +{ + if (m_clientArea) + m_clientArea->SetFocus(); +} + bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model ) { if (!wxDataViewCtrlBase::AssociateModel( model ))