made wxHeaderCtrl::GetColumn() const to get rid of the const_cast<>s
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
af67f39da8
commit
482d06f8b5
@ -154,7 +154,7 @@ public:
|
||||
protected:
|
||||
// this method must be implemented by the derived classes to return the
|
||||
// information for the given column
|
||||
virtual wxHeaderColumn& GetColumn(unsigned int idx) = 0;
|
||||
virtual const wxHeaderColumn& GetColumn(unsigned int idx) const = 0;
|
||||
|
||||
// this method is called from the default EVT_HEADER_SEPARATOR_DCLICK
|
||||
// handler to update the fitting column width of the given column, it
|
||||
@ -311,7 +311,7 @@ public:
|
||||
|
||||
protected:
|
||||
// implement/override base class methods
|
||||
virtual wxHeaderColumn& GetColumn(unsigned int idx);
|
||||
virtual const wxHeaderColumn& GetColumn(unsigned int idx) const;
|
||||
virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle);
|
||||
|
||||
// and define another one to be overridden in the derived classes: it
|
||||
|
@ -354,7 +354,7 @@ protected:
|
||||
The column index, between 0 and the value last passed to
|
||||
SetColumnCount().
|
||||
*/
|
||||
virtual wxHeaderColumnBase& GetColumn(unsigned int idx) = 0;
|
||||
virtual const wxHeaderColumnBase& GetColumn(unsigned int idx) const = 0;
|
||||
|
||||
/**
|
||||
Method called when the column visibility is changed by the user.
|
||||
@ -426,7 +426,7 @@ protected:
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
virtual wxHeaderColumnBase& GetColumn(unsigned int idx)
|
||||
virtual wxHeaderColumnBase& GetColumn(unsigned int idx) const
|
||||
{
|
||||
return m_cols[idx];
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ void wxHeaderCtrlSimple::Init()
|
||||
m_sortKey = wxNO_COLUMN;
|
||||
}
|
||||
|
||||
wxHeaderColumn& wxHeaderCtrlSimple::GetColumn(unsigned int idx)
|
||||
const wxHeaderColumn& wxHeaderCtrlSimple::GetColumn(unsigned int idx) const
|
||||
{
|
||||
return m_cols[idx];
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
protected:
|
||||
// implement/override wxHeaderCtrl functions by forwarding them to the main
|
||||
// control
|
||||
virtual wxHeaderColumn& GetColumn(unsigned int idx)
|
||||
virtual const wxHeaderColumn& GetColumn(unsigned int idx) const
|
||||
{
|
||||
return *(GetOwner()->GetColumn(idx));
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual wxHeaderColumn& GetColumn(unsigned int idx)
|
||||
virtual const wxHeaderColumn& GetColumn(unsigned int idx) const
|
||||
{
|
||||
return m_columns[idx];
|
||||
}
|
||||
|
@ -145,8 +145,6 @@ wxSize wxHeaderCtrl::DoGetBestSize() const
|
||||
|
||||
int wxHeaderCtrl::GetColStart(unsigned int idx) const
|
||||
{
|
||||
wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
|
||||
|
||||
int pos = m_scrollOffset;
|
||||
for ( unsigned n = 0; ; n++ )
|
||||
{
|
||||
@ -154,7 +152,7 @@ int wxHeaderCtrl::GetColStart(unsigned int idx) const
|
||||
if ( i == idx )
|
||||
break;
|
||||
|
||||
const wxHeaderColumn& col = self->GetColumn(i);
|
||||
const wxHeaderColumn& col = GetColumn(i);
|
||||
if ( col.IsShown() )
|
||||
pos += col.GetWidth();
|
||||
}
|
||||
@ -166,19 +164,17 @@ int wxHeaderCtrl::GetColEnd(unsigned int idx) const
|
||||
{
|
||||
int x = GetColStart(idx);
|
||||
|
||||
return x + const_cast<wxHeaderCtrl *>(this)->GetColumn(idx).GetWidth();
|
||||
return x + GetColumn(idx).GetWidth();
|
||||
}
|
||||
|
||||
unsigned int wxHeaderCtrl::FindColumnAtPoint(int x, bool *onSeparator) const
|
||||
{
|
||||
wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
|
||||
|
||||
int pos = 0;
|
||||
const unsigned count = GetColumnCount();
|
||||
for ( unsigned n = 0; n < count; n++ )
|
||||
{
|
||||
const unsigned idx = m_colIndices[n];
|
||||
const wxHeaderColumn& col = self->GetColumn(idx);
|
||||
const wxHeaderColumn& col = GetColumn(idx);
|
||||
if ( col.IsHidden() )
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user