wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
- owner->CanDragColMove() ? wxHD_DRAGDROP : 0)
+ wxHD_ALLOW_HIDE |
+ (owner->CanDragColMove() ? wxHD_ALLOW_REORDER : 0))
{
}
protected:
- virtual wxHeaderColumn& GetColumn(unsigned int idx)
+ virtual const wxHeaderColumn& GetColumn(unsigned int idx) const
{
return m_columns[idx];
}
return true;
}
+ // overridden to react to the actions using the columns popup menu
+ virtual void UpdateColumnVisibility(unsigned int idx, bool show)
+ {
+ GetOwner()->SetColSize(idx, show ? wxGRID_AUTOSIZE : 0);
+
+ // as this is done by the user we should notify the main program about
+ // it
+ GetOwner()->SendEvent(wxEVT_GRID_COL_SIZE, -1, idx);
+ }
+
+ // overridden to react to the columns order changes in the customization
+ // dialog
+ virtual void UpdateColumnsOrder(const wxArrayInt& order)
+ {
+ GetOwner()->SetColumnsOrder(order);
+ }
+
// event handlers forwarding wxHeaderCtrl events to wxGrid
void OnClick(wxHeaderCtrlEvent& event)
m_numCols = table->GetNumberCols();
if ( m_useNativeHeader )
- GetColHeader()->SetColumnCount(m_numCols);
+ GetGridColHeader()->SetColumnCount(m_numCols);
m_table = table;
m_table->SetView( this );
m_numCols += numCols;
if ( m_useNativeHeader )
- GetColHeader()->SetColumnCount(m_numCols);
+ GetGridColHeader()->SetColumnCount(m_numCols);
if ( !m_colAt.IsEmpty() )
{
int oldNumCols = m_numCols;
m_numCols += numCols;
if ( m_useNativeHeader )
- GetColHeader()->SetColumnCount(m_numCols);
+ GetGridColHeader()->SetColumnCount(m_numCols);
if ( !m_colAt.IsEmpty() )
{
int numCols = msg.GetCommandInt2();
m_numCols -= numCols;
if ( m_useNativeHeader )
- GetColHeader()->SetColumnCount(m_numCols);
+ GetGridColHeader()->SetColumnCount(m_numCols);
if ( !m_colAt.IsEmpty() )
{
wxCHECK_RET( col != wxNOT_FOUND, "invalid column index" );
if ( m_useNativeHeader )
- GetColHeader()->UpdateColumn(col);
+ GetGridColHeader()->UpdateColumn(col);
else if ( m_nativeColumnLabels )
m_colWindow->Refresh();
//else: sorting indicator display not yet implemented in grid version
if ( m_useNativeHeader )
{
if ( m_colAt.empty() )
- GetColHeader()->ResetColumnsOrder();
+ GetGridColHeader()->ResetColumnsOrder();
else
- GetColHeader()->SetColumnsOrder(m_colAt);
+ GetGridColHeader()->SetColumnsOrder(m_colAt);
}
else
{
m_gridWin->Refresh();
}
+void wxGrid::SetColumnsOrder(const wxArrayInt& order)
+{
+ m_colAt = order;
+
+ RefreshAfterColPosChange();
+}
+
void wxGrid::SetColPos(int idx, int pos)
{
// we're going to need m_colAt now, initialize it if needed
if ( m_useNativeHeader )
{
// update all columns to make them [not] reorderable
- GetColHeader()->SetColumnCount(m_numCols);
+ GetGridColHeader()->SetColumnCount(m_numCols);
}
m_canDragColMove = enable;
CreateColumnWindow();
if ( m_useNativeHeader )
- GetColHeader()->SetColumnCount(m_numCols);
+ GetGridColHeader()->SetColumnCount(m_numCols);
CalcWindowSizes();
}
{
if ( m_useNativeHeader )
{
- GetColHeader()->UpdateColumn(col);
+ GetGridColHeader()->UpdateColumn(col);
}
else
{
const int diff = width - m_colWidths[col];
m_colWidths[col] = width;
if ( m_useNativeHeader )
- GetColHeader()->UpdateColumn(col);
+ GetGridColHeader()->UpdateColumn(col);
//else: will be refreshed when the header is redrawn
for ( int colPos = GetColPos(col); colPos < m_numCols; colPos++ )
{
if ( m_useNativeHeader )
{
- GetColHeader()->UpdateColumn(col);
+ GetGridColHeader()->UpdateColumn(col);
}
else
{