OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 10 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
11 #include "chrome/browser/ui/gtk/menu_gtk.h" | 11 #include "chrome/browser/ui/gtk/menu_gtk.h" |
12 #include "chrome/browser/ui/panels/native_panel.h" | 12 #include "chrome/browser/ui/panels/native_panel.h" |
13 #include "ui/base/animation/animation_delegate.h" | 13 #include "ui/base/animation/animation_delegate.h" |
14 | 14 |
15 class Panel; | 15 class Panel; |
16 class PanelBoundsAnimation; | 16 class PanelBoundsAnimation; |
| 17 class PanelDragGtk; |
17 class PanelSettingsMenuModel; | 18 class PanelSettingsMenuModel; |
18 class NativePanelTestingGtk; | 19 class NativePanelTestingGtk; |
19 | 20 |
20 class PanelBrowserWindowGtk : public BrowserWindowGtk, | 21 class PanelBrowserWindowGtk : public BrowserWindowGtk, |
21 public MenuGtk::Delegate, | 22 public MenuGtk::Delegate, |
22 public MessageLoopForUI::Observer, | 23 public MessageLoopForUI::Observer, |
23 public NativePanel, | 24 public NativePanel, |
24 public ui::AnimationDelegate { | 25 public ui::AnimationDelegate { |
25 public: | 26 public: |
26 PanelBrowserWindowGtk(Browser* browser, Panel* panel, | 27 PanelBrowserWindowGtk(Browser* browser, Panel* panel, |
(...skipping 16 matching lines...) Expand all Loading... |
43 const content::NotificationSource& source, | 44 const content::NotificationSource& source, |
44 const content::NotificationDetails& details) OVERRIDE; | 45 const content::NotificationDetails& details) OVERRIDE; |
45 | 46 |
46 protected: | 47 protected: |
47 // BrowserWindowGtk overrides | 48 // BrowserWindowGtk overrides |
48 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE; | 49 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE; |
49 virtual bool HandleTitleBarLeftMousePress( | 50 virtual bool HandleTitleBarLeftMousePress( |
50 GdkEventButton* event, | 51 GdkEventButton* event, |
51 guint32 last_click_time, | 52 guint32 last_click_time, |
52 gfx::Point last_click_position) OVERRIDE; | 53 gfx::Point last_click_position) OVERRIDE; |
| 54 virtual bool HandleWindowEdgeLeftMousePress( |
| 55 GtkWindow* window, |
| 56 GdkWindowEdge edge, |
| 57 GdkEventButton* event) OVERRIDE; |
53 virtual void SaveWindowPosition() OVERRIDE; | 58 virtual void SaveWindowPosition() OVERRIDE; |
54 virtual void SetGeometryHints() OVERRIDE; | 59 virtual void SetGeometryHints() OVERRIDE; |
55 virtual bool UseCustomFrame() OVERRIDE; | 60 virtual bool UseCustomFrame() OVERRIDE; |
56 virtual void OnSizeChanged(int width, int height) OVERRIDE; | 61 virtual void OnSizeChanged(int width, int height) OVERRIDE; |
57 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, | 62 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, |
58 GdkEventExpose* event) OVERRIDE; | 63 GdkEventExpose* event) OVERRIDE; |
59 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, | 64 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, |
60 GdkEventExpose* event) OVERRIDE; | 65 GdkEventExpose* event) OVERRIDE; |
61 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 66 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
62 // 'focus-in-event' handler. | 67 // 'focus-in-event' handler. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 123 |
119 // Overridden from AnimationDelegate: | 124 // Overridden from AnimationDelegate: |
120 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 125 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
121 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 126 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
122 | 127 |
123 void CreateDragWidget(); | 128 void CreateDragWidget(); |
124 void DestroyDragWidget(); | 129 void DestroyDragWidget(); |
125 void EndDrag(bool canceled); | 130 void EndDrag(bool canceled); |
126 void CleanupDragDrop(); | 131 void CleanupDragDrop(); |
127 | 132 |
| 133 // Creates helper for handling drags if not already created. |
| 134 void EnsureDragHelperCreated(); |
| 135 |
128 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); | 136 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); |
129 void ResizeWindow(int width, int height); | 137 void ResizeWindow(int width, int height); |
130 | 138 |
131 void DrawAttentionFrame(cairo_t* cr, GtkWidget* widget, | 139 void DrawAttentionFrame(cairo_t* cr, GtkWidget* widget, |
132 GdkEventExpose* event); | 140 GdkEventExpose* event); |
133 GdkRectangle GetTitlebarRectForDrawAttention() const; | 141 GdkRectangle GetTitlebarRectForDrawAttention() const; |
134 | 142 |
135 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, | 143 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, |
136 OnTitlebarButtonPressEvent, GdkEventButton*); | 144 OnTitlebarButtonPressEvent, GdkEventButton*); |
137 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, | 145 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // a task to end the drag and only run it if GTK+ didn't send us the | 187 // a task to end the drag and only run it if GTK+ didn't send us the |
180 // drag-failed event. | 188 // drag-failed event. |
181 base::WeakPtrFactory<PanelBrowserWindowGtk> drag_end_factory_; | 189 base::WeakPtrFactory<PanelBrowserWindowGtk> drag_end_factory_; |
182 | 190 |
183 scoped_ptr<Panel> panel_; | 191 scoped_ptr<Panel> panel_; |
184 gfx::Rect bounds_; | 192 gfx::Rect bounds_; |
185 | 193 |
186 scoped_ptr<PanelSettingsMenuModel> settings_menu_model_; | 194 scoped_ptr<PanelSettingsMenuModel> settings_menu_model_; |
187 scoped_ptr<MenuGtk> settings_menu_; | 195 scoped_ptr<MenuGtk> settings_menu_; |
188 | 196 |
| 197 scoped_ptr<PanelDragGtk> drag_helper_; |
| 198 |
189 // Size of window frame. Empty until the window has been allocated and sized. | 199 // Size of window frame. Empty until the window has been allocated and sized. |
190 gfx::Size frame_size_; | 200 gfx::Size frame_size_; |
191 | 201 |
192 // Indicates that the panel is currently drawing attention. | 202 // Indicates that the panel is currently drawing attention. |
193 bool is_drawing_attention_; | 203 bool is_drawing_attention_; |
194 | 204 |
195 // Disable ExpansionState changes on mouse click for a short duration. | 205 // Disable ExpansionState changes on mouse click for a short duration. |
196 // This is needed in case the window gains focus as result of mouseDown while | 206 // This is needed in case the window gains focus as result of mouseDown while |
197 // being already expanded and drawing attention - in this case, we don't | 207 // being already expanded and drawing attention - in this case, we don't |
198 // want to minimize it on subsequent mouseUp. | 208 // want to minimize it on subsequent mouseUp. |
(...skipping 18 matching lines...) Expand all Loading... |
217 | 227 |
218 // The close button is not shown when panel is in icon only mode in overflow. | 228 // The close button is not shown when panel is in icon only mode in overflow. |
219 bool show_close_button_; | 229 bool show_close_button_; |
220 | 230 |
221 content::NotificationRegistrar registrar_; | 231 content::NotificationRegistrar registrar_; |
222 | 232 |
223 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); | 233 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); |
224 }; | 234 }; |
225 | 235 |
226 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ | 236 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ |
OLD | NEW |