| OLD | NEW |
| (Empty) |
| 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 | |
| 10 #include "base/macros.h" | |
| 11 #include "chrome/browser/ui/panels/panel_constants.h" | |
| 12 #include "ui/gfx/geometry/point.h" | |
| 13 #include "ui/gfx/geometry/rect.h" | |
| 14 | |
| 15 class Panel; | |
| 16 class PanelManager; | |
| 17 namespace gfx { | |
| 18 class Rect; | |
| 19 } | |
| 20 | |
| 21 // Responsible for handling resize operations initiated for all panels. | |
| 22 class PanelResizeController { | |
| 23 public: | |
| 24 explicit PanelResizeController(PanelManager* panel_manager); | |
| 25 | |
| 26 // Resize the given panel. | |
| 27 // |mouse_location| is in screen coordinate system. | |
| 28 void StartResizing(Panel* panel, | |
| 29 const gfx::Point& mouse_location, | |
| 30 int component); | |
| 31 void Resize(const gfx::Point& mouse_location); | |
| 32 | |
| 33 // Returns the panel that was resized. | |
| 34 Panel* EndResizing(bool cancelled); | |
| 35 | |
| 36 // Asynchronous confirmation of panel having been closed. | |
| 37 void OnPanelClosed(Panel* panel); | |
| 38 | |
| 39 bool IsResizing() const { return resizing_panel_ != NULL; } | |
| 40 | |
| 41 private: | |
| 42 PanelManager* panel_manager_; // Weak, owns us. | |
| 43 | |
| 44 // Panel currently being resized. | |
| 45 Panel* resizing_panel_; | |
| 46 | |
| 47 // The part of the border used to resize the window. | |
| 48 int component_; | |
| 49 | |
| 50 // The mouse location, in screen coordinates, when StartResizing | |
| 51 // previously called. | |
| 52 gfx::Point mouse_location_at_start_; | |
| 53 | |
| 54 // Bounds to restore the panel to if resize is cancelled. | |
| 55 gfx::Rect bounds_at_start_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(PanelResizeController); | |
| 58 }; | |
| 59 | |
| 60 #endif // CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_ | |
| OLD | NEW |