Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: ui/views/controls/resize_area.h

Issue 2796303006: Add gesture support in views::ResizeArea (Closed)
Patch Set: skip OSX Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/controls/resize_area.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/resize_area.h
diff --git a/ui/views/controls/resize_area.h b/ui/views/controls/resize_area.h
index 171c805656d9873aba25a6a419b88382ac458239..31dc6e35235b9ae72a62afad8c3b1489387bb9d0 100644
--- a/ui/views/controls/resize_area.h
+++ b/ui/views/controls/resize_area.h
@@ -14,11 +14,7 @@ namespace views {
class ResizeAreaDelegate;
-////////////////////////////////////////////////////////////////////////////////
-//
// An invisible area that acts like a horizontal resizer.
-//
-////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT ResizeArea : public View {
public:
static const char kViewClassName[];
@@ -26,9 +22,10 @@ class VIEWS_EXPORT ResizeArea : public View {
explicit ResizeArea(ResizeAreaDelegate* delegate);
~ResizeArea() override;
- // Overridden from views::View:
+ // views::View:
const char* GetClassName() const override;
gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
bool OnMousePressed(const ui::MouseEvent& event) override;
bool OnMouseDragged(const ui::MouseEvent& event) override;
void OnMouseReleased(const ui::MouseEvent& event) override;
@@ -40,10 +37,16 @@ class VIEWS_EXPORT ResizeArea : public View {
// directionality.
void ReportResizeAmount(int resize_amount, bool last_update);
+ // Converts |event_x| to screen coordinates and sets |initial_position_| to
+ // this value.
+ void SetInitialPosition(int event_x);
+
// The delegate to notify when we have updates.
ResizeAreaDelegate* delegate_;
- // The mouse position at start (in screen coordinates).
+ // The event's x-position at the start of the resize operation. The resize
+ // area will move while being dragged, so |initial_position_| is represented
+ // in screen coordinates so that we don't lose our bearings.
int initial_position_;
DISALLOW_COPY_AND_ASSIGN(ResizeArea);
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/controls/resize_area.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698