]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/headerctrlcmn.cpp
Complete rewrite of DoDrawBitmap() and DoBlit().
[wxWidgets.git] / src / common / headerctrlcmn.cpp
index 51282c560c4bef77b48d4a92fb33364f9ee0fd2d..bf24b0456478bff29ce8e9d159e1e29919c65bfa 100644 (file)
@@ -263,24 +263,30 @@ wxHeaderCtrlBase::DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int cou
 // wxHeaderCtrl extra UI
 // ----------------------------------------------------------------------------
 
-bool wxHeaderCtrlBase::ShowColumnsMenu(const wxPoint& pt, const wxString& title)
+void wxHeaderCtrlBase::AddColumnsItems(wxMenu& menu, int idColumnsBase)
 {
-    // construct the menu with the entries for all columns
-    wxMenu menu;
-    if ( !title.empty() )
-        menu.SetTitle(title);
-
     const unsigned count = GetColumnCount();
     for ( unsigned n = 0; n < count; n++ )
     {
         const wxHeaderColumn& col = GetColumn(n);
-        menu.AppendCheckItem(n, col.GetTitle());
+        menu.AppendCheckItem(idColumnsBase + n, col.GetTitle());
         if ( col.IsShown() )
             menu.Check(n, true);
     }
+}
+
+bool wxHeaderCtrlBase::ShowColumnsMenu(const wxPoint& pt, const wxString& title)
+{
+    // construct the menu with the entries for all columns
+    wxMenu menu;
+    if ( !title.empty() )
+        menu.SetTitle(title);
+
+    AddColumnsItems(menu);
 
     // ... and an extra one to show the customization dialog if the user is
     // allowed to reorder the columns too
+    const unsigned count = GetColumnCount();
     if ( HasFlag(wxHD_ALLOW_REORDER) )
     {
         menu.AppendSeparator();
@@ -366,7 +372,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];
 }