summaryrefslogtreecommitdiffstats
path: root/chrome/views/non_client_view.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-27 22:02:17 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-27 22:02:17 +0000
commitcb9bb1317104cc8a7f219fdaeec45723a9e59e0e (patch)
tree13b96d3041e7a7e0f8f162239e915e4c22055a03 /chrome/views/non_client_view.cc
parent29e75de051f2dfb32e896b359e605e869f9db04e (diff)
downloadchromium_src-cb9bb1317104cc8a7f219fdaeec45723a9e59e0e.zip
chromium_src-cb9bb1317104cc8a7f219fdaeec45723a9e59e0e.tar.gz
chromium_src-cb9bb1317104cc8a7f219fdaeec45723a9e59e0e.tar.bz2
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
Diffstat (limited to 'chrome/views/non_client_view.cc')
-rw-r--r--chrome/views/non_client_view.cc71
1 files changed, 71 insertions, 0 deletions
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,