From: Robert Roebling <robert@roebling.de>
Date: Tue, 23 Jan 2001 18:38:42 +0000 (+0000)
Subject:   Change required for new event types.
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1a8caf94abb82772c1baf37c8fb820def3c06798

  Change required for new event types.


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

diff --git a/src/generic/scrolwin.cpp b/src/generic/scrolwin.cpp
index 18939cb0b8..f561950be3 100644
--- a/src/generic/scrolwin.cpp
+++ b/src/generic/scrolwin.cpp
@@ -287,63 +287,49 @@ int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event)
     int orient = event.GetOrientation();
 
     int nScrollInc = 0;
-    switch (event.GetEventType())
+    if (event.GetEventType() == wxEVT_SCROLLWIN_TOP)
     {
-        case wxEVT_SCROLLWIN_TOP:
-        {
             if (orient == wxHORIZONTAL)
                 nScrollInc = - m_xScrollPosition;
             else
                 nScrollInc = - m_yScrollPosition;
-            break;
-        }
-        case wxEVT_SCROLLWIN_BOTTOM:
-        {
+    } else
+    if (event.GetEventType() == wxEVT_SCROLLWIN_BOTTOM)
+    {
             if (orient == wxHORIZONTAL)
                 nScrollInc = m_xScrollLines - m_xScrollPosition;
             else
                 nScrollInc = m_yScrollLines - m_yScrollPosition;
-            break;
-        }
-        case wxEVT_SCROLLWIN_LINEUP:
-        {
+    } else
+    if (event.GetEventType() == wxEVT_SCROLLWIN_LINEUP)
+    {
             nScrollInc = -1;
-            break;
-        }
-        case wxEVT_SCROLLWIN_LINEDOWN:
-        {
+    } else
+    if (event.GetEventType() == wxEVT_SCROLLWIN_LINEDOWN)
+    {
             nScrollInc = 1;
-            break;
-        }
-        case wxEVT_SCROLLWIN_PAGEUP:
-        {
+    } else
+    if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEUP)
+    {
             if (orient == wxHORIZONTAL)
                 nScrollInc = -GetScrollPageSize(wxHORIZONTAL);
             else
                 nScrollInc = -GetScrollPageSize(wxVERTICAL);
-            break;
-        }
-        case wxEVT_SCROLLWIN_PAGEDOWN:
-        {
+    } else
+    if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEDOWN)
+    {
             if (orient == wxHORIZONTAL)
                 nScrollInc = GetScrollPageSize(wxHORIZONTAL);
             else
                 nScrollInc = GetScrollPageSize(wxVERTICAL);
-            break;
-        }
-        case wxEVT_SCROLLWIN_THUMBTRACK:
-        case wxEVT_SCROLLWIN_THUMBRELEASE:
-        {
+    } else
+    if ((event.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK) ||
+        (event.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE))
+    {
             if (orient == wxHORIZONTAL)
                 nScrollInc = pos - m_xScrollPosition;
             else
                 nScrollInc = pos - m_yScrollPosition;
-            break;
-        }
-        default:
-        {
-            break;
-        }
     }
 
     if (orient == wxHORIZONTAL)
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index 37404ebf0f..18713c609d 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -1093,25 +1093,29 @@ static void AdjustEventButtonState(wxMouseEvent& event)
     // for compatibility with MSW and common sense we want m_leftDown be TRUE
     // for a LEFT_DOWN event, not FALSE, so we will invert
     // left/right/middleDown for the corresponding click events
-    switch ( event.GetEventType() )
+    
+    if ((event.GetEventType() == wxEVT_LEFT_DOWN) ||
+        (event.GetEventType() == wxEVT_LEFT_DCLICK) ||
+        (event.GetEventType() == wxEVT_LEFT_UP))
     {
-        case wxEVT_LEFT_DOWN:
-        case wxEVT_LEFT_DCLICK:
-        case wxEVT_LEFT_UP:
-            event.m_leftDown = !event.m_leftDown;
-            break;
+        event.m_leftDown = !event.m_leftDown;
+        return;
+    }
 
-        case wxEVT_MIDDLE_DOWN:
-        case wxEVT_MIDDLE_DCLICK:
-        case wxEVT_MIDDLE_UP:
-            event.m_middleDown = !event.m_middleDown;
-            break;
+    if ((event.GetEventType() == wxEVT_MIDDLE_DOWN) ||
+        (event.GetEventType() == wxEVT_MIDDLE_DCLICK) ||
+        (event.GetEventType() == wxEVT_MIDDLE_UP))
+    {
+        event.m_middleDown = !event.m_middleDown;
+        return;
+    }
 
-        case wxEVT_RIGHT_DOWN:
-        case wxEVT_RIGHT_DCLICK:
-        case wxEVT_RIGHT_UP:
-            event.m_rightDown = !event.m_rightDown;
-            break;
+    if ((event.GetEventType() == wxEVT_RIGHT_DOWN) ||
+        (event.GetEventType() == wxEVT_RIGHT_DCLICK) ||
+        (event.GetEventType() == wxEVT_RIGHT_UP))
+    {
+        event.m_rightDown = !event.m_rightDown;
+        return;
     }
 }
 
diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp
index 37404ebf0f..18713c609d 100644
--- a/src/gtk1/window.cpp
+++ b/src/gtk1/window.cpp
@@ -1093,25 +1093,29 @@ static void AdjustEventButtonState(wxMouseEvent& event)
     // for compatibility with MSW and common sense we want m_leftDown be TRUE
     // for a LEFT_DOWN event, not FALSE, so we will invert
     // left/right/middleDown for the corresponding click events
-    switch ( event.GetEventType() )
+    
+    if ((event.GetEventType() == wxEVT_LEFT_DOWN) ||
+        (event.GetEventType() == wxEVT_LEFT_DCLICK) ||
+        (event.GetEventType() == wxEVT_LEFT_UP))
     {
-        case wxEVT_LEFT_DOWN:
-        case wxEVT_LEFT_DCLICK:
-        case wxEVT_LEFT_UP:
-            event.m_leftDown = !event.m_leftDown;
-            break;
+        event.m_leftDown = !event.m_leftDown;
+        return;
+    }
 
-        case wxEVT_MIDDLE_DOWN:
-        case wxEVT_MIDDLE_DCLICK:
-        case wxEVT_MIDDLE_UP:
-            event.m_middleDown = !event.m_middleDown;
-            break;
+    if ((event.GetEventType() == wxEVT_MIDDLE_DOWN) ||
+        (event.GetEventType() == wxEVT_MIDDLE_DCLICK) ||
+        (event.GetEventType() == wxEVT_MIDDLE_UP))
+    {
+        event.m_middleDown = !event.m_middleDown;
+        return;
+    }
 
-        case wxEVT_RIGHT_DOWN:
-        case wxEVT_RIGHT_DCLICK:
-        case wxEVT_RIGHT_UP:
-            event.m_rightDown = !event.m_rightDown;
-            break;
+    if ((event.GetEventType() == wxEVT_RIGHT_DOWN) ||
+        (event.GetEventType() == wxEVT_RIGHT_DCLICK) ||
+        (event.GetEventType() == wxEVT_RIGHT_UP))
+    {
+        event.m_rightDown = !event.m_rightDown;
+        return;
     }
 }