| 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/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "ui/base/gtk/gtk_signal.h" | 14 #include "ui/base/gtk/gtk_signal.h" |
| 15 #include "ui/base/x/active_window_watcher_x.h" | 15 #include "ui/base/x/active_window_watcher_x_observer.h" |
| 16 #include "ui/gfx/compositor/compositor.h" | 16 #include "ui/gfx/compositor/compositor.h" |
| 17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
| 18 #include "views/focus/focus_manager.h" | 18 #include "views/focus/focus_manager.h" |
| 19 #include "views/widget/native_widget_private.h" | 19 #include "views/widget/native_widget_private.h" |
| 20 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class Rect; | 23 class Rect; |
| 24 } | 24 } |
| 25 | 25 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 class InputMethod; | 37 class InputMethod; |
| 38 class View; | 38 class View; |
| 39 | 39 |
| 40 namespace internal { | 40 namespace internal { |
| 41 class NativeWidgetDelegate; | 41 class NativeWidgetDelegate; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Widget implementation for GTK. | 44 // Widget implementation for GTK. |
| 45 class VIEWS_EXPORT NativeWidgetGtk : public internal::NativeWidgetPrivate, | 45 class VIEWS_EXPORT NativeWidgetGtk : public internal::NativeWidgetPrivate, |
| 46 public ui::CompositorDelegate, | 46 public ui::CompositorDelegate, |
| 47 public ui::ActiveWindowWatcherX::Observer { | 47 public ui::ActiveWindowWatcherXObserver { |
| 48 public: | 48 public: |
| 49 explicit NativeWidgetGtk(internal::NativeWidgetDelegate* delegate); | 49 explicit NativeWidgetGtk(internal::NativeWidgetDelegate* delegate); |
| 50 virtual ~NativeWidgetGtk(); | 50 virtual ~NativeWidgetGtk(); |
| 51 | 51 |
| 52 // Returns the transient parent. See make_transient_to_parent for details on | 52 // Returns the transient parent. See make_transient_to_parent for details on |
| 53 // what the transient parent is. | 53 // what the transient parent is. |
| 54 GtkWindow* GetTransientParent() const; | 54 GtkWindow* GetTransientParent() const; |
| 55 | 55 |
| 56 // Makes the background of the window totally transparent. This must be | 56 // Makes the background of the window totally transparent. This must be |
| 57 // invoked before Init. This does a couple of checks and returns true if | 57 // invoked before Init. This does a couple of checks and returns true if |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // Sets the drop target to NULL. This is invoked by DropTargetGTK when the | 98 // Sets the drop target to NULL. This is invoked by DropTargetGTK when the |
| 99 // drop is done. | 99 // drop is done. |
| 100 void ResetDropTarget(); | 100 void ResetDropTarget(); |
| 101 | 101 |
| 102 // Gets the requested size of the widget. This can be the size | 102 // Gets the requested size of the widget. This can be the size |
| 103 // stored in properties for a GtkViewsFixed, or in the requisitioned | 103 // stored in properties for a GtkViewsFixed, or in the requisitioned |
| 104 // size of other kinds of widgets. | 104 // size of other kinds of widgets. |
| 105 void GetRequestedSize(gfx::Size* out) const; | 105 void GetRequestedSize(gfx::Size* out) const; |
| 106 | 106 |
| 107 // Overridden from ui::ActiveWindowWatcherX::Observer. | 107 // Overridden from ui::ActiveWindowWatcherXObserver. |
| 108 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 108 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
| 109 | 109 |
| 110 // Handles a keyboard event by sending it to our focus manager. | 110 // Handles a keyboard event by sending it to our focus manager. |
| 111 // Returns true if it's handled by the focus manager. | 111 // Returns true if it's handled by the focus manager. |
| 112 bool HandleKeyboardEvent(const KeyEvent& key); | 112 bool HandleKeyboardEvent(const KeyEvent& key); |
| 113 | 113 |
| 114 // Tells widget not to remove FREEZE_UPDATES property when the | 114 // Tells widget not to remove FREEZE_UPDATES property when the |
| 115 // widget is painted. This is used if painting the gtk widget | 115 // widget is painted. This is used if painting the gtk widget |
| 116 // is not enough to show the window and has to wait further like | 116 // is not enough to show the window and has to wait further like |
| 117 // keyboard overlay. Returns true if this is called before | 117 // keyboard overlay. Returns true if this is called before |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 bool is_menu_; | 466 bool is_menu_; |
| 467 | 467 |
| 468 scoped_ptr<ui::GtkSignalRegistrar> signal_registrar_; | 468 scoped_ptr<ui::GtkSignalRegistrar> signal_registrar_; |
| 469 | 469 |
| 470 DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); | 470 DISALLOW_COPY_AND_ASSIGN(NativeWidgetGtk); |
| 471 }; | 471 }; |
| 472 | 472 |
| 473 } // namespace views | 473 } // namespace views |
| 474 | 474 |
| 475 #endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ | 475 #endif // VIEWS_WIDGET_NATIVE_WIDGET_GTK_H_ |
| OLD | NEW |