diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-09 22:48:03 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-09 22:48:03 +0000 |
commit | c7933edc76785d831e6f12c46fbf70f4d29e9a02 (patch) | |
tree | c7dd72bdf5862d1c1d60a82282dedbcc2551a449 /chrome/views | |
parent | 42794978292295317bdfd79acb556bcc597bd16f (diff) | |
download | chromium_src-c7933edc76785d831e6f12c46fbf70f4d29e9a02.zip chromium_src-c7933edc76785d831e6f12c46fbf70f4d29e9a02.tar.gz chromium_src-c7933edc76785d831e6f12c46fbf70f4d29e9a02.tar.bz2 |
Make aero glass code look more like other nonclient views in hopes of easing refactoring. More cleanup. Change tabstrip layout to match opaque frame.
BUG=5054
Review URL: http://codereview.chromium.org/20161
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r-- | chrome/views/custom_frame_window.cc | 19 | ||||
-rw-r--r-- | chrome/views/non_client_view.cc | 17 | ||||
-rw-r--r-- | chrome/views/non_client_view.h | 10 |
3 files changed, 21 insertions, 25 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 2cf6ccd..9dc3de7 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -243,7 +243,6 @@ class DefaultNonClientView : public NonClientView, // View overrides: virtual void Paint(ChromeCanvas* canvas); virtual void Layout(); - virtual gfx::Size GetPreferredSize(); virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); // BaseButton::ButtonListener implementation: @@ -451,8 +450,9 @@ CPoint DefaultNonClientView::GetSystemMenuPoint() const { } int DefaultNonClientView::NonClientHitTest(const gfx::Point& point) { - // First see if it's within the grow box area, since that overlaps the client - // bounds. + if (!bounds().Contains(point)) + return HTNOWHERE; + int frame_component = container_->client_view()->NonClientHitTest(point); if (frame_component != HTNOWHERE) return frame_component; @@ -474,11 +474,10 @@ int DefaultNonClientView::NonClientHitTest(const gfx::Point& point) { return HTSYSMENU; int window_component = GetHTComponentForFrame(point, FrameBorderThickness(), - NonClientBorderThickness(), kResizeAreaCornerSize, + NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, container_->window_delegate()->CanResize()); // Fall back to the caption if no other component matches. - return ((window_component == HTNOWHERE) && bounds().Contains(point)) ? - HTCAPTION : window_component; + return (window_component == HTNOWHERE) ? HTCAPTION : window_component; } void DefaultNonClientView::GetWindowMask(const gfx::Size& size, @@ -534,14 +533,6 @@ void DefaultNonClientView::Layout() { LayoutClientView(); } -gfx::Size DefaultNonClientView::GetPreferredSize() { - gfx::Size prefsize(container_->client_view()->GetPreferredSize()); - int border_thickness = NonClientBorderThickness(); - prefsize.Enlarge(2 * border_thickness, - NonClientTopBorderHeight() + border_thickness); - return prefsize; -} - void DefaultNonClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc index 91dd070..1d53d06 100644 --- a/chrome/views/non_client_view.cc +++ b/chrome/views/non_client_view.cc @@ -11,39 +11,40 @@ const int NonClientView::kClientEdgeThickness = 1; int NonClientView::GetHTComponentForFrame(const gfx::Point& point, int top_resize_border_height, int resize_border_thickness, - int resize_corner_size, + int top_resize_corner_height, + int resize_corner_width, bool can_resize) { // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for // a |resize_corner_size|-length strip of both the side and top borders, but // only to return HTBOTTOMLEFT/HTBOTTOMRIGHT along the bottom border + corner // (not the side border). Vista goes further and doesn't return these on any - // of the side borders. Here we copy the XP behavior. + // of the side borders. We allow callers to match either behavior. int component; if (point.x() < resize_border_thickness) { - if (point.y() < resize_corner_size) + if (point.y() < top_resize_corner_height) component = HTTOPLEFT; else if (point.y() >= (height() - resize_border_thickness)) component = HTBOTTOMLEFT; else component = HTLEFT; } else if (point.x() >= (width() - resize_border_thickness)) { - if (point.y() < resize_corner_size) + if (point.y() < top_resize_corner_height) component = HTTOPRIGHT; else if (point.y() >= (height() - resize_border_thickness)) component = HTBOTTOMRIGHT; else component = HTRIGHT; } else if (point.y() < top_resize_border_height) { - if (point.x() < resize_corner_size) + if (point.x() < resize_corner_width) component = HTTOPLEFT; - else if (point.x() >= (width() - resize_corner_size)) + else if (point.x() >= (width() - resize_corner_width)) component = HTTOPRIGHT; else component = HTTOP; } else if (point.y() >= (height() - resize_border_thickness)) { - if (point.x() < resize_corner_size) + if (point.x() < resize_corner_width) component = HTBOTTOMLEFT; - else if (point.x() >= (width() - resize_corner_size)) + else if (point.x() >= (width() - resize_corner_width)) component = HTBOTTOMRIGHT; else component = HTBOTTOM; diff --git a/chrome/views/non_client_view.h b/chrome/views/non_client_view.h index 4dbf0e7..debe22a 100644 --- a/chrome/views/non_client_view.h +++ b/chrome/views/non_client_view.h @@ -37,9 +37,12 @@ class NonClientView : public View { int height) const = 0; // Calculates the size of window required to display a client area of the - // specified width and height. + // specified width and height. Only views used by CustomFrameWindow need + // implement this. virtual gfx::Size CalculateWindowSizeForClientSize(int width, - int height) const = 0; + int height) const { + return gfx::Size(); + } // Returns the point, in screen coordinates, where the system menu should // be shown so it shows up anchored to the system menu icon. @@ -81,7 +84,8 @@ class NonClientView : public View { int GetHTComponentForFrame(const gfx::Point& point, int top_resize_border_height, int resize_border_thickness, - int resize_corner_size, + int top_resize_corner_height, + int resize_corner_width, bool can_resize); // Accessor for paint_as_active_. |