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

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 (drag resizer instance) 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 virtual const gfx::Point& GetInitialLocation() const OVERRIDE;
46
47 private:
48 // Creates DockWindowResizer that adds the ability to attach / detach
49 // windows to / from the dock. This object takes ownership of
50 // |next_window_resizer|.
51 DockedWindowResizer(WindowResizer* next_window_resizer,
52 const Details& details);
53
54 // Checks if the provided window bounds should snap to the side of a screen.
55 // If so the offset returned gives the necessary adjustment to snap.
56 void MaybeSnapToSide(const gfx::Rect& bounds, gfx::Point* offset);
57
58 // Tracks the window's initial position and attachment at the start of a drag
59 // and informs the DockLayoutManager that a drag has started if necessary.
60 void StartedDragging();
61
62 // Informs the DockLayoutManager that the drag is complete if it was informed
63 // of the drag start.
64 void FinishDragging();
65
66 const Details details_;
67
68 gfx::Point last_location_;
69
70 // Wraps a window resizer and adds detaching / reattaching during drags.
71 scoped_ptr<WindowResizer> next_window_resizer_;
72
73 // Dock container window.
74 internal::DockedWindowLayoutManager* dock_layout_;
75
76 // Set to true once Drag() is invoked and the bounds of the window change.
77 bool did_move_or_resize_;
78
79 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer);
80 };
81
82 } // namespace ash
83
84 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698