Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: ash/wm/dock/docked_window_resizer.h

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock with zero width (some tests disabled on Windows) Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
6 #define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
7
8 #include "ash/wm/window_resizer.h"
9 #include "base/compiler_specific.h"
10
11 namespace gfx {
12 class Point;
13 class Rect;
14 }
15
16 namespace aura {
17 class RootWindow;
18 }
19
20 namespace ash {
21
22 namespace internal {
23 class DockedWindowLayoutManager;
24 }
25
26 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging,
27 // moving or resizing of a window while it is docked to the side of a screen.
28 class ASH_EXPORT DockedWindowResizer : public WindowResizer {
29 public:
30 virtual ~DockedWindowResizer();
31
32 // Creates a new DockWindowResizer. The caller takes ownership of the
33 // returned object. The ownership of |next_window_resizer| is taken by the
34 // returned object. Returns NULL if not resizable.
35 static DockedWindowResizer* Create(WindowResizer* next_window_resizer,
36 aura::Window* window,
37 const gfx::Point& location,
38 int window_component);
39
40 // WindowResizer:
41 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE;
42 virtual void CompleteDrag(int event_flags) OVERRIDE;
43 virtual void RevertDrag() OVERRIDE;
44 virtual aura::Window* GetTarget() OVERRIDE;
45
46 private:
47 // Creates DockWindowResizer that adds the ability to attach / detach
48 // windows to / from the dock. This object takes ownership of
49 // |next_window_resizer|.
50 DockedWindowResizer(WindowResizer* next_window_resizer,
51 const Details& details);
52
53 // Checks if the provided window bounds should snap to the side of a screen.
54 // If so the offset returned gives the necessary adjustment to snap.
55 void MaybeSnapToSide(const gfx::Rect& bounds, gfx::Point* offset);
56
57 // Tracks the window's initial position and attachment at the start of a drag
58 // and informs the DockLayoutManager that a drag has started if necessary.
59 void StartedDragging();
60
61 // Informs the DockLayoutManager that the drag is complete if it was informed
62 // of the drag start.
63 void FinishDragging();
64
65 const Details details_;
66
67 gfx::Point last_mouse_location_;
sky 2013/06/12 21:50:17 This is not a good name since the drag may be the
varkha 2013/06/13 05:02:11 Done.
68
69 // Wraps a window resizer and adds detaching / reattaching during drags.
70 scoped_ptr<WindowResizer> next_window_resizer_;
71
72 // Dock container window.
73 internal::DockedWindowLayoutManager* dock_layout_;
74
75 // Set to true once Drag() is invoked and the bounds of the window change.
76 bool did_move_or_resize_;
77
78 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer);
79 };
80
81 } // namespace ash
82
83 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698