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

Side by Side Diff: views/controls/textfield/gtk_views_textview.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
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_textview.h" 5 #include "views/controls/textfield/gtk_views_textview.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 gfx::CanvasSkiaPaint canvas(event); 46 gfx::CanvasSkiaPaint canvas(event);
47 if (!canvas.is_empty()) { 47 if (!canvas.is_empty()) {
48 gfx::Insets insets = 48 gfx::Insets insets =
49 views::NativeTextfieldGtk::GetTextViewInnerBorder(text_view); 49 views::NativeTextfieldGtk::GetTextViewInnerBorder(text_view);
50 gfx::Font font = host->textfield()->font(); 50 gfx::Font font = host->textfield()->font();
51 const string16 text = host->textfield()->text_to_display_when_empty(); 51 const string16 text = host->textfield()->text_to_display_when_empty();
52 canvas.DrawStringInt( 52 canvas.DrawStringInt(
53 UTF16ToWide(text), font, 53 UTF16ToWide(text), font,
54 gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]), 54 gfx::GdkColorToSkColor(widget->style->text[GTK_STATE_INSENSITIVE]),
55 insets.left(), insets.top(), 55 insets.left(), insets.top(),
56 widget->allocation.width - insets.width(), font.height()); 56 widget->allocation.width - insets.width(), font.GetHeight());
57 } 57 }
58 } 58 }
59 59
60 // Draw border and focus. 60 // Draw border and focus.
61 if (event->window == widget->window) { 61 if (event->window == widget->window) {
62 gint width; 62 gint width;
63 gint height; 63 gint height;
64 gdk_drawable_get_size (widget->window, &width, &height); 64 gdk_drawable_get_size (widget->window, &width, &height);
65 65
66 bool has_focus = GTK_WIDGET_HAS_FOCUS(widget); 66 bool has_focus = GTK_WIDGET_HAS_FOCUS(widget);
(...skipping 25 matching lines...) Expand all
92 text_view->host = NULL; 92 text_view->host = NULL;
93 } 93 }
94 94
95 GtkWidget* gtk_views_textview_new(views::NativeTextfieldGtk* host) { 95 GtkWidget* gtk_views_textview_new(views::NativeTextfieldGtk* host) {
96 gpointer text_view = g_object_new(GTK_TYPE_VIEWS_TEXTVIEW, NULL); 96 gpointer text_view = g_object_new(GTK_TYPE_VIEWS_TEXTVIEW, NULL);
97 GTK_VIEWS_TEXTVIEW(text_view)->host = host; 97 GTK_VIEWS_TEXTVIEW(text_view)->host = host;
98 return GTK_WIDGET(text_view); 98 return GTK_WIDGET(text_view);
99 } 99 }
100 100
101 G_END_DECLS 101 G_END_DECLS
OLDNEW
« no previous file with comments | « views/controls/textfield/gtk_views_entry.cc ('k') | views/controls/textfield/native_textfield_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698