Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Side by Side Diff: views/controls/textfield/gtk_views_entry.cc

Issue 3083022: Rework gfx::Font by moving platform-specific code into inner classes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/table/table_view.cc ('k') | views/controls/textfield/gtk_views_textview.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/controls/textfield/gtk_views_entry.h" 5 #include "views/controls/textfield/gtk_views_entry.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "gfx/canvas_skia_paint.h" 8 #include "gfx/canvas_skia_paint.h"
9 #include "gfx/insets.h" 9 #include "gfx/insets.h"
10 #include "gfx/skia_utils_gtk.h" 10 #include "gfx/skia_utils_gtk.h"
(...skipping 20 matching lines...) Expand all
31 gfx::CanvasSkiaPaint canvas(event); 31 gfx::CanvasSkiaPaint canvas(event);
32 if (!canvas.is_empty()) { 32 if (!canvas.is_empty()) {
33 gfx::Insets insets = 33 gfx::Insets insets =
34 views::NativeTextfieldGtk::GetEntryInnerBorder(entry); 34 views::NativeTextfieldGtk::GetEntryInnerBorder(entry);
35 gfx::Font font = host->textfield()->font(); 35 gfx::Font font = host->textfield()->font();
36 const string16 text = host->textfield()->text_to_display_when_empty(); 36 const string16 text = host->textfield()->text_to_display_when_empty();
37 canvas.DrawStringInt( 37 canvas.DrawStringInt(
38 UTF16ToWide(text), font, 38 UTF16ToWide(text), font,
39 gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]), 39 gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]),
40 insets.left(), insets.top(), 40 insets.left(), insets.top(),
41 widget->allocation.width - insets.width(), font.height()); 41 widget->allocation.width - insets.width(), font.GetHeight());
42 } 42 }
43 } 43 }
44 44
45 return result; 45 return result;
46 } 46 }
47 47
48 static void gtk_views_entry_class_init(GtkViewsEntryClass* views_entry_class) { 48 static void gtk_views_entry_class_init(GtkViewsEntryClass* views_entry_class) {
49 GtkWidgetClass* widget_class = 49 GtkWidgetClass* widget_class =
50 reinterpret_cast<GtkWidgetClass*>(views_entry_class); 50 reinterpret_cast<GtkWidgetClass*>(views_entry_class);
51 widget_class->expose_event = gtk_views_entry_expose_event; 51 widget_class->expose_event = gtk_views_entry_expose_event;
52 } 52 }
53 53
54 static void gtk_views_entry_init(GtkViewsEntry* entry) { 54 static void gtk_views_entry_init(GtkViewsEntry* entry) {
55 entry->host = NULL; 55 entry->host = NULL;
56 } 56 }
57 57
58 GtkWidget* gtk_views_entry_new(views::NativeTextfieldGtk* host) { 58 GtkWidget* gtk_views_entry_new(views::NativeTextfieldGtk* host) {
59 gpointer entry = g_object_new(GTK_TYPE_VIEWS_ENTRY, NULL); 59 gpointer entry = g_object_new(GTK_TYPE_VIEWS_ENTRY, NULL);
60 GTK_VIEWS_ENTRY(entry)->host = host; 60 GTK_VIEWS_ENTRY(entry)->host = host;
61 return GTK_WIDGET(entry); 61 return GTK_WIDGET(entry);
62 } 62 }
63 63
64 G_END_DECLS 64 G_END_DECLS
OLDNEW
« no previous file with comments | « views/controls/table/table_view.cc ('k') | views/controls/textfield/gtk_views_textview.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698