blob: e5853bca084840ea4f382ac533858e3df1eecf8b (
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
|
// Copyright (c) 2012 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 CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
#define CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
#include <set>
#include "base/basictypes.h"
#include "chrome/browser/ui/panels/panel_constants.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
class Panel;
class PanelManager;
namespace gfx {
class Rect;
}
// Responsible for handling resize operations initiated for all panels.
class PanelResizeController {
public:
explicit PanelResizeController(PanelManager* panel_manager);
// Resize the given panel.
// |mouse_location| is in screen coordinate system.
void StartResizing(Panel* panel,
const gfx::Point& mouse_location,
panel::ResizingSides sides);
void Resize(const gfx::Point& mouse_location);
// Returns the panel that was resized.
Panel* EndResizing(bool cancelled);
// Asynchronous confirmation of panel having been closed.
void OnPanelClosed(Panel* panel);
bool IsResizing() const { return resizing_panel_ != NULL; }
private:
PanelManager* panel_manager_; // Weak, owns us.
// Panel currently being resized.
Panel* resizing_panel_;
// Resizing at which side?
panel::ResizingSides sides_resized_;
// The mouse location, in screen coordinates, when StartResizing
// previously called.
gfx::Point mouse_location_at_start_;
// Bounds to restore the panel to if resize is cancelled.
gfx::Rect bounds_at_start_;
DISALLOW_COPY_AND_ASSIGN(PanelResizeController);
};
#endif // CHROME_BROWSER_UI_PANELS_PANEL_RESIZE_CONTROLLER_H_
|