Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: chrome/browser/ui/views/panels/x11_panel_resizer.h

Issue 320713004: Update panel layout immediately after the user has finished resizing a panel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/panels/panel_view.cc ('k') | chrome/browser/ui/views/panels/x11_panel_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/panels/x11_panel_resizer.h
diff --git a/chrome/browser/ui/views/panels/x11_panel_resizer.h b/chrome/browser/ui/views/panels/x11_panel_resizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..55c6033b4905cfb1ad9d5ddf18895109b48804e9
--- /dev/null
+++ b/chrome/browser/ui/views/panels/x11_panel_resizer.h
@@ -0,0 +1,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/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);
+ virtual ~X11PanelResizer();
+
+ 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:
+ virtual 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_
« no previous file with comments | « chrome/browser/ui/views/panels/panel_view.cc ('k') | chrome/browser/ui/views/panels/x11_panel_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698