+ if ( GetColumn(i).IsHidden() )
+ idx--; // one less column the native control knows about
+ }
+
+ return idx;
+}
+
+int wxHeaderCtrl::MSWFromNativeIdx(int item)
+{
+ wxASSERT_MSG( item >= 0 && item < GetShownColumnsCount(),
+ "column index out of range" );
+
+ // reverse the above function
+ for ( int i = 0; i <= item; i++ )
+ {
+ if ( GetColumn(i).IsHidden() )
+ item++;
+ }
+
+ return item;
+}
+
+int wxHeaderCtrl::MSWFromNativeOrder(int order)
+{
+ wxASSERT_MSG( order >= 0 && order < GetShownColumnsCount(),
+ "column position out of range" );
+
+ // notice that the loop condition is inclusive because if the column
+ // exactly at position order is hidden we should go to the next one
+ for ( int pos = 0; pos <= order; pos++ )
+ {
+ if ( GetColumn(m_colIndices[pos]).IsHidden() )
+ {
+ // order can't become greater than m_numColumns here because it is
+ // less than the number of shown columns initially and it is going
+ // to be incremented at most once for every hidden column and
+ // m_numColumns is the total columns number
+ order++;
+ }