Add a minor text member to ui::MenuModel.
[chromium-blink-merge.git] / chrome / browser / ui / panels / panel_resize_controller.h
blobe5853bca084840ea4f382ac533858e3df1eecf8b
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.
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
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"
14 class Panel;
15 class PanelManager;
16 namespace gfx {
17 class Rect;
20 // Responsible for handling resize operations initiated for all panels.
21 class PanelResizeController {
22 public:
23 explicit PanelResizeController(PanelManager* panel_manager);
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);
32 // Returns the panel that was resized.
33 Panel* EndResizing(bool cancelled);
35 // Asynchronous confirmation of panel having been closed.
36 void OnPanelClosed(Panel* panel);
38 bool IsResizing() const { return resizing_panel_ != NULL; }
40 private:
41 PanelManager* panel_manager_; // Weak, owns us.
43 // Panel currently being resized.
44 Panel* resizing_panel_;
46 // Resizing at which side?
47 panel::ResizingSides sides_resized_;
49 // The mouse location, in screen coordinates, when StartResizing
50 // previously called.
51 gfx::Point mouse_location_at_start_;
53 // Bounds to restore the panel to if resize is cancelled.
54 gfx::Rect bounds_at_start_;
56 DISALLOW_COPY_AND_ASSIGN(PanelResizeController);
59 #endif // CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_