summaryrefslogtreecommitdiffstats
path: root/views/controls/native/native_view_host_gtk.h
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-29 06:02:19 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-29 06:02:19 +0000
commit17dee5e7005a82e08d11be50d56477939124a6b7 (patch)
tree7133a5d7a086ce238057cb82e0e81d332dafba8f /views/controls/native/native_view_host_gtk.h
parentbf0136d62bfe02f57821ce026c04b6e8204eb482 (diff)
downloadchromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.zip
chromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.tar.gz
chromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.tar.bz2
Refactors HWNDView, NativeViewHostGtk and NativeViewHost so that they match the NativeControl pattern established for NativeButtons. NativeViewHost is a platform-neutral class that clients instantiate. Behind the scenes the platform instantiates the appropriate NativeViewHostWrapper implementation, either NativeViewHostGtk (as before) or NativeViewHostWin (replaces HWNDView).
BUG=none TEST=none Review URL: http://codereview.chromium.org/114059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17169 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/native/native_view_host_gtk.h')
-rw-r--r--views/controls/native/native_view_host_gtk.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/views/controls/native/native_view_host_gtk.h b/views/controls/native/native_view_host_gtk.h
new file mode 100644
index 0000000..40a6a65
--- /dev/null
+++ b/views/controls/native/native_view_host_gtk.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_
+#define VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_
+
+#include <gtk/gtk.h>
+#include <string>
+
+#include "base/logging.h"
+#include "views/controls/native/native_view_host_wrapper.h"
+
+namespace views {
+
+class View;
+
+class NativeViewHostGtk : public NativeViewHostWrapper {
+ public:
+ explicit NativeViewHostGtk(NativeViewHost* host);
+ virtual ~NativeViewHostGtk();
+
+ // Sets and retrieves the View associated with a particular widget.
+ // TODO(beng): move to NativeViewHost, and have take gfx::NativeViews.
+ static View* GetViewForNative(GtkWidget* widget);
+ static void SetViewForNative(GtkWidget* widget, View* view);
+
+ // Overridden from NativeViewHostWrapper:
+ virtual void NativeViewAttached();
+ virtual void NativeViewDetaching();
+ virtual void AddedToWidget();
+ virtual void RemovedFromWidget();
+ virtual void InstallClip(int x, int y, int w, int h);
+ virtual bool HasInstalledClip();
+ virtual void UninstallClip();
+ virtual void ShowWidget(int x, int y, int w, int h);
+ virtual void HideWidget();
+ virtual void SetFocus();
+
+ private:
+ // Our associated NativeViewHost.
+ NativeViewHost* host_;
+
+ // Have we installed a region on the gfx::NativeView used to clip to only the
+ // visible portion of the gfx::NativeView ?
+ bool installed_clip_;
+
+ // Signal handle id for 'destroy' signal.
+ gulong destroy_signal_id_;
+
+ // Invoked from the 'destroy' signal.
+ static void CallDestroy(GtkObject* object);
+
+ DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk);
+};
+
+} // namespace views
+
+#endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_
+