summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 04:55:57 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 04:55:57 +0000
commite578e76354f5838edb54dc1d9457561030002123 (patch)
treec13ba5657921756bed0a167aa56edbec68730823 /views
parent7d767625372cad11adca0789531753bd56e40e0e (diff)
downloadchromium_src-e578e76354f5838edb54dc1d9457561030002123.zip
chromium_src-e578e76354f5838edb54dc1d9457561030002123.tar.gz
chromium_src-e578e76354f5838edb54dc1d9457561030002123.tar.bz2
Add overflow menu to the browser action container (part 2 of
supporting resize for the container). Also improved RTL support a bit (the divider wasn't drawn on the right side of the container and resizing was reversed). BUG=32101 TEST=Overflow menu for browser action container should now work. Make sure to test also right-clicking on a menu item in the overflow menu to bring up a context menu for that item. And resizing the container in RTL locales should work. Review URL: http://codereview.chromium.org/557006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/resize_gripper.cc22
-rw-r--r--views/controls/resize_gripper.h10
2 files changed, 21 insertions, 11 deletions
diff --git a/views/controls/resize_gripper.cc b/views/controls/resize_gripper.cc
index f443f33..59a13aa 100644
--- a/views/controls/resize_gripper.cc
+++ b/views/controls/resize_gripper.cc
@@ -64,22 +64,26 @@ bool ResizeGripper::OnMouseDragged(const views::MouseEvent& event) {
if (!event.IsLeftMouseButton())
return false;
- gfx::Point point(event.x(), 0);
- View::ConvertPointToScreen(this, &point);
-
- delegate_->OnResize(point.x() - initial_position_, false);
+ ReportResizeAmount(event.x(), false);
return true;
}
void ResizeGripper::OnMouseReleased(const views::MouseEvent& event,
bool canceled) {
- gfx::Point point(event.x(), 0);
- View::ConvertPointToScreen(this, &point);
-
if (canceled)
- delegate_->OnResize(0, true);
+ ReportResizeAmount(initial_position_, true);
else
- delegate_->OnResize(point.x() - initial_position_, true);
+ ReportResizeAmount(event.x(), true);
+}
+
+void ResizeGripper::ReportResizeAmount(int resize_amount, bool last_update) {
+ gfx::Point point(resize_amount, 0);
+ View::ConvertPointToScreen(this, &point);
+ resize_amount = point.x() - initial_position_;
+
+ if (UILayoutIsRightToLeft())
+ resize_amount = -1 * resize_amount;
+ delegate_->OnResize(resize_amount, last_update);
}
} // namespace views
diff --git a/views/controls/resize_gripper.h b/views/controls/resize_gripper.h
index 1b65066..204aa9f 100644
--- a/views/controls/resize_gripper.h
+++ b/views/controls/resize_gripper.h
@@ -27,8 +27,10 @@ class ResizeGripper : public ImageView {
public:
// OnResize is sent when resizing is detected. |resize_amount| specifies the
// number of pixels that the user wants to resize by, and can be negative or
- // positive (depending on direction of dragging). |done_resizing| is
- // true if the user has released the mouse.
+ // positive (depending on direction of dragging and flips according to
+ // locale directionality: dragging to the left in LTR locales gives negative
+ // |resize_amount| but positive amount for RTL). |done_resizing| is true if
+ // the user has released the mouse.
virtual void OnResize(int resize_amount, bool done_resizing) = 0;
};
@@ -46,6 +48,10 @@ class ResizeGripper : public ImageView {
static const char kViewClassName[];
private:
+ // Report the amount the user resized by to the delegate, accounting for
+ // directionality.
+ void ReportResizeAmount(int resize_amount, bool last_update);
+
// The delegate to notify when we have updates.
ResizeGripperDelegate* delegate_;