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

Side by Side Diff: chrome/browser/ui/panels/panel_drag_gtk.h

Issue 10020057: Resize support for detached GTK Panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_DRAG_GTK_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_
7 #pragma once
8
9 #include <gtk/gtk.h>
10
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "ui/base/gtk/gtk_signal.h"
14
15 class Panel;
16 class PanelDragDelegate;
17
18 // Class for GTK handling of move-drag and resize-drag on a panel.
19 // Only one type of drag may be active at any time.
20 // Dragging only begins if the mouse is moved beyond the drag threshold.
21 // If mouse is released without exceeding the drag threshold, the mouse
22 // press and release is treated as a mouse click.
23 class PanelDragGtk {
dcheng 2012/04/12 00:12:45 Given that this is named drag_helper_ in PanelBrow
24 public:
25 explicit PanelDragGtk(Panel* panel);
26 ~PanelDragGtk();
27
28 GtkWidget* widget() const { return drag_widget_; }
29
30 // Sets up mouse and keyboard events processing while the mouse
31 // is pressed on a window edge.
32 // |event| is the mouse press event.
33 // |cursor| is the cursor to display during the drag.
34 // |edge| is the window edge from which to resize the panel.
35 void InitialWindowEdgeMousePress(GdkEventButton* event, GdkCursor* cursor,
36 GdkWindowEdge& edge);
37
38 // Sets up mouse and keyboard events processing while the mouse is
39 // pressed on the titlebar.
40 // |event| is the mouse press event.
41 // |titlebar_widget| should handle the mouse release event if the mouse
42 // is released without exceeding the drag threshold (a mouse click).
43 void InitialTitlebarMousePress(GdkEventButton* event,
44 GtkWidget* titlebar_widget);
45
46 private:
47 enum DragState {
48 NOT_DRAGGING,
49 DRAG_IN_PROGRESS
50 };
51
52 // Callbacks for GTK mouse and key events.
53 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnMouseMoveEvent,
54 GdkEventMotion*);
55 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnButtonPressEvent,
56 GdkEventButton*);
57 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnButtonReleaseEvent,
58 GdkEventButton*);
59 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnKeyPressEvent,
60 GdkEventKey*);
61 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnKeyReleaseEvent,
62 GdkEventKey*);
63 CHROMEGTK_CALLBACK_1(PanelDragGtk, gboolean, OnGrabBrokenEvent,
64 GdkEventGrabBroken*);
65
66 // Utility to dcheck a bunch of state to ensure a clean slate.
67 // Returns true only if all the dchecks pass.
68 bool AssertCleanState();
69
70 void GrabPointerAndKeyboard(GdkEventButton* event,
71 GdkCursor* cursor);
72
73 // Ends any drag that is currently in progress (if any).
74 // Also resets all drag state.
75 void EndDrag(bool canceled);
76
77 // Weak pointer to the panel being dragged.
78 Panel* panel_;
79
80 // Invisible event box to receive mouse and key events.
81 GtkWidget* drag_widget_;
82
83 DragState drag_state_;
84
85 // A copy of the initial button press event.
86 GdkEvent* initial_mouse_down_;
87
88 // Widget that should process the mouse click if mouse is released
89 // without exceeding the drag threshold. May be NULL if no click
90 // handling is necessary.
91 GtkWidget* click_handler_;
92
93 // Delegate for processing drag depends on actual type of drag.
94 PanelDragDelegate* drag_delegate_;
dcheng 2012/04/12 00:12:45 Nit: DISABLE_COPY_AND_ASSIGN
jennb 2012/04/12 18:00:24 Done.
95 };
96
97 #endif // CHROME_BROWSER_UI_PANELS_PANEL_DRAG_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698