From 020c598c18b17e20a3a23c6db1bce4fa02bd2a49 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 22 Nov 2017 00:16:45 +0100 Subject: [PATCH] Rename wxExternalField methods to not mention "Window" This class doesn't have to be used with wxWindow or similar as object type, so use a more neutral "Object" instead of "Window". --- include/wx/private/extfield.h | 8 ++++---- src/gtk/window.cpp | 20 ++++++++++---------- src/osx/cocoa/window.mm | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/wx/private/extfield.h b/include/wx/private/extfield.h index f180ab0b47..01451e83eb 100644 --- a/include/wx/private/extfield.h +++ b/include/wx/private/extfield.h @@ -39,8 +39,8 @@ public: // existing one, if any. // // This method takes ownership of the field pointer which will be destroyed - // by EraseForWindow(). - static void StoreForWindow(ObjectType* obj, FieldType* field) + // by EraseForObject(). + static void StoreForObject(ObjectType* obj, FieldType* field) { const typename MapType::iterator it = ms_map.find(obj); if ( it != ms_map.end() ) @@ -55,7 +55,7 @@ public: } // Find the object for the corresponding window. - static FieldType* FromWindow(ObjectType* obj) + static FieldType* FromObject(ObjectType* obj) { const typename MapType::const_iterator it = ms_map.find(obj); return it == ms_map.end() ? NULL : it->second; @@ -63,7 +63,7 @@ public: // Erase the object used for the corresponding window, return true if there // was one or false otherwise. - static bool EraseForWindow(ObjectType* obj) + static bool EraseForObject(ObjectType* obj) { const typename MapType::iterator it = ms_map.find(obj); if ( it == ms_map.end() ) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index d8bc4b69f9..d18aa15662 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2687,7 +2687,7 @@ wxWindowGTK::~wxWindowGTK() #endif #ifdef wxGTK_HAS_GESTURES_SUPPORT - wxWindowGestures::EraseForWindow(this); + wxWindowGestures::EraseForObject(this); #endif // wxGTK_HAS_GESTURES_SUPPORT if (m_widget) @@ -2923,7 +2923,7 @@ pan_gesture_begin_callback(GtkGesture* WXUNUSED(gesture), GdkEventSequence* WXUN static void horizontal_pan_gesture_end_callback(GtkGesture* gesture, GdkEventSequence* sequence, wxWindowGTK* win) { - wxWindowGesturesData* const data = wxWindowGestures::FromWindow(win); + wxWindowGesturesData* const data = wxWindowGestures::FromObject(win); if ( !data ) return; @@ -2954,7 +2954,7 @@ horizontal_pan_gesture_end_callback(GtkGesture* gesture, GdkEventSequence* seque static void vertical_pan_gesture_end_callback(GtkGesture* gesture, GdkEventSequence* sequence, wxWindowGTK* win) { - wxWindowGesturesData* const data = wxWindowGestures::FromWindow(win); + wxWindowGesturesData* const data = wxWindowGestures::FromObject(win); if ( !data ) return; @@ -3006,7 +3006,7 @@ pan_gesture_callback(GtkGesture* gesture, GtkPanDirection direction, gdouble off event.SetEventObject(win); event.SetPosition(wxPoint(wxRound(x), wxRound(y))); - wxWindowGesturesData* const data = wxWindowGestures::FromWindow(win); + wxWindowGesturesData* const data = wxWindowGestures::FromObject(win); if ( !data ) return; @@ -3070,7 +3070,7 @@ zoom_gesture_callback(GtkGesture* gesture, gdouble scale, wxWindowGTK* win) event.SetPosition(wxPoint(wxRound(x), wxRound(y))); event.SetZoomFactor(scale); - wxWindowGesturesData* const data = wxWindowGestures::FromWindow(win); + wxWindowGesturesData* const data = wxWindowGestures::FromObject(win); if ( !data ) return; @@ -3210,7 +3210,7 @@ wxEmitTwoFingerTapEvent(GdkEventTouch* gdk_event, wxWindowGTK* win) event.SetEventObject(win); - wxWindowGesturesData* const data = wxWindowGestures::FromWindow(win); + wxWindowGesturesData* const data = wxWindowGestures::FromObject(win); if ( !data ) return; @@ -3241,7 +3241,7 @@ wxEmitPressAndTapEvent(GdkEventTouch* gdk_event, wxWindowGTK* win) event.SetEventObject(win); - wxWindowGesturesData* const data = wxWindowGestures::FromWindow(win); + wxWindowGesturesData* const data = wxWindowGestures::FromObject(win); if ( !data ) return; @@ -3273,7 +3273,7 @@ wxEmitPressAndTapEvent(GdkEventTouch* gdk_event, wxWindowGTK* win) static void touch_callback(GtkWidget* WXUNUSED(widget), GdkEventTouch* gdk_event, wxWindowGTK* win) { - wxWindowGesturesData* const data = wxWindowGestures::FromWindow(win); + wxWindowGesturesData* const data = wxWindowGestures::FromObject(win); if ( !data ) return; @@ -3528,11 +3528,11 @@ bool wxWindowGTK::EnableTouchEvents(int eventsMask) { if ( eventsMask == wxTOUCH_NONE ) { - wxWindowGestures::EraseForWindow(this); + wxWindowGestures::EraseForObject(this); } else { - wxWindowGestures::StoreForWindow + wxWindowGestures::StoreForObject ( this, new wxWindowGesturesData(this, GetConnectWidget(), eventsMask) diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index cc89d8ef92..b218573f9e 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -1836,7 +1836,7 @@ enum TrackedGestures void wxWidgetCocoaImpl::TouchesBegan(WX_NSEvent event) { - if ( wxCocoaGesturesImpl* gestures = wxCocoaGestures::FromWindow(this) ) + if ( wxCocoaGesturesImpl* gestures = wxCocoaGestures::FromObject(this) ) gestures->TouchesBegan(event); } @@ -1893,7 +1893,7 @@ void wxCocoaGesturesImpl::TouchesBegan(NSEvent* event) void wxWidgetCocoaImpl::TouchesMoved(WX_NSEvent event) { - if ( wxCocoaGesturesImpl* gestures = wxCocoaGestures::FromWindow(this) ) + if ( wxCocoaGesturesImpl* gestures = wxCocoaGestures::FromObject(this) ) gestures->TouchesMoved(event); } @@ -1949,7 +1949,7 @@ void wxCocoaGesturesImpl::TouchesMoved(NSEvent* event) void wxWidgetCocoaImpl::TouchesEnded(WX_NSEvent event) { - if ( wxCocoaGesturesImpl* gestures = wxCocoaGestures::FromWindow(this) ) + if ( wxCocoaGesturesImpl* gestures = wxCocoaGestures::FromObject(this) ) gestures->TouchesEnded(event); } @@ -2501,7 +2501,7 @@ wxWidgetCocoaImpl::~wxWidgetCocoaImpl() CFRelease(m_osxView); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 - wxCocoaGestures::EraseForWindow(this); + wxCocoaGestures::EraseForObject(this); #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 } @@ -3430,7 +3430,7 @@ bool wxWidgetCocoaImpl::EnableTouchEvents(int eventsMask) { if ( eventsMask == wxTOUCH_NONE ) { - if ( wxCocoaGestures::EraseForWindow(this) ) + if ( wxCocoaGestures::EraseForObject(this) ) { [m_osxView setAcceptsTouchEvents:NO]; } @@ -3438,7 +3438,7 @@ bool wxWidgetCocoaImpl::EnableTouchEvents(int eventsMask) } else // We do want to have gesture events. { - wxCocoaGestures::StoreForWindow + wxCocoaGestures::StoreForObject ( this, new wxCocoaGesturesImpl(this, m_osxView, eventsMask)