OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ | 5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
6 #define VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ | 6 #define VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "ui/base/gtk/gtk_signal.h" | 13 #include "ui/base/gtk/gtk_signal.h" |
14 #include "ui/base/x/active_window_watcher_x.h" | 14 #include "ui/base/x/active_window_watcher_x.h" |
| 15 #include "ui/gfx/compositor/compositor.h" |
15 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
16 #include "views/focus/focus_manager.h" | 17 #include "views/focus/focus_manager.h" |
17 #include "views/widget/native_widget_private.h" | 18 #include "views/widget/native_widget_private.h" |
18 #include "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
19 | 20 |
20 namespace gfx { | 21 namespace gfx { |
21 class Rect; | 22 class Rect; |
22 } | 23 } |
23 | 24 |
24 namespace ui { | 25 namespace ui { |
25 class OSExchangeData; | 26 class OSExchangeData; |
26 class OSExchangeDataProviderGtk; | 27 class OSExchangeDataProviderGtk; |
27 } | 28 } |
28 using ui::OSExchangeData; | 29 using ui::OSExchangeData; |
29 using ui::OSExchangeDataProviderGtk; | 30 using ui::OSExchangeDataProviderGtk; |
30 | 31 |
31 namespace views { | 32 namespace views { |
32 | 33 |
33 class DropTargetGtk; | 34 class DropTargetGtk; |
34 class InputMethod; | 35 class InputMethod; |
35 class TooltipManagerGtk; | 36 class TooltipManagerGtk; |
36 class View; | 37 class View; |
37 | 38 |
38 namespace internal { | 39 namespace internal { |
39 class NativeWidgetDelegate; | 40 class NativeWidgetDelegate; |
40 } | 41 } |
41 | 42 |
42 // Widget implementation for GTK. | 43 // Widget implementation for GTK. |
43 class VIEWS_EXPORT NativeWidgetGtk : public internal::NativeWidgetPrivate, | 44 class VIEWS_EXPORT NativeWidgetGtk : public internal::NativeWidgetPrivate, |
| 45 public ui::CompositorOwner, |
44 public ui::ActiveWindowWatcherX::Observer { | 46 public ui::ActiveWindowWatcherX::Observer { |
45 public: | 47 public: |
46 explicit NativeWidgetGtk(internal::NativeWidgetDelegate* delegate); | 48 explicit NativeWidgetGtk(internal::NativeWidgetDelegate* delegate); |
47 virtual ~NativeWidgetGtk(); | 49 virtual ~NativeWidgetGtk(); |
48 | 50 |
49 // Returns the transient parent. See make_transient_to_parent for details on | 51 // Returns the transient parent. See make_transient_to_parent for details on |
50 // what the transient parent is. | 52 // what the transient parent is. |
51 GtkWindow* GetTransientParent() const; | 53 GtkWindow* GetTransientParent() const; |
52 | 54 |
53 // Makes the background of the window totally transparent. This must be | 55 // Makes the background of the window totally transparent. This must be |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // application. | 292 // application. |
291 virtual void HandleGtkGrabBroke(); | 293 virtual void HandleGtkGrabBroke(); |
292 | 294 |
293 const internal::NativeWidgetDelegate* delegate() const { return delegate_; } | 295 const internal::NativeWidgetDelegate* delegate() const { return delegate_; } |
294 internal::NativeWidgetDelegate* delegate() { return delegate_; } | 296 internal::NativeWidgetDelegate* delegate() { return delegate_; } |
295 | 297 |
296 private: | 298 private: |
297 class DropObserver; | 299 class DropObserver; |
298 friend class DropObserver; | 300 friend class DropObserver; |
299 | 301 |
| 302 // Overridden from ui::CompositorOwner |
| 303 virtual gfx::AcceleratedWidget GetAcceleratedWidget() { |
| 304 return GDK_WINDOW_XID(window_contents_->window); |
| 305 } |
| 306 |
| 307 virtual void PaintNow() { |
| 308 // Do something |
| 309 } |
| 310 |
300 // Overridden from internal::InputMethodDelegate | 311 // Overridden from internal::InputMethodDelegate |
301 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; | 312 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; |
302 | 313 |
303 void SetInitParams(const Widget::InitParams& params); | 314 void SetInitParams(const Widget::InitParams& params); |
304 | 315 |
305 // This is called only when the window is transparent. | 316 // This is called only when the window is transparent. |
306 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnWindowPaint, | 317 CHROMEGTK_CALLBACK_1(NativeWidgetGtk, gboolean, OnWindowPaint, |
307 GdkEventExpose*); | 318 GdkEventExpose*); |
308 | 319 |
309 // Callbacks for expose event on child widgets. See the description of | 320 // Callbacks for expose event on child widgets. See the description of |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 458 |
448 // If we were created for a menu. | 459 // If we were created for a menu. |
449 bool is_menu_; | 460 bool is_menu_; |
450 | 461 |
451 DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); | 462 DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); |
452 }; | 463 }; |
453 | 464 |
454 } // namespace views | 465 } // namespace views |
455 | 466 |
456 #endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ | 467 #endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
OLD | NEW |