- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / panels / panel_resize_controller.h
1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
7
8 #include <set>
9 #include "base/basictypes.h"
10 #include "chrome/browser/ui/panels/panel_constants.h"
11 #include "ui/gfx/point.h"
12 #include "ui/gfx/rect.h"
13
14 class Panel;
15 class PanelManager;
16 namespace gfx {
17   class Rect;
18 }
19
20 // Responsible for handling resize operations initiated for all panels.
21 class PanelResizeController {
22  public:
23   explicit PanelResizeController(PanelManager* panel_manager);
24
25   // Resize the given panel.
26   // |mouse_location| is in screen coordinate system.
27   void StartResizing(Panel* panel,
28                      const gfx::Point& mouse_location,
29                      panel::ResizingSides sides);
30   void Resize(const gfx::Point& mouse_location);
31
32   // Returns the panel that was resized.
33   Panel* EndResizing(bool cancelled);
34
35   // Asynchronous confirmation of panel having been closed.
36   void OnPanelClosed(Panel* panel);
37
38   bool IsResizing() const { return resizing_panel_ != NULL; }
39
40  private:
41   PanelManager* panel_manager_;  // Weak, owns us.
42
43   // Panel currently being resized.
44   Panel* resizing_panel_;
45
46   // Resizing at which side?
47   panel::ResizingSides sides_resized_;
48
49   // The mouse location, in screen coordinates, when StartResizing
50   // previously called.
51   gfx::Point mouse_location_at_start_;
52
53   // Bounds to restore the panel to if resize is cancelled.
54   gfx::Rect bounds_at_start_;
55
56   DISALLOW_COPY_AND_ASSIGN(PanelResizeController);
57 };
58
59 #endif  // CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_