Support NULL column in wxDataViewCtrl::GetItemRect() in wxOSX
Emulate support for non-specified column by using the first and, if necessary, last columns in this case.
This commit is contained in:
@@ -1462,9 +1462,7 @@ public:
|
|||||||
intersection of the item with the specified column. If @NULL, the
|
intersection of the item with the specified column. If @NULL, the
|
||||||
rectangle spans all the columns.
|
rectangle spans all the columns.
|
||||||
|
|
||||||
@note This method is currently not implemented at all in wxGTK and only
|
@note This method is currently not implemented in wxGTK.
|
||||||
implemented for non-@NULL @a col argument in wxOSX. It is fully
|
|
||||||
implemented in the generic version of the control.
|
|
||||||
*/
|
*/
|
||||||
virtual wxRect GetItemRect(const wxDataViewItem& item,
|
virtual wxRect GetItemRect(const wxDataViewItem& item,
|
||||||
const wxDataViewColumn* col = NULL) const;
|
const wxDataViewColumn* col = NULL) const;
|
||||||
|
@@ -547,10 +547,24 @@ wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const
|
|||||||
|
|
||||||
wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
|
wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
|
||||||
{
|
{
|
||||||
if (item.IsOk() && (columnPtr != NULL))
|
if ( !item.IsOk() )
|
||||||
return GetDataViewPeer()->GetRectangle(item,columnPtr);
|
return wxRect();
|
||||||
else
|
|
||||||
return wxRect();
|
wxRect rect = GetDataViewPeer()->GetRectangle(item, columnPtr ? columnPtr : GetColumn(0));
|
||||||
|
|
||||||
|
if ( !columnPtr )
|
||||||
|
{
|
||||||
|
const unsigned columnCount = GetColumnCount();
|
||||||
|
if ( columnCount != 1 )
|
||||||
|
{
|
||||||
|
// Extend the rectangle to the rightmost part of the last column.
|
||||||
|
const wxRect rectLastCol = GetDataViewPeer()->GetRectangle(item, GetColumn(columnCount - 1));
|
||||||
|
rect.SetRight(rectLastCol.GetRight());
|
||||||
|
}
|
||||||
|
//else: We already have the rectangle we need.
|
||||||
|
}
|
||||||
|
|
||||||
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDataViewCtrl::GetSelectedItemsCount() const
|
int wxDataViewCtrl::GetSelectedItemsCount() const
|
||||||
|
Reference in New Issue
Block a user