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
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
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.
{
public:
protected:
- virtual wxHeaderColumnBase& GetColumn(unsigned int idx)
+ virtual wxHeaderColumnBase& GetColumn(unsigned int idx) const
{
return m_cols[idx];
}
m_sortKey = wxNO_COLUMN;
}
-wxHeaderColumn& wxHeaderCtrlSimple::GetColumn(unsigned int idx)
+const wxHeaderColumn& wxHeaderCtrlSimple::GetColumn(unsigned int idx) const
{
return m_cols[idx];
}
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));
}
}
protected:
- virtual wxHeaderColumn& GetColumn(unsigned int idx)
+ virtual const wxHeaderColumn& GetColumn(unsigned int idx) const
{
return m_columns[idx];
}
int wxHeaderCtrl::GetColStart(unsigned int idx) const
{
- wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
-
int pos = m_scrollOffset;
for ( unsigned n = 0; ; n++ )
{
if ( i == idx )
break;
- const wxHeaderColumn& col = self->GetColumn(i);
+ const wxHeaderColumn& col = GetColumn(i);
if ( col.IsShown() )
pos += col.GetWidth();
}
{
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;