]> git.saurik.com Git - wxWidgets.git/blobdiff - demos/life/life.cpp
fixed creation of the dialogs with a simple (non 3D, non resizeable) border; also...
[wxWidgets.git] / demos / life / life.cpp
index f01e3e0be77de9375d53e71a67671a3fb1fb0b73..cf63a5124a3e1a958381ccbcdc879d4dbc298403 100644 (file)
@@ -41,7 +41,7 @@
 // resources
 // --------------------------------------------------------------------------
 
 // resources
 // --------------------------------------------------------------------------
 
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
     // application icon
     #include "mondrian.xpm"
 
     // application icon
     #include "mondrian.xpm"
 
@@ -443,7 +443,7 @@ void LifeFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
 
     if (filedlg.ShowModal() == wxID_OK)
     {
 
     if (filedlg.ShowModal() == wxID_OK)
     {
-        wxFileInputStream stream(filedlg.GetFilename());
+        wxFileInputStream stream(filedlg.GetPath());
         LifeReader reader(stream);
 
         // the reader handles errors itself, no need to do anything here
         LifeReader reader(stream);
 
         // the reader handles errors itself, no need to do anything here
@@ -503,7 +503,7 @@ void LifeFrame::OnZoom(wxCommandEvent& event)
 
 void LifeFrame::OnNavigate(wxCommandEvent& event)
 {
 
 void LifeFrame::OnNavigate(wxCommandEvent& event)
 {
-    Cell c;
+    LifeCell c;
 
     switch (event.GetId())
     {
 
     switch (event.GetId())
     {
@@ -602,7 +602,7 @@ LifeNavigator::LifeNavigator(wxWindow *parent)
         bmpe = wxBITMAP(east),  
         bmps = wxBITMAP(south);
 
         bmpe = wxBITMAP(east),  
         bmps = wxBITMAP(south);
 
-#if !defined(__WXGTK__) && !defined(__WXMOTIF__)
+#if !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXMAC__)
     bmpn.SetMask(new wxMask(bmpn, *wxLIGHT_GREY));
     bmpw.SetMask(new wxMask(bmpw, *wxLIGHT_GREY));
     bmpc.SetMask(new wxMask(bmpc, *wxLIGHT_GREY));
     bmpn.SetMask(new wxMask(bmpn, *wxLIGHT_GREY));
     bmpw.SetMask(new wxMask(bmpw, *wxLIGHT_GREY));
     bmpc.SetMask(new wxMask(bmpc, *wxLIGHT_GREY));
@@ -772,7 +772,7 @@ void LifeCanvas::DrawChanged()
     wxClientDC dc(this);
 
     size_t ncells;
     wxClientDC dc(this);
 
     size_t ncells;
-    Cell *cells;
+    LifeCell *cells;
     bool done = FALSE;
 
     m_life->BeginFind(m_viewportX,
     bool done = FALSE;
 
     m_life->BeginFind(m_viewportX,
@@ -824,7 +824,7 @@ void LifeCanvas::OnPaint(wxPaintEvent& event)
     j1 = YToCell(y + h - 1);
 
     size_t ncells;
     j1 = YToCell(y + h - 1);
 
     size_t ncells;
-    Cell *cells;
+    LifeCell *cells;
     bool done = FALSE;
 
     m_life->BeginFind(i0, j0, i1, j1, FALSE);
     bool done = FALSE;
 
     m_life->BeginFind(i0, j0, i1, j1, FALSE);
@@ -1021,48 +1021,61 @@ void LifeCanvas::OnScroll(wxScrollWinEvent& event)
 
     // calculate scroll increment
     int scrollinc = 0;
 
     // calculate scroll increment
     int scrollinc = 0;
-    switch (type)
+    if (type == wxEVT_SCROLLWIN_TOP)
     {
     {
-        case wxEVT_SCROLLWIN_TOP:
-        {
-            if (orient == wxHORIZONTAL)
-                scrollinc = -m_viewportW;
-            else
-                scrollinc = -m_viewportH;
-            break;    
-        }
-        case wxEVT_SCROLLWIN_BOTTOM:
-        {
-            if (orient == wxHORIZONTAL)
-                scrollinc = m_viewportW;
-            else
-                scrollinc = m_viewportH;
-            break;    
-        }
-        case wxEVT_SCROLLWIN_LINEUP:   scrollinc = -1; break;
-        case wxEVT_SCROLLWIN_LINEDOWN: scrollinc = +1; break;
-        case wxEVT_SCROLLWIN_PAGEUP:   scrollinc = -10; break;
-        case wxEVT_SCROLLWIN_PAGEDOWN: scrollinc = +10; break;
-        case wxEVT_SCROLLWIN_THUMBTRACK:
+        if (orient == wxHORIZONTAL)
+            scrollinc = -m_viewportW;
+        else
+            scrollinc = -m_viewportH;
+    }
+    else
+    if (type == wxEVT_SCROLLWIN_BOTTOM)
+    {
+        if (orient == wxHORIZONTAL)
+            scrollinc = m_viewportW;
+        else
+            scrollinc = m_viewportH;
+    }
+    else
+    if (type == wxEVT_SCROLLWIN_LINEUP)
+    {
+        scrollinc = -1;
+    }
+    else
+    if (type == wxEVT_SCROLLWIN_LINEDOWN)
+    {
+        scrollinc = +1;
+    }
+    else
+    if (type == wxEVT_SCROLLWIN_PAGEUP)
+    {
+        scrollinc = -10;
+    }
+    else
+    if (type == wxEVT_SCROLLWIN_PAGEDOWN)
+    {
+        scrollinc = -10;
+    }
+    else
+    if (type == wxEVT_SCROLLWIN_THUMBTRACK)
+    {
+        if (orient == wxHORIZONTAL)
         {
         {
-            if (orient == wxHORIZONTAL)
-            {
-                scrollinc = pos - m_thumbX;
-                m_thumbX = pos;
-            }
-            else
-            {
-                scrollinc = pos - m_thumbY;
-                m_thumbY = pos;
-            }
-            break;
+            scrollinc = pos - m_thumbX;
+            m_thumbX = pos;
         }
         }
-        case wxEVT_SCROLLWIN_THUMBRELEASE:
+        else
         {
         {
-            m_thumbX = m_viewportW;
-            m_thumbY = m_viewportH;
+            scrollinc = pos - m_thumbY;
+            m_thumbY = pos;
         }
     }
         }
     }
+    else
+    if (type == wxEVT_SCROLLWIN_THUMBRELEASE)
+    {
+        m_thumbX = m_viewportW;
+        m_thumbY = m_viewportH;
+    }
 
 #if defined(__WXGTK__) || defined(__WXMOTIF__)
     // wxGTK and wxMotif update the thumb automatically (wxMSW doesn't);
 
 #if defined(__WXGTK__) || defined(__WXMOTIF__)
     // wxGTK and wxMotif update the thumb automatically (wxMSW doesn't);