| 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 "views/controls/native_view_host.h" | 11 #include "base/logging.h" |
| 12 #include "views/controls/native/native_view_host_wrapper.h" |
| 12 | 13 |
| 13 namespace views { | 14 namespace views { |
| 14 | 15 |
| 15 class NativeViewHostGtk : public NativeViewHost { | 16 class View; |
| 17 |
| 18 class NativeViewHostGtk : public NativeViewHostWrapper { |
| 16 public: | 19 public: |
| 17 NativeViewHostGtk(); | 20 explicit NativeViewHostGtk(NativeViewHost* host); |
| 18 virtual ~NativeViewHostGtk(); | 21 virtual ~NativeViewHostGtk(); |
| 19 | 22 |
| 20 // Sets and retrieves the View associated with a particular widget. | 23 // Sets and retrieves the View associated with a particular widget. |
| 24 // TODO(beng): move to NativeViewHost, and have take gfx::NativeViews. |
| 21 static View* GetViewForNative(GtkWidget* widget); | 25 static View* GetViewForNative(GtkWidget* widget); |
| 22 static void SetViewForNative(GtkWidget* widget, View* view); | 26 static void SetViewForNative(GtkWidget* widget, View* view); |
| 23 | 27 |
| 24 // Attach a widget to this View, making the window it represents | 28 // Overridden from NativeViewHostWrapper: |
| 25 // subject to sizing according to this View's parent container's Layout | 29 virtual void NativeViewAttached(); |
| 26 // Manager's sizing heuristics. | 30 virtual void NativeViewDetaching(); |
| 27 // | 31 virtual void AddedToWidget(); |
| 28 // This object should be added to the view hierarchy before calling this | 32 virtual void RemovedFromWidget(); |
| 29 // function, which will expect the parent to be valid. | |
| 30 | |
| 31 // TODO: figure out ownership! | |
| 32 void Attach(gfx::NativeView w); | |
| 33 | |
| 34 // Detach the attached widget handle. It will no longer be updated | |
| 35 void Detach(); | |
| 36 | |
| 37 protected: | |
| 38 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); | |
| 39 | |
| 40 virtual void Focus(); | |
| 41 | |
| 42 // NativeHostView overrides. | |
| 43 virtual void InstallClip(int x, int y, int w, int h); | 33 virtual void InstallClip(int x, int y, int w, int h); |
| 34 virtual bool HasInstalledClip(); |
| 44 virtual void UninstallClip(); | 35 virtual void UninstallClip(); |
| 45 virtual void ShowWidget(int x, int y, int w, int h); | 36 virtual void ShowWidget(int x, int y, int w, int h); |
| 46 virtual void HideWidget(); | 37 virtual void HideWidget(); |
| 38 virtual void SetFocus(); |
| 47 | 39 |
| 48 private: | 40 private: |
| 41 // Our associated NativeViewHost. |
| 42 NativeViewHost* host_; |
| 43 |
| 44 // Have we installed a region on the gfx::NativeView used to clip to only the |
| 45 // visible portion of the gfx::NativeView ? |
| 46 bool installed_clip_; |
| 47 |
| 49 // Signal handle id for 'destroy' signal. | 48 // Signal handle id for 'destroy' signal. |
| 50 gulong destroy_signal_id_; | 49 gulong destroy_signal_id_; |
| 51 | 50 |
| 52 // Invoked from the 'destroy' signal. | 51 // Invoked from the 'destroy' signal. |
| 53 void OnDestroy(); | |
| 54 | |
| 55 static void CallDestroy(GtkObject* object); | 52 static void CallDestroy(GtkObject* object); |
| 56 | 53 |
| 57 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); | 54 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 } // namespace views | 57 } // namespace views |
| 61 | 58 |
| 62 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | 59 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ |
| 60 |
| OLD | NEW |