From cb9bb1317104cc8a7f219fdaeec45723a9e59e0e Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Fri, 27 Feb 2009 22:02:17 +0000 Subject: All views::Window objects must have a NonClientView, regardless of whether or not they fully render their own frame. This simplifies things a bit on the way to unification of Window and CustomFrameWindow. Review URL: http://codereview.chromium.org/27286 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10632 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/views/non_client_view.cc | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'chrome/views/non_client_view.cc') diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc index 205f0cb..11d4fb0 100644 --- a/chrome/views/non_client_view.cc +++ b/chrome/views/non_client_view.cc @@ -3,12 +3,83 @@ // found in the LICENSE file. #include "chrome/views/non_client_view.h" +#include "chrome/views/widget.h" namespace views { const int NonClientView::kFrameShadowThickness = 1; const int NonClientView::kClientEdgeThickness = 1; +//////////////////////////////////////////////////////////////////////////////// +// NonClientView, public: + +NonClientView::NonClientView() : paint_as_active_(false) { +} + +NonClientView::~NonClientView() { +} + +bool NonClientView::CanClose() const { + return client_view_->CanClose(); +} + +void NonClientView::WindowClosing() { + client_view_->WindowClosing(); +} + +gfx::Rect NonClientView::CalculateClientAreaBounds(int width, + int height) const { + return gfx::Rect(); +} + +gfx::Size NonClientView::CalculateWindowSizeForClientSize(int width, + int height) const { + return gfx::Size(); +} + +gfx::Point NonClientView::GetSystemMenuPoint() const { + CPoint temp(0, -kFrameShadowThickness); + MapWindowPoints(GetWidget()->GetHWND(), HWND_DESKTOP, &temp, 1); + return gfx::Point(temp); +} + +int NonClientView::NonClientHitTest(const gfx::Point& point) { + return client_view_->NonClientHitTest(point); +} + +void NonClientView::GetWindowMask(const gfx::Size& size, + gfx::Path* window_mask) { +} + +void NonClientView::EnableClose(bool enable) { +} + +void NonClientView::ResetWindowControls() { +} + + +//////////////////////////////////////////////////////////////////////////////// +// NonClientView, View overrides: + +gfx::Size NonClientView::GetPreferredSize() { + return client_view_->GetPreferredSize(); +} + +void NonClientView::Layout() { + client_view_->SetBounds(0, 0, width(), height()); +} + +void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, + View* child) { + // Add our Client View as we are added to the Widget so that if we are + // subsequently resized all the parent-child relationships are established. + if (is_add && GetWidget() && child == this) + AddChildView(client_view_); +} + +//////////////////////////////////////////////////////////////////////////////// +// NonClientView, protected: + int NonClientView::GetHTComponentForFrame(const gfx::Point& point, int top_resize_border_height, int resize_border_thickness, -- cgit v1.1