summaryrefslogtreecommitdiffstats
path: root/ui/aura_shell/default_container_layout_manager.h
blob: 24bc604deb6ff713f024ac015713056c12340982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_
#define UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_
#pragma once

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura_shell/aura_shell_export.h"

namespace aura {
class MouseEvent;
class Window;
}

namespace gfx {
class Rect;
}

namespace aura_shell {
namespace internal {

class ShowStateController;
class WorkspaceManager;

// LayoutManager for the default window container.
class AURA_SHELL_EXPORT DefaultContainerLayoutManager
    : public aura::LayoutManager {
 public:
  explicit DefaultContainerLayoutManager(WorkspaceManager* workspace_manager);
  virtual ~DefaultContainerLayoutManager();

  // Returns the workspace manager for this container.
  WorkspaceManager* workspace_manager() {
    return workspace_manager_;
  }

  // Invoked when a window receives drag event.
  void PrepareForMoveOrResize(aura::Window* drag, aura::MouseEvent* event);

  // Invoked when a drag event didn't start any drag operation.
  void CancelMoveOrResize(aura::Window* drag, aura::MouseEvent* event);

  // Invoked when a drag event moved the |window|.
  void ProcessMove(aura::Window* window, aura::MouseEvent* event);

  // Invoked when a user finished moving window.
  void EndMove(aura::Window* drag, aura::MouseEvent* evnet);

  // Invoked when a user finished resizing window.
  void EndResize(aura::Window* drag, aura::MouseEvent* evnet);

  // Overridden from aura::LayoutManager:
  virtual void OnWindowResized() OVERRIDE;
  virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
  virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
  virtual void OnChildWindowVisibilityChanged(aura::Window* child,
                                              bool visibile) OVERRIDE;
  virtual void SetChildBounds(aura::Window* child,
                              const gfx::Rect& requested_bounds) OVERRIDE;
 private:
  // Owned by WorkspaceController.
  WorkspaceManager* workspace_manager_;

  // A window that are currently moved or resized. Used to put
  // different constraints on drag window.
  aura::Window* drag_window_;

  scoped_ptr<ShowStateController> show_state_controller_;

  DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManager);
};

}  // namespace internal
}  // namespace aura_shell

#endif  // UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_