| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 5 #ifndef VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
| 6 #define VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 6 #define VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "views/controls/native/native_view_host_wrapper.h" | 12 #include "views/controls/native/native_view_host_wrapper.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 class View; | 16 class View; |
| 17 | 17 |
| 18 class NativeViewHostGtk : public NativeViewHostWrapper { | 18 class NativeViewHostGtk : public NativeViewHostWrapper { |
| 19 public: | 19 public: |
| 20 explicit NativeViewHostGtk(NativeViewHost* host); | 20 explicit NativeViewHostGtk(NativeViewHost* host); |
| 21 virtual ~NativeViewHostGtk(); | 21 virtual ~NativeViewHostGtk(); |
| 22 | 22 |
| 23 // Sets and retrieves the View associated with a particular widget. | |
| 24 // TODO(beng): move to NativeViewHost, and have take gfx::NativeViews. | |
| 25 static View* GetViewForNative(GtkWidget* widget); | |
| 26 static void SetViewForNative(GtkWidget* widget, View* view); | |
| 27 | |
| 28 // Overridden from NativeViewHostWrapper: | 23 // Overridden from NativeViewHostWrapper: |
| 29 virtual void NativeViewAttached(); | 24 virtual void NativeViewAttached(); |
| 30 virtual void NativeViewDetaching(); | 25 virtual void NativeViewDetaching(); |
| 31 virtual void AddedToWidget(); | 26 virtual void AddedToWidget(); |
| 32 virtual void RemovedFromWidget(); | 27 virtual void RemovedFromWidget(); |
| 33 virtual void InstallClip(int x, int y, int w, int h); | 28 virtual void InstallClip(int x, int y, int w, int h); |
| 34 virtual bool HasInstalledClip(); | 29 virtual bool HasInstalledClip(); |
| 35 virtual void UninstallClip(); | 30 virtual void UninstallClip(); |
| 36 virtual void ShowWidget(int x, int y, int w, int h); | 31 virtual void ShowWidget(int x, int y, int w, int h); |
| 37 virtual void HideWidget(); | 32 virtual void HideWidget(); |
| 38 virtual void SetFocus(); | 33 virtual void SetFocus(); |
| 39 | 34 |
| 40 private: | 35 private: |
| 41 // Our associated NativeViewHost. | 36 // Our associated NativeViewHost. |
| 42 NativeViewHost* host_; | 37 NativeViewHost* host_; |
| 43 | 38 |
| 44 // Have we installed a region on the gfx::NativeView used to clip to only the | 39 // Have we installed a region on the gfx::NativeView used to clip to only the |
| 45 // visible portion of the gfx::NativeView ? | 40 // visible portion of the gfx::NativeView ? |
| 46 bool installed_clip_; | 41 bool installed_clip_; |
| 47 | 42 |
| 48 // Signal handle id for 'destroy' signal. | 43 // Signal handle id for 'destroy' signal. |
| 49 gulong destroy_signal_id_; | 44 gulong destroy_signal_id_; |
| 50 | 45 |
| 51 // Invoked from the 'destroy' signal. | 46 // Invoked from the 'destroy' signal. |
| 52 static void CallDestroy(GtkObject* object); | 47 static void CallDestroy(GtkObject* object, NativeViewHostGtk* host); |
| 53 | 48 |
| 54 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); | 49 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); |
| 55 }; | 50 }; |
| 56 | 51 |
| 57 } // namespace views | 52 } // namespace views |
| 58 | 53 |
| 59 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 54 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
| 60 | 55 |
| OLD | NEW |