OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "views/widget/tooltip_manager_gtk.h" | 5 #include "views/widget/tooltip_manager_gtk.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "gfx/font.h" | 9 #include "gfx/font.h" |
10 #include "views/focus/focus_manager.h" | 10 #include "views/focus/focus_manager.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // it to make sure the correct font gets set). | 23 // it to make sure the correct font gets set). |
24 GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); | 24 GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); |
25 gtk_widget_set_name(window, "gtk-tooltip"); | 25 gtk_widget_set_name(window, "gtk-tooltip"); |
26 GtkWidget* label = gtk_label_new(""); | 26 GtkWidget* label = gtk_label_new(""); |
27 gtk_widget_show(label); | 27 gtk_widget_show(label); |
28 | 28 |
29 gtk_container_add(GTK_CONTAINER(window), label); | 29 gtk_container_add(GTK_CONTAINER(window), label); |
30 gtk_widget_realize(window); | 30 gtk_widget_realize(window); |
31 | 31 |
32 GtkStyle* style = gtk_widget_get_style(label); | 32 GtkStyle* style = gtk_widget_get_style(label); |
33 gfx::Font* font = new gfx::Font(gfx::Font::CreateFont(style->font_desc)); | 33 gfx::Font* font = new gfx::Font(style->font_desc); |
34 | 34 |
35 gtk_widget_destroy(window); | 35 gtk_widget_destroy(window); |
36 | 36 |
37 return font; | 37 return font; |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 int TooltipManager::GetTooltipHeight() { | 41 int TooltipManager::GetTooltipHeight() { |
42 // This is only used to position the tooltip, and we don't yet support | 42 // This is only used to position the tooltip, and we don't yet support |
43 // positioning the tooltip, it isn't worth trying to implement this. | 43 // positioning the tooltip, it isn't worth trying to implement this. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if (!g_signal_parse_name("show_help", itype, &signal_id, &detail, FALSE)) { | 173 if (!g_signal_parse_name("show_help", itype, &signal_id, &detail, FALSE)) { |
174 NOTREACHED(); | 174 NOTREACHED(); |
175 return false; | 175 return false; |
176 } | 176 } |
177 gboolean result; | 177 gboolean result; |
178 g_signal_emit(widget, signal_id, 0, GTK_WIDGET_HELP_TOOLTIP, &result); | 178 g_signal_emit(widget, signal_id, 0, GTK_WIDGET_HELP_TOOLTIP, &result); |
179 return true; | 179 return true; |
180 } | 180 } |
181 | 181 |
182 } // namespace views | 182 } // namespace views |
OLD | NEW |