summaryrefslogtreecommitdiffstats
path: root/views/controls/native/native_view_host_gtk.h
blob: 40a6a65db52fbc7ca0788f65ac8095e001182ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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_