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

Side by Side Diff: ui/views/controls/resize_area.cc

Issue 191723003: Nukes USE_AURA ifdefs from views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: incorporate feedback Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/views/controls/resize_area.h" 5 #include "ui/views/controls/resize_area.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/cursor/cursor.h"
9 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/views/controls/resize_area_delegate.h" 11 #include "ui/views/controls/resize_area_delegate.h"
11 12
12 #if defined(USE_AURA)
13 #include "ui/base/cursor/cursor.h"
14 #endif
15
16 namespace views { 13 namespace views {
17 14
18 const char ResizeArea::kViewClassName[] = "ResizeArea"; 15 const char ResizeArea::kViewClassName[] = "ResizeArea";
19 16
20 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
21 // ResizeArea 18 // ResizeArea
22 19
23 ResizeArea::ResizeArea(ResizeAreaDelegate* delegate) 20 ResizeArea::ResizeArea(ResizeAreaDelegate* delegate)
24 : delegate_(delegate), 21 : delegate_(delegate),
25 initial_position_(0) { 22 initial_position_(0) {
26 } 23 }
27 24
28 ResizeArea::~ResizeArea() { 25 ResizeArea::~ResizeArea() {
29 } 26 }
30 27
31 const char* ResizeArea::GetClassName() const { 28 const char* ResizeArea::GetClassName() const {
32 return kViewClassName; 29 return kViewClassName;
33 } 30 }
34 31
35 gfx::NativeCursor ResizeArea::GetCursor(const ui::MouseEvent& event) { 32 gfx::NativeCursor ResizeArea::GetCursor(const ui::MouseEvent& event) {
36 if (!enabled()) 33 return enabled() ? ui::kCursorEastWestResize : gfx::kNullCursor;
37 return gfx::kNullCursor;
38 #if defined(USE_AURA)
39 return ui::kCursorEastWestResize;
40 #elif defined(OS_WIN)
41 static HCURSOR g_resize_cursor = LoadCursor(NULL, IDC_SIZEWE);
42 return g_resize_cursor;
43 #endif
44 } 34 }
45 35
46 bool ResizeArea::OnMousePressed(const ui::MouseEvent& event) { 36 bool ResizeArea::OnMousePressed(const ui::MouseEvent& event) {
47 if (!event.IsOnlyLeftMouseButton()) 37 if (!event.IsOnlyLeftMouseButton())
48 return false; 38 return false;
49 39
50 // The resize area obviously will move once you start dragging so we need to 40 // The resize area obviously will move once you start dragging so we need to
51 // convert coordinates to screen coordinates so that we don't lose our 41 // convert coordinates to screen coordinates so that we don't lose our
52 // bearings. 42 // bearings.
53 gfx::Point point(event.x(), 0); 43 gfx::Point point(event.x(), 0);
(...skipping 25 matching lines...) Expand all
79 69
80 void ResizeArea::ReportResizeAmount(int resize_amount, bool last_update) { 70 void ResizeArea::ReportResizeAmount(int resize_amount, bool last_update) {
81 gfx::Point point(resize_amount, 0); 71 gfx::Point point(resize_amount, 0);
82 View::ConvertPointToScreen(this, &point); 72 View::ConvertPointToScreen(this, &point);
83 resize_amount = point.x() - initial_position_; 73 resize_amount = point.x() - initial_position_;
84 delegate_->OnResize(base::i18n::IsRTL() ? -resize_amount : resize_amount, 74 delegate_->OnResize(base::i18n::IsRTL() ? -resize_amount : resize_amount,
85 last_update); 75 last_update);
86 } 76 }
87 77
88 } // namespace views 78 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/native/native_view_host_unittest.cc ('k') | ui/views/controls/scrollbar/base_scroll_bar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698