OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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 UI_VIEWS_CONTROLS_NATIVE_CONTROL_GTK_H_ | |
6 #define UI_VIEWS_CONTROLS_NATIVE_CONTROL_GTK_H_ | |
7 #pragma once | |
8 | |
9 #include <gtk/gtk.h> | |
10 | |
11 #include "base/compiler_specific.h" | |
12 #include "ui/views/controls/native/native_view_host.h" | |
13 | |
14 namespace views { | |
15 | |
16 // A View that hosts a native control. | |
17 class NativeControlGtk : public NativeViewHost { | |
18 public: | |
19 NativeControlGtk(); | |
20 virtual ~NativeControlGtk(); | |
21 | |
22 // Overridden from View: | |
23 virtual void OnEnabledChanged() OVERRIDE; | |
24 | |
25 protected: | |
26 virtual void ViewHierarchyChanged(bool is_add, | |
27 View *parent, | |
28 View *child) OVERRIDE; | |
29 virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; | |
30 virtual void OnFocus() OVERRIDE; | |
31 | |
32 // Called when the NativeControlGtk is attached to a View hierarchy with a | |
33 // valid Widget. The NativeControlGtk should use this opportunity to create | |
34 // its associated GtkWidget. | |
35 virtual void CreateNativeControl() = 0; | |
36 | |
37 // MUST be called by the subclass implementation of |CreateNativeControl| | |
38 // immediately after creating the control GtkWidget, otherwise it won't be | |
39 // attached to the GtkView and will be effectively orphaned. | |
40 virtual void NativeControlCreated(GtkWidget* widget); | |
41 | |
42 private: | |
43 static gboolean CallFocusIn(GtkWidget* gtk_widget, | |
44 GdkEventFocus* event, | |
45 NativeControlGtk* button); | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(NativeControlGtk); | |
48 }; | |
49 | |
50 } // namespace views | |
51 | |
52 #endif // UI_VIEWS_CONTROLS_NATIVE_CONTROL_GTK_H_ | |
OLD | NEW |