| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h" | 5 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h" | 9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h" |
| 10 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 10 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 fake_menu_.Own(gtk_custom_menu_new()); | 488 fake_menu_.Own(gtk_custom_menu_new()); |
| 489 | 489 |
| 490 fake_menu_item_ = gtk_custom_menu_item_new(); | 490 fake_menu_item_ = gtk_custom_menu_item_new(); |
| 491 gtk_menu_shell_append(GTK_MENU_SHELL(fake_menu_.get()), fake_menu_item_); | 491 gtk_menu_shell_append(GTK_MENU_SHELL(fake_menu_.get()), fake_menu_item_); |
| 492 } | 492 } |
| 493 | 493 |
| 494 return gtk_rc_get_style(fake_menu_item_); | 494 return gtk_rc_get_style(fake_menu_item_); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void NativeThemeGtk2::PaintComboboxArrow(SkCanvas* canvas, | 497 void NativeThemeGtk2::PaintComboboxArrow(SkCanvas* canvas, |
| 498 GtkStateType state, | 498 GtkStateFlags state, |
| 499 const gfx::Rect& rect) const { | 499 const gfx::Rect& rect) const { |
| 500 GdkPixmap* pm = gdk_pixmap_new(gtk_widget_get_window(GetRealizedWindow()), | 500 SkBitmap arrow; |
| 501 rect.width(), | 501 arrow.allocN32Pixels(rect.width(), rect.height()); |
| 502 rect.height(), | 502 arrow.eraseColor(0); |
| 503 -1); | 503 |
| 504 // Paint the background. | |
| 505 gtk_paint_flat_box(GetWindowStyle(), | |
| 506 pm, | |
| 507 state, | |
| 508 GTK_SHADOW_NONE, | |
| 509 NULL, | |
| 510 GetRealizedWindow(), | |
| 511 NULL, 0, 0, rect.width(), rect.height()); | |
| 512 gtk_paint_arrow(GetWindowStyle(), | |
| 513 pm, | |
| 514 state, | |
| 515 GTK_SHADOW_NONE, | |
| 516 NULL, | |
| 517 GetRealizedWindow(), | |
| 518 NULL, | |
| 519 GTK_ARROW_DOWN, | |
| 520 true, | |
| 521 0, 0, rect.width(), rect.height()); | |
| 522 GdkPixbuf* pb = gdk_pixbuf_get_from_drawable(NULL, | |
| 523 pm, | |
| 524 gdk_drawable_get_colormap(pm), | |
| 525 0, 0, | |
| 526 0, 0, | |
| 527 rect.width(), rect.height()); | |
| 528 SkBitmap arrow = GdkPixbufToImageSkia(pb); | |
| 529 canvas->drawBitmap(arrow, rect.x(), rect.y()); | 504 canvas->drawBitmap(arrow, rect.x(), rect.y()); |
| 530 | |
| 531 g_object_unref(pb); | |
| 532 g_object_unref(pm); | |
| 533 } | 505 } |
| 534 | 506 |
| 535 } // namespace libgtk2ui | 507 } // namespace libgtk2ui |
| OLD | NEW |