summaryrefslogtreecommitdiffstats
path: root/views/window
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-07 23:12:38 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-07 23:12:38 +0000
commitc6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd (patch)
tree19a05b1605a19a38391b0d4c5abc4082dcd7399d /views/window
parentad7b6319e6b005a4d289695f5c22013a0f9dd933 (diff)
downloadchromium_src-c6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd.zip
chromium_src-c6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd.tar.gz
chromium_src-c6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd.tar.bz2
Move all the stuff relating to detached tab dragging out of BrowserFrameWin and onto the TabStrip2 object. It was mostly cross platform anyway.Adds APIs to Widget that:- allow a Widget to be obtained for a given gfx::NativeView- allow native properties to be set on a Widget.Adds an API to Window that lets the caller convert the window's appearance into a lightly transparent transient looking thing for dragging.BUG=noneTEST=none
Review URL: http://codereview.chromium.org/149440 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r--views/window/window.h4
-rw-r--r--views/window/window_gtk.cc4
-rw-r--r--views/window/window_gtk.h1
-rw-r--r--views/window/window_win.cc24
-rw-r--r--views/window/window_win.h5
5 files changed, 37 insertions, 1 deletions
diff --git a/views/window/window.h b/views/window/window.h
index becb8d0..d322d8f 100644
--- a/views/window/window.h
+++ b/views/window/window.h
@@ -120,6 +120,10 @@ class Window {
virtual void SetFullscreen(bool fullscreen) = 0;
virtual bool IsFullscreen() const = 0;
+ // Sets whether or not the window should show its frame as a "transient drag
+ // frame" - slightly transparent and without the standard window controls.
+ virtual void SetUseDragFrame(bool use_drag_frame) = 0;
+
// Returns true if the Window is considered to be an "app window" - i.e.
// any window which when it is the last of its type closed causes the
// application to exit.
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc
index fff4e74..2cacccd 100644
--- a/views/window/window_gtk.cc
+++ b/views/window/window_gtk.cc
@@ -185,6 +185,10 @@ bool WindowGtk::IsFullscreen() const {
return window_state_ & GDK_WINDOW_STATE_FULLSCREEN;
}
+void WindowGtk::SetUseDragFrame(bool use_drag_frame) {
+ NOTIMPLEMENTED();
+}
+
void WindowGtk::EnableClose(bool enable) {
gtk_window_set_deletable(GetNativeWindow(), enable);
}
diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h
index 7829e28..a9457af 100644
--- a/views/window/window_gtk.h
+++ b/views/window/window_gtk.h
@@ -42,6 +42,7 @@ class WindowGtk : public WidgetGtk, public Window {
virtual bool IsMinimized() const;
virtual void SetFullscreen(bool fullscreen);
virtual bool IsFullscreen() const;
+ virtual void SetUseDragFrame(bool use_drag_frame);
virtual void EnableClose(bool enable);
virtual void UpdateWindowTitle();
virtual void UpdateWindowIcon();
diff --git a/views/window/window_win.cc b/views/window/window_win.cc
index 66a1e85..84a09b6 100644
--- a/views/window/window_win.cc
+++ b/views/window/window_win.cc
@@ -25,6 +25,8 @@
namespace {
+static const int kDragFrameWindowAlpha = 200;
+
bool GetMonitorAndRects(const RECT& rect,
HMONITOR* monitor,
gfx::Rect* monitor_rect,
@@ -355,6 +357,24 @@ bool WindowWin::IsFullscreen() const {
return fullscreen_;
}
+void WindowWin::SetUseDragFrame(bool use_drag_frame) {
+ if (use_drag_frame) {
+ // Make the frame slightly transparent during the drag operation.
+ drag_frame_saved_window_style_ = GetWindowLong(GWL_STYLE);
+ drag_frame_saved_window_ex_style_ = GetWindowLong(GWL_EXSTYLE);
+ SetWindowLong(GWL_EXSTYLE,
+ drag_frame_saved_window_ex_style_ | WS_EX_LAYERED);
+ // Remove the captions tyle so the window doesn't have window controls for a
+ // more "transparent" look.
+ SetWindowLong(GWL_STYLE, drag_frame_saved_window_style_ & ~WS_CAPTION);
+ SetLayeredWindowAttributes(GetNativeWindow(), RGB(0xFF, 0xFF, 0xFF),
+ kDragFrameWindowAlpha, LWA_ALPHA);
+ } else {
+ SetWindowLong(GWL_STYLE, drag_frame_saved_window_style_);
+ SetWindowLong(GWL_EXSTYLE, drag_frame_saved_window_ex_style_);
+ }
+}
+
void WindowWin::EnableClose(bool enable) {
// If the native frame is rendering its own close button, ask it to disable.
non_client_view_->EnableClose(enable);
@@ -479,7 +499,9 @@ WindowWin::WindowWin(WindowDelegate* window_delegate)
ignore_pos_changes_factory_(this),
force_hidden_count_(0),
is_right_mouse_pressed_on_caption_(false),
- last_monitor_(NULL) {
+ last_monitor_(NULL),
+ drag_frame_saved_window_style_(0),
+ drag_frame_saved_window_ex_style_(false) {
is_window_ = true;
InitClass();
DCHECK(window_delegate_);
diff --git a/views/window/window_win.h b/views/window/window_win.h
index 19a92d4..c9c19cf 100644
--- a/views/window/window_win.h
+++ b/views/window/window_win.h
@@ -74,6 +74,7 @@ class WindowWin : public WidgetWin,
virtual bool IsMinimized() const;
virtual void SetFullscreen(bool fullscreen);
virtual bool IsFullscreen() const;
+ virtual void SetUseDragFrame(bool use_drag_frame);
virtual void EnableClose(bool enable);
virtual void DisableInactiveRendering();
virtual void UpdateWindowTitle();
@@ -297,6 +298,10 @@ class WindowWin : public WidgetWin,
HMONITOR last_monitor_;
gfx::Rect last_monitor_rect_, last_work_area_;
+ // The window styles before we modified them for the drag frame appearance.
+ DWORD drag_frame_saved_window_style_;
+ DWORD drag_frame_saved_window_ex_style_;
+
DISALLOW_COPY_AND_ASSIGN(WindowWin);
};