blob: dc7f7c6b331211bc33d0c4aaa9c4cc5c8d35a141 (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright 2014 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_VIEWS_PANELS_X11_PANEL_RESIZER_H_
#define CHROME_BROWSER_UI_VIEWS_PANELS_X11_PANEL_RESIZER_H_
#include "ui/events/event_handler.h"
#include "ui/gfx/geometry/point.h"
namespace aura {
class Window;
}
class Panel;
// EventHandler which implements special handling for resizing panels. Panels
// should use X11PanelResizer instead of X11WindowEventFilter.
// When resizing a panel:
// - The panel bounds should update in sync with the user's mouse movement
// during the resize operation.
// - The layout of all of the panels should be updated once the resize operation
// completes.
// X11PanelResizer does not hand off resizing to the window manager because it
// is not possible to determine when the window manager has finished resizing.
class X11PanelResizer : public ui::EventHandler {
public:
X11PanelResizer(Panel* panel, aura::Window* window);
~X11PanelResizer() override;
private:
enum ResizeState {
NOT_RESIZING,
// The user has clicked on one of the panel's edges.
RESIZE_CAN_START,
// The user has dragged one of the panel's edges far enough for resizing to
// begin.
RESIZE_IN_PROGRESS
};
// Called as a result of ET_MOUSE_PRESSED.
void OnMousePressed(ui::MouseEvent* event);
// Called as a result of ET_MOUSE_DRAGGED.
void OnMouseDragged(ui::MouseEvent* event);
// Stops the resize operation if one is in progress. Consumes |event| if it
// is not NULL and the resize operation was stopped.
void StopResizing(ui::MouseEvent* event, bool canceled);
// ui::EventHandler:
void OnMouseEvent(ui::MouseEvent* event) override;
// The panel being resized.
Panel* panel_;
// |panel|'s window.
aura::Window* window_;
ResizeState resize_state_;
// The edge that the user is resizing.
int resize_component_;
// The location of the mouse click on the window border.
gfx::Point initial_press_location_in_screen_;
DISALLOW_COPY_AND_ASSIGN(X11PanelResizer);
};
#endif // CHROME_BROWSER_UI_VIEWS_PANELS_X11_PANEL_RESIZER_H_
|