diff options
Diffstat (limited to 'src/core/touch_selection_controller_client_qt.cpp')
-rw-r--r-- | src/core/touch_selection_controller_client_qt.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp index 2e9f56a5f..b85d301f6 100644 --- a/src/core/touch_selection_controller_client_qt.cpp +++ b/src/core/touch_selection_controller_client_qt.cpp @@ -39,6 +39,7 @@ #include "render_widget_host_view_qt.h" #include "touch_handle_drawable_qt.h" +#include "touch_handle_drawable_client.h" #include "touch_selection_controller_client_qt.h" #include "touch_selection_menu_controller.h" #include "type_conversion.h" @@ -293,13 +294,31 @@ void TouchSelectionControllerClientQt::OnDragUpdate(const ui::TouchSelectionDrag std::unique_ptr<ui::TouchHandleDrawable> TouchSelectionControllerClientQt::CreateDrawable() { - return std::unique_ptr<ui::TouchHandleDrawable>(new TouchHandleDrawableQt(m_rwhv)); + Q_ASSERT(m_rwhv); + Q_ASSERT(m_rwhv->adapterClient()); + QMap<int, QImage> images; + for (int orientation = 0; orientation < static_cast<int>(ui::TouchHandleOrientation::UNDEFINED); + ++orientation) { + gfx::Image *image = TouchHandleDrawableQt::GetHandleImage( + static_cast<ui::TouchHandleOrientation>(orientation)); + images.insert(orientation, toQImage(image->AsBitmap())); + } + auto delegate = m_rwhv->adapterClient()->createTouchHandleDelegate(images); + return std::unique_ptr<ui::TouchHandleDrawable>(new TouchHandleDrawableQt(delegate)); } void TouchSelectionControllerClientQt::DidScroll() { } +void TouchSelectionControllerClientQt::resetControls() +{ + if (m_menuShowing) { + hideMenu(); + GetTouchSelectionController()->HideAndDisallowShowingAutomatically(); + } +} + void TouchSelectionControllerClientQt::showMenu() { gfx::RectF rect = GetTouchSelectionController()->GetRectBetweenBounds(); |