Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/resize_gripper.h" | 5 #include "views/controls/resize_gripper.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "app/resource_bundle.h" | |
| 9 #include "grit/app_resources.h" | 9 #include "grit/app_resources.h" |
| 10 | 10 |
| 11 namespace views { | 11 namespace views { |
| 12 | 12 |
| 13 const char ResizeGripper::kViewClassName[] = "views/ResizeGripper"; | 13 const char ResizeGripper::kViewClassName[] = "views/ResizeGripper"; |
| 14 | 14 |
| 15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 16 static HCURSOR g_resize_cursor = NULL; | 16 static HCURSOR g_resize_cursor = NULL; |
| 17 #endif | 17 #endif |
| 18 | 18 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ResizeGripper::OnMouseReleased(const views::MouseEvent& event, | 71 void ResizeGripper::OnMouseReleased(const views::MouseEvent& event, |
| 72 bool canceled) { | 72 bool canceled) { |
| 73 if (canceled) | 73 if (canceled) |
| 74 ReportResizeAmount(initial_position_, true); | 74 ReportResizeAmount(initial_position_, true); |
| 75 else | 75 else |
| 76 ReportResizeAmount(event.x(), true); | 76 ReportResizeAmount(event.x(), true); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool ResizeGripper::GetAccessibleRole(AccessibilityTypes::Role* role) { | |
| 80 DCHECK(role); | |
| 81 *role = AccessibilityTypes::ROLE_SEPARATOR; | |
|
tfarina (gmail-do not use)
2010/03/20 19:47:21
nit: could you add the following lines?
if (!role)
| |
| 82 return true; | |
| 83 } | |
| 84 | |
| 85 bool ResizeGripper::GetAccessibleName(std::wstring* name) { | |
| 86 DCHECK(name); | |
| 87 if (!accessible_name_.empty()) { | |
|
tfarina (gmail-do not use)
2010/03/20 19:47:21
nit: could you add the following lines?
if (!name)
| |
| 88 *name = accessible_name_; | |
| 89 return true; | |
| 90 } | |
| 91 return false; | |
| 92 } | |
| 93 | |
| 94 void ResizeGripper::SetAccessibleName(const std::wstring& name) { | |
| 95 accessible_name_.assign(name); | |
| 96 } | |
| 97 | |
| 79 void ResizeGripper::ReportResizeAmount(int resize_amount, bool last_update) { | 98 void ResizeGripper::ReportResizeAmount(int resize_amount, bool last_update) { |
| 80 gfx::Point point(resize_amount, 0); | 99 gfx::Point point(resize_amount, 0); |
| 81 View::ConvertPointToScreen(this, &point); | 100 View::ConvertPointToScreen(this, &point); |
| 82 resize_amount = point.x() - initial_position_; | 101 resize_amount = point.x() - initial_position_; |
| 83 | 102 |
| 84 if (UILayoutIsRightToLeft()) | 103 if (UILayoutIsRightToLeft()) |
| 85 resize_amount = -1 * resize_amount; | 104 resize_amount = -1 * resize_amount; |
| 86 delegate_->OnResize(resize_amount, last_update); | 105 delegate_->OnResize(resize_amount, last_update); |
| 87 } | 106 } |
| 88 | 107 |
| 89 } // namespace views | 108 } // namespace views |
| OLD | NEW |