diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-05 00:06:22 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-05 00:06:22 +0000 |
commit | ee0b38b16afa0a6d1cfd07df66ec67cee8bac6c8 (patch) | |
tree | 558132c0345c91f5b73c0ea03db2b1ce60ce7d69 /chrome/views | |
parent | 4ae627586ecb6184c3b766fd5128709442b17360 (diff) | |
download | chromium_src-ee0b38b16afa0a6d1cfd07df66ec67cee8bac6c8.zip chromium_src-ee0b38b16afa0a6d1cfd07df66ec67cee8bac6c8.tar.gz chromium_src-ee0b38b16afa0a6d1cfd07df66ec67cee8bac6c8.tar.bz2 |
Add the AeroGlassFrame and AeroGlassNonClientView for Vista.
Note that AeroGlassFrame needs a NonClientView as well - even though Windows draws most of the frame and its borders, we do some custom rendering in the non-client area, such as the distributor logo, the client edge and toolbar backgrounds. This necessitated allowing Window to support an optional NonClientView. I just jimmied this in for now... can clean up that API later if desired.
B=1031854
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@352 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r-- | chrome/views/custom_frame_window.cc | 6 | ||||
-rw-r--r-- | chrome/views/custom_frame_window.h | 6 | ||||
-rw-r--r-- | chrome/views/window.cc | 22 | ||||
-rw-r--r-- | chrome/views/window.h | 7 |
4 files changed, 29 insertions, 12 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 928947e..0acf4b3 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -833,16 +833,16 @@ void DefaultNonClientView::InitClass() { CustomFrameWindow::CustomFrameWindow(WindowDelegate* window_delegate) : Window(window_delegate), - non_client_view_(new DefaultNonClientView(this)), is_active_(false) { InitClass(); + non_client_view_ = new DefaultNonClientView(this); } CustomFrameWindow::CustomFrameWindow(WindowDelegate* window_delegate, NonClientView* non_client_view) - : Window(window_delegate), - non_client_view_(non_client_view) { + : Window(window_delegate) { InitClass(); + non_client_view_ = non_client_view; } CustomFrameWindow::~CustomFrameWindow() { diff --git a/chrome/views/custom_frame_window.h b/chrome/views/custom_frame_window.h index d61b6b8..b94cde3 100644 --- a/chrome/views/custom_frame_window.h +++ b/chrome/views/custom_frame_window.h @@ -86,12 +86,6 @@ class CustomFrameWindow : public Window { virtual LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT message); virtual void OnSize(UINT param, const CSize& size); - // The View that provides the non-client area of the window (title bar, - // window controls, sizing borders etc). To use an implementation other than - // the default, this class must be subclassed and this value set to the - // desired implementation before calling |Init|. - NonClientView* non_client_view_; - private: // Shows the system menu at the specified screen point. void RunSystemMenu(const CPoint& point); diff --git a/chrome/views/window.cc b/chrome/views/window.cc index 4ace937..7047d84 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -37,6 +37,7 @@ #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/custom_frame_window.h" +#include "chrome/views/non_client_view.h" #include "chrome/views/window_delegate.h" #include "generated_resources.h" @@ -251,6 +252,7 @@ Window::Window(WindowDelegate* window_delegate) : HWNDViewContainer(), focus_on_creation_(true), window_delegate_(window_delegate), + non_client_view_(NULL), client_view_(NULL), owning_hwnd_(NULL), minimum_size_(100, 100), @@ -300,12 +302,21 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) { void Window::SetClientView(ClientView* client_view) { DCHECK(client_view && !client_view_ && GetHWND()); client_view_ = client_view; - HWNDViewContainer::SetContentsView(client_view_); + if (non_client_view_) { + // This will trigger the ClientView to be added by the non-client view. + HWNDViewContainer::SetContentsView(non_client_view_); + } else { + HWNDViewContainer::SetContentsView(client_view_); + } } void Window::SizeWindowToDefault() { CSize pref(0, 0); - client_view_->GetPreferredSize(&pref); + if (non_client_view_) { + non_client_view_->GetPreferredSize(&pref); + } else { + client_view_->GetPreferredSize(&pref); + } DCHECK(pref.cx > 0 && pref.cy > 0); // CenterAndSizeWindow adjusts the window size to accommodate the non-client // area. @@ -343,7 +354,12 @@ LRESULT Window::OnNCHitTest(const CPoint& point) { // of the non-client area. CPoint temp = point; MapWindowPoints(HWND_DESKTOP, GetHWND(), &temp, 1); - int component = client_view_->NonClientHitTest(gfx::Point(temp)); + int component = HTNOWHERE; + if (non_client_view_) { + component = non_client_view_->NonClientHitTest(gfx::Point(temp)); + } else { + component = client_view_->NonClientHitTest(gfx::Point(temp)); + } if (component != HTNOWHERE) return component; diff --git a/chrome/views/window.h b/chrome/views/window.h index a941cb2..d098938 100644 --- a/chrome/views/window.h +++ b/chrome/views/window.h @@ -44,6 +44,7 @@ namespace ChromeViews { class ClientView; class Client; +class NonClientView; class WindowDelegate; //////////////////////////////////////////////////////////////////////////////// @@ -174,6 +175,12 @@ class Window : public HWNDViewContainer { virtual void OnSize(UINT size_param, const CSize& new_size); virtual void OnSysCommand(UINT notification_code, CPoint click); + // The View that provides the non-client area of the window (title bar, + // window controls, sizing borders etc). To use an implementation other than + // the default, this class must be subclassed and this value set to the + // desired implementation before calling |Init|. + NonClientView* non_client_view_; + private: // Set the window as modal (by disabling all the other windows). void BecomeModal(); |