From: Guillermo Rodriguez Garcia <guille@iies.es>
Date: Wed, 9 Feb 2000 20:52:12 +0000 (+0000)
Subject: Zooming buttons / menu options automatically disabled when needed
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a9cf40974a0952d0e3c808c0e01c4db7a069dd22

Zooming buttons / menu options automatically disabled when needed


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/demos/life/life.cpp b/demos/life/life.cpp
index 891eacd0f0..ea39345fd4 100644
--- a/demos/life/life.cpp
+++ b/demos/life/life.cpp
@@ -240,11 +240,19 @@ void LifeFrame::UpdateInfoText()
 // way to do this.
 void LifeFrame::UpdateUI()
 {
+    // start / stop
     GetToolBar()->EnableTool(ID_START, !m_running);
     GetToolBar()->EnableTool(ID_STOP,  m_running);
     GetMenuBar()->GetMenu(1)->Enable(ID_START, !m_running);
     GetMenuBar()->GetMenu(1)->Enable(ID_STEP,  !m_running);
     GetMenuBar()->GetMenu(1)->Enable(ID_STOP,  m_running);
+
+    // zooming
+    int cellsize = m_canvas->GetCellSize();
+    GetToolBar()->EnableTool(ID_ZOOMIN,  cellsize < 32);
+    GetToolBar()->EnableTool(ID_ZOOMOUT, cellsize > 1);
+    GetMenuBar()->GetMenu(1)->Enable(ID_ZOOMIN,  cellsize < 32);
+    GetMenuBar()->GetMenu(1)->Enable(ID_ZOOMOUT, cellsize > 1);
 }
 
 // event handlers
@@ -260,14 +268,20 @@ void LifeFrame::OnMenu(wxCommandEvent& event)
         {
             int cellsize = m_canvas->GetCellSize();
             if (cellsize < 32)
+            {
                 m_canvas->SetCellSize(cellsize * 2);
+                UpdateUI();
+            }
             break;
         }
         case ID_ZOOMOUT :
         {
             int cellsize = m_canvas->GetCellSize();
             if (cellsize > 1)
+            {
                 m_canvas->SetCellSize(cellsize / 2);
+                UpdateUI();
+            }
             break;
         }
         case ID_TOPSPEED: