summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/custom_button.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 23:48:44 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 23:48:44 +0000
commitcd43e6e776b2283f555f1b59bef06d135504f66f (patch)
tree1d1a074deebfef562a534f79bd0128ed2aa48ba1 /chrome/browser/gtk/custom_button.cc
parent05d94e79f64a6562ea646e5b3f2e9c6e7b1cc011 (diff)
downloadchromium_src-cd43e6e776b2283f555f1b59bef06d135504f66f.zip
chromium_src-cd43e6e776b2283f555f1b59bef06d135504f66f.tar.gz
chromium_src-cd43e6e776b2283f555f1b59bef06d135504f66f.tar.bz2
Add a function to ResourceBundle to allow loading images that will mirror in RTL. Use this function for custom buttons and for the Off the Record avatar.
for reference, this will be a bit different than Views, which does it per class rather than per image: http://dev.chromium.org/developers/design-documents/ui-mirroring-infrastructure Review URL: http://codereview.chromium.org/147157 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/custom_button.cc')
-rw-r--r--chrome/browser/gtk/custom_button.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc
index bed3128..e047202 100644
--- a/chrome/browser/gtk/custom_button.cc
+++ b/chrome/browser/gtk/custom_button.cc
@@ -18,13 +18,15 @@ CustomDrawButtonBase::CustomDrawButtonBase(
: paint_override_(-1) {
// Load the button images from the resource bundle.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- pixbufs_[GTK_STATE_NORMAL] = normal_id ? rb.GetPixbufNamed(normal_id) : NULL;
- pixbufs_[GTK_STATE_ACTIVE] = active_id ? rb.GetPixbufNamed(active_id) : NULL;
+ pixbufs_[GTK_STATE_NORMAL] =
+ normal_id ? rb.GetRTLEnabledPixbufNamed(normal_id) : NULL;
+ pixbufs_[GTK_STATE_ACTIVE] =
+ active_id ? rb.GetRTLEnabledPixbufNamed(active_id) : NULL;
pixbufs_[GTK_STATE_PRELIGHT] =
- highlight_id ? rb.GetPixbufNamed(highlight_id) : NULL;
+ highlight_id ? rb.GetRTLEnabledPixbufNamed(highlight_id) : NULL;
pixbufs_[GTK_STATE_SELECTED] = NULL;
pixbufs_[GTK_STATE_INSENSITIVE] =
- depressed_id ? rb.GetPixbufNamed(depressed_id) : NULL;
+ depressed_id ? rb.GetRTLEnabledPixbufNamed(depressed_id) : NULL;
}
CustomDrawButtonBase::~CustomDrawButtonBase() {
@@ -43,12 +45,6 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget, GdkEventExpose* e) {
cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE(widget->window));
cairo_translate(cairo_context, widget->allocation.x, widget->allocation.y);
-
- if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) {
- cairo_translate(cairo_context, widget->allocation.width, 0.0f);
- cairo_scale(cairo_context, -1.0f, 1.0f);
- }
-
gdk_cairo_set_source_pixbuf(cairo_context, pixbuf, 0, 0);
cairo_paint(cairo_context);
cairo_destroy(cairo_context);