]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/propgrid.cpp
Use template class instead of template function in wxVectorSort().
[wxWidgets.git] / samples / propgrid / propgrid.cpp
index 18a3584628475c76270cb5f0aef35f3fc599c9af..b546314ab4f83a61f3e8ba8bbcf5bd7c6dda7dc2 100644 (file)
@@ -750,7 +750,7 @@ BEGIN_EVENT_TABLE(FormMain, wxFrame)
     EVT_MENU( ID_DELETEALL, FormMain::OnClearClick )
     EVT_MENU( ID_ENABLE, FormMain::OnEnableDisable )
     EVT_MENU( ID_SETREADONLY, FormMain::OnSetReadOnly )
-    EVT_MENU( ID_HIDE, FormMain::OnHideShow )
+    EVT_MENU( ID_HIDE, FormMain::OnHide )
 
     EVT_MENU( ID_ITERATE1, FormMain::OnIterate1Click )
     EVT_MENU( ID_ITERATE2, FormMain::OnIterate2Click )
@@ -1845,6 +1845,15 @@ void FormMain::PopulateWithLibraryConfig ()
     wxPropertyGridManager* pgman = m_pPropGridManager;
     wxPropertyGridPage* pg = pgman->GetPage(wxT("wxWidgets Library Config"));
 
+    // Set custom column proportions (here in the sample app we need
+    // to check if the grid has wxPG_SPLITTER_AUTO_CENTER style. You usually
+    // need not to do it in your application).
+    if ( pgman->HasFlag(wxPG_SPLITTER_AUTO_CENTER) )
+    {
+        pg->SetColumnProportion(0, 3);
+        pg->SetColumnProportion(1, 1);
+    }
+
     wxPGProperty* cat;
 
     wxBitmap bmp = wxArtProvider::GetBitmap(wxART_REPORT_VIEW);
@@ -2285,7 +2294,7 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
     m_itemEnable = menuTools1->Append(ID_ENABLE, wxT("Enable"),
         wxT("Toggles item's enabled state.") );
     m_itemEnable->Enable( FALSE );
-    menuTools1->Append(ID_HIDE, wxT("Hide"), wxT("Shows or hides a property") );
+    menuTools1->Append(ID_HIDE, "Hide", "Hides a property" );
     menuTools1->Append(ID_SETREADONLY, "Set as Read-Only",
                        "Set property as read-only" );
 
@@ -2748,7 +2757,7 @@ void FormMain::OnSetReadOnly( wxCommandEvent& WXUNUSED(event) )
 
 // -----------------------------------------------------------------------
 
-void FormMain::OnHideShow( wxCommandEvent& WXUNUSED(event) )
+void FormMain::OnHide( wxCommandEvent& WXUNUSED(event) )
 {
     wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection();
     if ( !id )
@@ -2757,27 +2766,7 @@ void FormMain::OnHideShow( wxCommandEvent& WXUNUSED(event) )
         return;
     }
 
-    if ( m_pPropGridManager->IsPropertyShown( id ) )
-    {
-        m_pPropGridManager->HideProperty( id, true );
-        m_itemEnable->SetItemLabel( wxT("Show") );
-    }
-    else
-    {
-        m_pPropGridManager->HideProperty( id, false );
-        m_itemEnable->SetItemLabel( wxT("Hide") );
-    }
-
-    wxPropertyGridPage* curPage = m_pPropGridManager->GetCurrentPage();
-
-    // Check for bottomY precalculation validity
-    unsigned int byPre = curPage->GetVirtualHeight();
-    unsigned int byAct = curPage->GetActualVirtualHeight();
-
-    if ( byPre != byAct )
-    {
-        wxLogDebug(wxT("VirtualHeight is %u, should be %u"), byPre, byAct);
-    }
+    m_pPropGridManager->HideProperty( id, true );
 }
 
 // -----------------------------------------------------------------------