diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-08 23:34:07 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-08 23:34:07 +0000 |
commit | e9adf0702e30800cdfaebce8cfacff7b444b4e79 (patch) | |
tree | 49d8ab8fa6e0090c6dd7bbe667008f07e5939af0 /views/controls/button | |
parent | ae5f56fed71e801889db8f0f7ebd2f21d6612521 (diff) | |
download | chromium_src-e9adf0702e30800cdfaebce8cfacff7b444b4e79.zip chromium_src-e9adf0702e30800cdfaebce8cfacff7b444b4e79.tar.gz chromium_src-e9adf0702e30800cdfaebce8cfacff7b444b4e79.tar.bz2 |
Replace lots of "int x, int y" with gfx::Point. Also use gfx::Size and gfx::Rect in a few more places.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/669130
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40966 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/button')
-rw-r--r-- | views/controls/button/button.cc | 14 | ||||
-rw-r--r-- | views/controls/button/button.h | 4 | ||||
-rw-r--r-- | views/controls/button/button_dropdown.cc | 5 | ||||
-rw-r--r-- | views/controls/button/button_dropdown.h | 5 | ||||
-rw-r--r-- | views/controls/button/custom_button.cc | 6 | ||||
-rw-r--r-- | views/controls/button/custom_button.h | 4 | ||||
-rw-r--r-- | views/controls/button/image_button.cc | 7 | ||||
-rw-r--r-- | views/controls/button/image_button.h | 4 | ||||
-rw-r--r-- | views/controls/button/menu_button.cc | 6 |
9 files changed, 28 insertions, 27 deletions
diff --git a/views/controls/button/button.cc b/views/controls/button/button.cc index 504a2f5..1183951 100644 --- a/views/controls/button/button.cc +++ b/views/controls/button/button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,12 +20,12 @@ void Button::SetTooltipText(const std::wstring& tooltip_text) { //////////////////////////////////////////////////////////////////////////////// // Button, View overrides: -bool Button::GetTooltipText(int x, int y, std::wstring* tooltip) { - if (!tooltip_text_.empty()) { - *tooltip = tooltip_text_; - return true; - } - return false; +bool Button::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { + if (tooltip_text_.empty()) + return false; + + *tooltip = tooltip_text_; + return true; } bool Button::GetAccessibleKeyboardShortcut(std::wstring* shortcut) { diff --git a/views/controls/button/button.h b/views/controls/button/button.h index 9dd8b13..f9f6e5d 100644 --- a/views/controls/button/button.h +++ b/views/controls/button/button.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,7 +33,7 @@ class Button : public View { int mouse_event_flags() const { return mouse_event_flags_; } // Overridden from View: - virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); virtual bool GetAccessibleKeyboardShortcut(std::wstring* shortcut); virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc index a851c84..2d3f30e 100644 --- a/views/controls/button/button_dropdown.cc +++ b/views/controls/button/button_dropdown.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -106,7 +106,8 @@ void ButtonDropDown::OnMouseExited(const MouseEvent& e) { // //////////////////////////////////////////////////////////////////////////////// -void ButtonDropDown::ShowContextMenu(int x, int y, bool is_mouse_gesture) { +void ButtonDropDown::ShowContextMenu(const gfx::Point& p, + bool is_mouse_gesture) { show_menu_factory_.RevokeAll(); // Make the button look depressed while the menu is open. // NOTE: SetState() schedules a paint, but it won't occur until after the diff --git a/views/controls/button/button_dropdown.h b/views/controls/button/button_dropdown.h index 118aebd..90aa260 100644 --- a/views/controls/button/button_dropdown.h +++ b/views/controls/button/button_dropdown.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,8 +39,7 @@ class ButtonDropDown : public ImageButton { // Overridden from View. Used to display the right-click menu, as triggered // by the keyboard, for instance. Using the member function ShowDropDownMenu // for the actual display. - virtual void ShowContextMenu(int x, - int y, + virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture); // Overridden from CustomButton. Returns true if the button should become diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index 91bc33c..ce499f1 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -197,14 +197,14 @@ void CustomButton::OnDragDone() { SetState(BS_NORMAL); } -void CustomButton::ShowContextMenu(int x, int y, bool is_mouse_gesture) { +void CustomButton::ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) { if (GetContextMenuController()) { // We're about to show the context menu. Showing the context menu likely // means we won't get a mouse exited and reset state. Reset it now to be // sure. if (state_ != BS_DISABLED) SetState(BS_NORMAL); - View::ShowContextMenu(x, y, is_mouse_gesture); + View::ShowContextMenu(p, is_mouse_gesture); } } diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h index 032db17..c8977f8 100644 --- a/views/controls/button/custom_button.h +++ b/views/controls/button/custom_button.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -76,7 +76,7 @@ class CustomButton : public Button, virtual bool OnKeyPressed(const KeyEvent& e); virtual bool OnKeyReleased(const KeyEvent& e); virtual void OnDragDone(); - virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture); + virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture); virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); virtual void SetHotTracked(bool flag); virtual bool IsHotTracked() const; diff --git a/views/controls/button/image_button.cc b/views/controls/button/image_button.cc index adb4bc9..636a8fd 100644 --- a/views/controls/button/image_button.cc +++ b/views/controls/button/image_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -157,9 +157,10 @@ void ToggleImageButton::SetImage(ButtonState state, SkBitmap* image) { //////////////////////////////////////////////////////////////////////////////// // ToggleImageButton, View overrides: -bool ToggleImageButton::GetTooltipText(int x, int y, std::wstring* tooltip) { +bool ToggleImageButton::GetTooltipText(const gfx::Point& p, + std::wstring* tooltip) { if (!toggled_ || toggled_tooltip_text_.empty()) - return Button::GetTooltipText(x, y, tooltip); + return Button::GetTooltipText(p, tooltip); *tooltip = toggled_tooltip_text_; return true; diff --git a/views/controls/button/image_button.h b/views/controls/button/image_button.h index 6c079fe..f16444a 100644 --- a/views/controls/button/image_button.h +++ b/views/controls/button/image_button.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -89,7 +89,7 @@ class ToggleImageButton : public ImageButton { virtual void SetImage(ButtonState aState, SkBitmap* anImage); // Overridden from View: - virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); private: // The parent class's images_ member is used for the current images, diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index c3e8522..4c9f0fe 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -172,7 +172,7 @@ bool MenuButton::OnMousePressed(const MouseEvent& e) { // If we're draggable (GetDragOperations returns a non-zero value), then // don't pop on press, instead wait for release. if (e.IsOnlyLeftMouseButton() && HitTest(e.location()) && - GetDragOperations(e.x(), e.y()) == DragDropTypes::DRAG_NONE) { + GetDragOperations(e.location()) == DragDropTypes::DRAG_NONE) { TimeDelta delta = Time::Now() - menu_closed_time_; int64 delta_in_milliseconds = delta.InMilliseconds(); if (delta_in_milliseconds > kMinimumTimeBetweenButtonClicks) { @@ -189,7 +189,7 @@ void MenuButton::OnMouseReleased(const MouseEvent& e, // !IsTriggerableEvent it could lead to a situation where we end up showing // the menu and context menu (this would happen if the right button is not // triggerable and there's a context menu). - if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE && + if (GetDragOperations(e.location()) != DragDropTypes::DRAG_NONE && state() != BS_DISABLED && !canceled && !InDrag() && e.IsOnlyLeftMouseButton() && HitTest(e.location())) { Activate(); |