More use of wxFALLTHROUGH in MSW code and samples

This commit is contained in:
Maarten Bent
2017-11-25 17:48:37 +01:00
parent 6315ae04fb
commit afc02a34ee
11 changed files with 27 additions and 2 deletions

View File

@@ -1344,8 +1344,9 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
{ {
InsertItemInReportView(event.GetIndex()); InsertItemInReportView(event.GetIndex());
} }
break;
} }
//else: fall through wxFALLTHROUGH;
default: default:
LogEvent(event, wxT("OnListKeyDown")); LogEvent(event, wxT("OnListKeyDown"));

View File

@@ -3932,6 +3932,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event )
break; break;
} }
// else: fall through to WXK_F2 handling // else: fall through to WXK_F2 handling
wxFALLTHROUGH;
} }
case WXK_F2: case WXK_F2:

View File

@@ -664,6 +664,7 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event)
// events for the tabs on MSW // events for the tabs on MSW
HandleAsNavigationKey(event); HandleAsNavigationKey(event);
// fall through to default // fall through to default
wxFALLTHROUGH;
#endif #endif
default: default:
event.Skip(); event.Skip();

View File

@@ -329,6 +329,7 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
// fall through: for compatibility with wxGTK, also send the text // fall through: for compatibility with wxGTK, also send the text
// update event when the selection changes (this also seems more // update event when the selection changes (this also seems more
// logical as the text does change) // logical as the text does change)
wxFALLTHROUGH;
case CBN_EDITCHANGE: case CBN_EDITCHANGE:
if ( m_allowTextEvents ) if ( m_allowTextEvents )

View File

@@ -182,6 +182,7 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs)
default: default:
wxFAIL_MSG( wxT("unexpected Win32 charset") ); wxFAIL_MSG( wxT("unexpected Win32 charset") );
// fall through and assume the system charset // fall through and assume the system charset
wxFALLTHROUGH;
case DEFAULT_CHARSET: case DEFAULT_CHARSET:
fontEncoding = wxFONTENCODING_SYSTEM; fontEncoding = wxFONTENCODING_SYSTEM;

View File

@@ -95,6 +95,7 @@ wxBuddyTextWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if ( (WXHWND)wParam == spin->GetHWND() ) if ( (WXHWND)wParam == spin->GetHWND() )
break; break;
//else: fall through //else: fall through
wxFALLTHROUGH;
case WM_KILLFOCUS: case WM_KILLFOCUS:
case WM_CHAR: case WM_CHAR:

View File

@@ -460,6 +460,7 @@ public:
if ( image != -1 ) if ( image != -1 )
break; break;
//else: fall through //else: fall through
wxFALLTHROUGH;
case wxTreeItemIcon_Selected: case wxTreeItemIcon_Selected:
case wxTreeItemIcon_Expanded: case wxTreeItemIcon_Expanded:

View File

@@ -1090,6 +1090,7 @@ wxString wxGetOsDescription()
break; break;
} }
//else: must be XP, fall through //else: must be XP, fall through
wxFALLTHROUGH;
case 1: case 1:
str = "Windows XP"; str = "Windows XP";

View File

