| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/views/custom_frame_window.h" | 5 #include "chrome/views/custom_frame_window.h" |
| 6 | 6 |
| 7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
| 8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
| 9 #include "chrome/common/gfx/chrome_canvas.h" | 9 #include "chrome/common/gfx/chrome_canvas.h" |
| 10 #include "chrome/common/gfx/path.h" | 10 #include "chrome/common/gfx/path.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // TODO(beng): (Cleanup) Right now, the only way to specify a different | 89 // TODO(beng): (Cleanup) Right now, the only way to specify a different |
| 90 // non-client view is to subclass this object and provide one | 90 // non-client view is to subclass this object and provide one |
| 91 // by setting this member before calling Init. | 91 // by setting this member before calling Init. |
| 92 if (!non_client_view_) | 92 if (!non_client_view_) |
| 93 non_client_view_ = new DefaultNonClientView(this); | 93 non_client_view_ = new DefaultNonClientView(this); |
| 94 Window::Init(parent, bounds); | 94 Window::Init(parent, bounds); |
| 95 | 95 |
| 96 ResetWindowRegion(); | 96 ResetWindowRegion(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void CustomFrameWindow::SetClientView(ClientView* cv) { | |
| 100 DCHECK(cv && !client_view() && GetHWND()); | |
| 101 set_client_view(cv); | |
| 102 // For a CustomFrameWindow, the non-client view is the root. | |
| 103 WidgetWin::SetContentsView(non_client_view_); | |
| 104 // When the non client view is added to the view hierarchy, it will cause the | |
| 105 // client view to be added as well. | |
| 106 } | |
| 107 | |
| 108 gfx::Size CustomFrameWindow::CalculateWindowSizeForClientSize( | 99 gfx::Size CustomFrameWindow::CalculateWindowSizeForClientSize( |
| 109 const gfx::Size& client_size) const { | 100 const gfx::Size& client_size) const { |
| 110 return non_client_view_->CalculateWindowSizeForClientSize( | 101 return non_client_view_->CalculateWindowSizeForClientSize( |
| 111 client_size.width(), client_size.height()); | 102 client_size.width(), client_size.height()); |
| 112 } | 103 } |
| 113 | 104 |
| 114 void CustomFrameWindow::UpdateWindowTitle() { | 105 void CustomFrameWindow::UpdateWindowTitle() { |
| 115 // Layout winds up causing the title to be re-validated during | 106 // Layout winds up causing the title to be re-validated during |
| 116 // string measurement. | 107 // string measurement. |
| 117 non_client_view_->Layout(); | 108 non_client_view_->Layout(); |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 UINT message_flags = 0; | 503 UINT message_flags = 0; |
| 513 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) | 504 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) |
| 514 message_flags |= MK_CONTROL; | 505 message_flags |= MK_CONTROL; |
| 515 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) | 506 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) |
| 516 message_flags |= MK_SHIFT; | 507 message_flags |= MK_SHIFT; |
| 517 message_flags |= flags; | 508 message_flags |= flags; |
| 518 ProcessMousePressed(temp, message_flags, false, false); | 509 ProcessMousePressed(temp, message_flags, false, false); |
| 519 } | 510 } |
| 520 | 511 |
| 521 } // namespace views | 512 } // namespace views |
| OLD | NEW |