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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/controls/resize_area.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_CONTROLS_RESIZE_AREA_H_ 5 #ifndef UI_VIEWS_CONTROLS_RESIZE_AREA_H_
6 #define UI_VIEWS_CONTROLS_RESIZE_AREA_H_ 6 #define UI_VIEWS_CONTROLS_RESIZE_AREA_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/views/view.h" 11 #include "ui/views/view.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 class ResizeAreaDelegate; 15 class ResizeAreaDelegate;
16 16
17 ////////////////////////////////////////////////////////////////////////////////
18 //
19 // An invisible area that acts like a horizontal resizer. 17 // An invisible area that acts like a horizontal resizer.
20 //
21 ////////////////////////////////////////////////////////////////////////////////
22 class VIEWS_EXPORT ResizeArea : public View { 18 class VIEWS_EXPORT ResizeArea : public View {
23 public: 19 public:
24 static const char kViewClassName[]; 20 static const char kViewClassName[];
25 21
26 explicit ResizeArea(ResizeAreaDelegate* delegate); 22 explicit ResizeArea(ResizeAreaDelegate* delegate);
27 ~ResizeArea() override; 23 ~ResizeArea() override;
28 24
29 // Overridden from views::View: 25 // views::View:
30 const char* GetClassName() const override; 26 const char* GetClassName() const override;
31 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; 27 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override;
28 void OnGestureEvent(ui::GestureEvent* event) override;
32 bool OnMousePressed(const ui::MouseEvent& event) override; 29 bool OnMousePressed(const ui::MouseEvent& event) override;
33 bool OnMouseDragged(const ui::MouseEvent& event) override; 30 bool OnMouseDragged(const ui::MouseEvent& event) override;
34 void OnMouseReleased(const ui::MouseEvent& event) override; 31 void OnMouseReleased(const ui::MouseEvent& event) override;
35 void OnMouseCaptureLost() override; 32 void OnMouseCaptureLost() override;
36 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 33 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
37 34
38 private: 35 private:
39 // Report the amount the user resized by to the delegate, accounting for 36 // Report the amount the user resized by to the delegate, accounting for
40 // directionality. 37 // directionality.
41 void ReportResizeAmount(int resize_amount, bool last_update); 38 void ReportResizeAmount(int resize_amount, bool last_update);
42 39
40 // Converts |event_x| to screen coordinates and sets |initial_position_| to
41 // this value.
42 void SetInitialPosition(int event_x);
43
43 // The delegate to notify when we have updates. 44 // The delegate to notify when we have updates.
44 ResizeAreaDelegate* delegate_; 45 ResizeAreaDelegate* delegate_;
45 46
46 // The mouse position at start (in screen coordinates). 47 // The event's x-position at the start of the resize operation. The resize
48 // area will move while being dragged, so |initial_position_| is represented
49 // in screen coordinates so that we don't lose our bearings.
47 int initial_position_; 50 int initial_position_;
48 51
49 DISALLOW_COPY_AND_ASSIGN(ResizeArea); 52 DISALLOW_COPY_AND_ASSIGN(ResizeArea);
50 }; 53 };
51 54
52 } // namespace views 55 } // namespace views
53 56
54 #endif // UI_VIEWS_CONTROLS_RESIZE_AREA_H_ 57 #endif // UI_VIEWS_CONTROLS_RESIZE_AREA_H_
OLDNEW
« 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