OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | |
6 #define VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | |
7 | |
8 #include <gtk/gtk.h> | |
9 #include <string> | |
10 | |
11 #include "views/controls/native_view_host.h" | |
12 | |
13 namespace views { | |
14 | |
15 class NativeViewHostGtk : public NativeViewHost { | |
16 public: | |
17 NativeViewHostGtk(); | |
18 virtual ~NativeViewHostGtk(); | |
19 | |
20 // Sets and retrieves the View associated with a particular widget. | |
21 static View* GetViewForNative(GtkWidget* widget); | |
22 static void SetViewForNative(GtkWidget* widget, View* view); | |
23 | |
24 // Attach a widget to this View, making the window it represents | |
25 // subject to sizing according to this View's parent container's Layout | |
26 // Manager's sizing heuristics. | |
27 // | |
28 // This object should be added to the view hierarchy before calling this | |
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); | |
44 virtual void UninstallClip(); | |
45 virtual void ShowWidget(int x, int y, int w, int h); | |
46 virtual void HideWidget(); | |
47 | |
48 private: | |
49 // Signal handle id for 'destroy' signal. | |
50 gulong destroy_signal_id_; | |
51 | |
52 // Invoked from the 'destroy' signal. | |
53 void OnDestroy(); | |
54 | |
55 static void CallDestroy(GtkObject* object); | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(NativeViewHostGtk); | |
58 }; | |
59 | |
60 } // namespace views | |
61 | |
62 #endif // VIEWS_CONTROLS_NATIVE_HOST_VIEW_GTK_H_ | |
OLD | NEW |