summaryrefslogtreecommitdiffstats
path: root/ui/views/window
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views/window')
-rw-r--r--ui/views/window/non_client_view.cc21
-rw-r--r--ui/views/window/non_client_view.h7
2 files changed, 27 insertions, 1 deletions
diff --git a/ui/views/window/non_client_view.cc b/ui/views/window/non_client_view.cc
index c6cb594..316d00f 100644
--- a/ui/views/window/non_client_view.cc
+++ b/ui/views/window/non_client_view.cc
@@ -27,12 +27,14 @@ const char NonClientView::kViewClassName[] =
// handling mouse messages.
static const int kFrameViewIndex = 0;
static const int kClientViewIndex = 1;
+// The overlay view is always on top (index == child_count() - 1).
////////////////////////////////////////////////////////////////////////////////
// NonClientView, public:
NonClientView::NonClientView()
- : client_view_(NULL) {
+ : client_view_(NULL),
+ overlay_view_(NULL) {
}
NonClientView::~NonClientView() {
@@ -51,6 +53,18 @@ void NonClientView::SetFrameView(NonClientFrameView* frame_view) {
AddChildViewAt(frame_view_.get(), kFrameViewIndex);
}
+void NonClientView::SetOverlayView(View* view) {
+ if (overlay_view_)
+ RemoveChildView(overlay_view_);
+
+ if (!view)
+ return;
+
+ overlay_view_ = view;
+ if (parent())
+ AddChildView(overlay_view_);
+}
+
bool NonClientView::CanClose() {
return client_view_->CanClose();
}
@@ -147,6 +161,9 @@ void NonClientView::Layout() {
// We need to manually call Layout on the ClientView as well for the same
// reason as above.
client_view_->Layout();
+
+ if (overlay_view_ && overlay_view_->visible())
+ overlay_view_->SetBoundsRect(GetLocalBounds());
}
void NonClientView::ViewHierarchyChanged(
@@ -157,6 +174,8 @@ void NonClientView::ViewHierarchyChanged(
if (details.is_add && GetWidget() && details.child == this) {
AddChildViewAt(frame_view_.get(), kFrameViewIndex);
AddChildViewAt(client_view_, kClientViewIndex);
+ if (overlay_view_)
+ AddChildView(overlay_view_);
}
}
diff --git a/ui/views/window/non_client_view.h b/ui/views/window/non_client_view.h
index 64944e6..e5be44e 100644
--- a/ui/views/window/non_client_view.h
+++ b/ui/views/window/non_client_view.h
@@ -145,6 +145,9 @@ class VIEWS_EXPORT NonClientView : public View {
// Replaces the current NonClientFrameView (if any) with the specified one.
void SetFrameView(NonClientFrameView* frame_view);
+ // Replaces the current |overlay_view_| (if any) with the specified one.
+ void SetOverlayView(View* view);
+
// Returns true if the ClientView determines that the containing window can be
// closed, false otherwise.
bool CanClose();
@@ -233,6 +236,10 @@ class VIEWS_EXPORT NonClientView : public View {
// dynamically as the system settings change.
scoped_ptr<NonClientFrameView> frame_view_;
+ // The overlay view, when non-NULL and visible, takes up the entire widget and
+ // is placed on top of the ClientView and NonClientFrameView.
+ View* overlay_view_;
+
// The accessible name of this view.
string16 accessible_name_;