| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/ui/panels/panel_constants.h" | 10 #include "chrome/browser/ui/panels/panel_constants.h" |
| 11 #include "ui/gfx/point.h" | 11 #include "ui/gfx/point.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 | 13 |
| 14 class Panel; | 14 class Panel; |
| 15 class PanelManager; | 15 class PanelManager; |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Rect; | 17 class Rect; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // Responsible for handling resize operations initiated for all panels. | 20 // Responsible for handling resize operations initiated for all panels. |
| 21 class PanelResizeController { | 21 class PanelResizeController { |
| 22 public: | 22 public: |
| 23 explicit PanelResizeController(PanelManager* panel_manager); | 23 explicit PanelResizeController(PanelManager* panel_manager); |
| 24 | 24 |
| 25 // Resize the given panel. | 25 // Resize the given panel. |
| 26 // |mouse_location| is in screen coordinate system. | 26 // |mouse_location| is in screen coordinate system. |
| 27 void StartResizing(Panel* panel, | 27 void StartResizing(Panel* panel, |
| 28 const gfx::Point& mouse_location, | 28 const gfx::Point& mouse_location, |
| 29 panel::ResizingSides sides); | 29 int component); |
| 30 void Resize(const gfx::Point& mouse_location); | 30 void Resize(const gfx::Point& mouse_location); |
| 31 | 31 |
| 32 // Returns the panel that was resized. | 32 // Returns the panel that was resized. |
| 33 Panel* EndResizing(bool cancelled); | 33 Panel* EndResizing(bool cancelled); |
| 34 | 34 |
| 35 // Asynchronous confirmation of panel having been closed. | 35 // Asynchronous confirmation of panel having been closed. |
| 36 void OnPanelClosed(Panel* panel); | 36 void OnPanelClosed(Panel* panel); |
| 37 | 37 |
| 38 bool IsResizing() const { return resizing_panel_ != NULL; } | 38 bool IsResizing() const { return resizing_panel_ != NULL; } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 PanelManager* panel_manager_; // Weak, owns us. | 41 PanelManager* panel_manager_; // Weak, owns us. |
| 42 | 42 |
| 43 // Panel currently being resized. | 43 // Panel currently being resized. |
| 44 Panel* resizing_panel_; | 44 Panel* resizing_panel_; |
| 45 | 45 |
| 46 // Resizing at which side? | 46 // The part of the border used to resize the window. |
| 47 panel::ResizingSides sides_resized_; | 47 int component_; |
| 48 | 48 |
| 49 // The mouse location, in screen coordinates, when StartResizing | 49 // The mouse location, in screen coordinates, when StartResizing |
| 50 // previously called. | 50 // previously called. |
| 51 gfx::Point mouse_location_at_start_; | 51 gfx::Point mouse_location_at_start_; |
| 52 | 52 |
| 53 // Bounds to restore the panel to if resize is cancelled. | 53 // Bounds to restore the panel to if resize is cancelled. |
| 54 gfx::Rect bounds_at_start_; | 54 gfx::Rect bounds_at_start_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(PanelResizeController); | 56 DISALLOW_COPY_AND_ASSIGN(PanelResizeController); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 #endif // CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_ | 59 #endif // CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_ |
| OLD | NEW |