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

Side by Side Diff: chrome/browser/ui/gtk/gtk_theme_service.cc

Issue 9359052: GTK: Closing in on being completely GSEALed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_util.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gtk/gtk_theme_service.h" 5 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 GtkWidget* scrollbar = gtk_hscrollbar_new(NULL); 491 GtkWidget* scrollbar = gtk_hscrollbar_new(NULL);
492 gtk_container_add(GTK_CONTAINER(window), fixed); 492 gtk_container_add(GTK_CONTAINER(window), fixed);
493 gtk_container_add(GTK_CONTAINER(fixed), scrollbar); 493 gtk_container_add(GTK_CONTAINER(fixed), scrollbar);
494 gtk_widget_realize(window); 494 gtk_widget_realize(window);
495 gtk_widget_realize(scrollbar); 495 gtk_widget_realize(scrollbar);
496 496
497 // Draw scrollbar thumb part and track into offscreen image 497 // Draw scrollbar thumb part and track into offscreen image
498 const int kWidth = 100; 498 const int kWidth = 100;
499 const int kHeight = 20; 499 const int kHeight = 20;
500 GtkStyle* style = gtk_rc_get_style(scrollbar); 500 GtkStyle* style = gtk_rc_get_style(scrollbar);
501 GdkPixmap* pm = gdk_pixmap_new(window->window, kWidth, kHeight, -1); 501 GdkWindow* gdk_window = gtk_widget_get_window(window);
502 GdkPixmap* pm = gdk_pixmap_new(gdk_window, kWidth, kHeight, -1);
502 GdkRectangle rect = { 0, 0, kWidth, kHeight }; 503 GdkRectangle rect = { 0, 0, kWidth, kHeight };
503 unsigned char data[3 * kWidth * kHeight]; 504 unsigned char data[3 * kWidth * kHeight];
504 for (int i = 0; i < 3; ++i) { 505 for (int i = 0; i < 3; ++i) {
505 if (i < 2) { 506 if (i < 2) {
506 // Thumb part 507 // Thumb part
507 gtk_paint_slider(style, pm, 508 gtk_paint_slider(style, pm,
508 i == 0 ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, 509 i == 0 ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
509 GTK_SHADOW_OUT, &rect, scrollbar, "slider", 0, 0, 510 GTK_SHADOW_OUT, &rect, scrollbar, "slider", 0, 0,
510 kWidth, kHeight, GTK_ORIENTATION_HORIZONTAL); 511 kWidth, kHeight, GTK_ORIENTATION_HORIZONTAL);
511 } else { 512 } else {
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 if (it != labels_.end()) 1092 if (it != labels_.end())
1092 labels_.erase(it); 1093 labels_.erase(it);
1093 } 1094 }
1094 1095
1095 gboolean GtkThemeService::OnSeparatorExpose(GtkWidget* widget, 1096 gboolean GtkThemeService::OnSeparatorExpose(GtkWidget* widget,
1096 GdkEventExpose* event) { 1097 GdkEventExpose* event) {
1097 UNSHIPPED_TRACE_EVENT0("ui::gtk", "GtkThemeService::OnSeparatorExpose"); 1098 UNSHIPPED_TRACE_EVENT0("ui::gtk", "GtkThemeService::OnSeparatorExpose");
1098 if (UsingNativeTheme()) 1099 if (UsingNativeTheme())
1099 return FALSE; 1100 return FALSE;
1100 1101
1101 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); 1102 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
1102 gdk_cairo_rectangle(cr, &event->area); 1103 gdk_cairo_rectangle(cr, &event->area);
1103 cairo_clip(cr); 1104 cairo_clip(cr);
1104 1105
1105 GdkColor bottom_color = GetGdkColor(ThemeService::COLOR_TOOLBAR); 1106 GdkColor bottom_color = GetGdkColor(ThemeService::COLOR_TOOLBAR);
1106 double bottom_color_rgb[] = { 1107 double bottom_color_rgb[] = {
1107 static_cast<double>(bottom_color.red / 257) / 255.0, 1108 static_cast<double>(bottom_color.red / 257) / 255.0,
1108 static_cast<double>(bottom_color.green / 257) / 255.0, 1109 static_cast<double>(bottom_color.green / 257) / 255.0,
1109 static_cast<double>(bottom_color.blue / 257) / 255.0, }; 1110 static_cast<double>(bottom_color.blue / 257) / 255.0, };
1110 1111
1111 GtkAllocation allocation; 1112 GtkAllocation allocation;
(...skipping 18 matching lines...) Expand all
1130 cairo_new_path(cr); 1131 cairo_new_path(cr);
1131 cairo_set_line_width(cr, 1.0); 1132 cairo_set_line_width(cr, 1.0);
1132 cairo_move_to(cr, start_x, allocation.y); 1133 cairo_move_to(cr, start_x, allocation.y);
1133 cairo_line_to(cr, start_x, allocation.y + allocation.height); 1134 cairo_line_to(cr, start_x, allocation.y + allocation.height);
1134 cairo_stroke(cr); 1135 cairo_stroke(cr);
1135 cairo_destroy(cr); 1136 cairo_destroy(cr);
1136 cairo_pattern_destroy(pattern); 1137 cairo_pattern_destroy(pattern);
1137 1138
1138 return TRUE; 1139 return TRUE;
1139 } 1140 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698