@@ -988,10 +988,11 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
{ {
default: default:
wxFAIL_MSG( wxT("unexpected WaitForInputIdle() return code") ); wxFAIL_MSG( wxT("unexpected WaitForInputIdle() return code") );
// fall through wxFALLTHROUGH;
case WAIT_FAILED: case WAIT_FAILED:
wxLogLastError(wxT("WaitForInputIdle() in wxExecute")); wxLogLastError(wxT("WaitForInputIdle() in wxExecute"));
wxFALLTHROUGH;
case WAIT_TIMEOUT: case WAIT_TIMEOUT:
wxLogDebug(wxT("Timeout too small in WaitForInputIdle")); wxLogDebug(wxT("Timeout too small in WaitForInputIdle"));

View File

@@ -5075,8 +5075,10 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
default: default:
wxFAIL_MSG( wxT("unexpected WM_SIZE parameter") ); wxFAIL_MSG( wxT("unexpected WM_SIZE parameter") );
// fall through nevertheless // fall through nevertheless
wxFALLTHROUGH;
case SIZE_MAXHIDE: case SIZE_MAXHIDE:
wxFALLTHROUGH;
case SIZE_MAXSHOW: case SIZE_MAXSHOW:
// we're not interested in these messages at all // we're not interested in these messages at all
break; break;
@@ -5088,6 +5090,7 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
case SIZE_MAXIMIZED: case SIZE_MAXIMIZED:
/* processed = */ HandleMaximize(); /* processed = */ HandleMaximize();
// fall through to send a normal size event as well // fall through to send a normal size event as well
wxFALLTHROUGH;
case SIZE_RESTORED: case SIZE_RESTORED:
// don't use w and h parameters as they specify the client size // don't use w and h parameters as they specify the client size
@@ -5097,6 +5100,7 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
event.SetEventObject(this); event.SetEventObject(this);
processed = HandleWindowEvent(event); processed = HandleWindowEvent(event);
break;
} }
return processed; return processed;
@@ -6195,60 +6199,70 @@ WXWORD WXToVK(int wxk, bool *isExtended)
{ {
case WXK_PAGEUP: case WXK_PAGEUP:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_PAGEUP: case WXK_NUMPAD_PAGEUP:
vk = VK_PRIOR; vk = VK_PRIOR;
break; break;
case WXK_PAGEDOWN: case WXK_PAGEDOWN:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_PAGEDOWN: case WXK_NUMPAD_PAGEDOWN:
vk = VK_NEXT; vk = VK_NEXT;
break; break;
case WXK_END: case WXK_END:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_END: case WXK_NUMPAD_END:
vk = VK_END; vk = VK_END;
break; break;
case WXK_HOME: case WXK_HOME:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_HOME: case WXK_NUMPAD_HOME:
vk = VK_HOME; vk = VK_HOME;
break; break;
case WXK_LEFT: case WXK_LEFT:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_LEFT: case WXK_NUMPAD_LEFT:
vk = VK_LEFT; vk = VK_LEFT;
break; break;
case WXK_UP: case WXK_UP:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_UP: case WXK_NUMPAD_UP:
vk = VK_UP; vk = VK_UP;
break; break;
case WXK_RIGHT: case WXK_RIGHT:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_RIGHT: case WXK_NUMPAD_RIGHT:
vk = VK_RIGHT; vk = VK_RIGHT;
break; break;
case WXK_DOWN: case WXK_DOWN:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_DOWN: case WXK_NUMPAD_DOWN:
vk = VK_DOWN; vk = VK_DOWN;
break; break;
case WXK_INSERT: case WXK_INSERT:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_INSERT: case WXK_NUMPAD_INSERT:
vk = VK_INSERT; vk = VK_INSERT;
break; break;
case WXK_DELETE: case WXK_DELETE:
extended = true; extended = true;
wxFALLTHROUGH;
case WXK_NUMPAD_DELETE: case WXK_NUMPAD_DELETE:
vk = VK_DELETE; vk = VK_DELETE;
break; break;
@@ -6264,6 +6278,7 @@ WXWORD WXToVK(int wxk, bool *isExtended)
{ {
vk = (WXWORD)wxk; vk = (WXWORD)wxk;
} }
break;
} }
if ( isExtended ) if ( isExtended )

View File

@@ -1628,6 +1628,7 @@ void wxRibbonMSWArtProvider::DrawScrollButton(
{ {
case wxRIBBON_SCROLL_BTN_LEFT: case wxRIBBON_SCROLL_BTN_LEFT:
rect.x++; rect.x++;
wxFALLTHROUGH;
case wxRIBBON_SCROLL_BTN_RIGHT: case wxRIBBON_SCROLL_BTN_RIGHT:
rect.y--; rect.y--;
rect.width--; rect.width--;