| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <cairo.h> | 6 #include <cairo.h> |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <gmodule.h> | 8 #include <gmodule.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 } | 970 } |
| 971 | 971 |
| 972 if (state_type != GTK_STATE_NORMAL) { | 972 if (state_type != GTK_STATE_NORMAL) { |
| 973 // Because we have an thickness specified in the rc file non-selected tabs | 973 // Because we have an thickness specified in the rc file non-selected tabs |
| 974 // shift down. This forces all tabs to be rendered the same. | 974 // shift down. This forces all tabs to be rendered the same. |
| 975 y--; | 975 y--; |
| 976 h++; | 976 h++; |
| 977 } | 977 } |
| 978 | 978 |
| 979 cairo_translate(cr.get(), x, y); | 979 cairo_translate(cr.get(), x, y); |
| 980 cairo_set_line_width(cr.get(), 1); | |
| 981 cairo_set_source_rgb(cr.get(), TAB_PANE_BORDER_R, TAB_PANE_BORDER_G, | |
| 982 TAB_PANE_BORDER_B); | |
| 983 | 980 |
| 984 cairo_move_to(cr.get(), .5, h); | 981 cairo_move_to(cr.get(), .5, h); |
| 985 cairo_line_to(cr.get(), .5, BORDER_CORNER_RADIUS); | 982 cairo_line_to(cr.get(), .5, BORDER_CORNER_RADIUS); |
| 986 cairo_arc(cr.get(), BORDER_CORNER_RADIUS + .5, BORDER_CORNER_RADIUS + .5, | 983 cairo_arc(cr.get(), BORDER_CORNER_RADIUS + .5, BORDER_CORNER_RADIUS + .5, |
| 987 BORDER_CORNER_RADIUS, M_PI, M_PI * 3 / 2); | 984 BORDER_CORNER_RADIUS, M_PI, M_PI * 3 / 2); |
| 988 | 985 |
| 989 cairo_line_to(cr.get(), BORDER_CORNER_RADIUS, .5); | 986 cairo_line_to(cr.get(), BORDER_CORNER_RADIUS, .5); |
| 990 cairo_line_to(cr.get(), w - BORDER_CORNER_RADIUS, .5); | 987 cairo_line_to(cr.get(), w - BORDER_CORNER_RADIUS, .5); |
| 991 cairo_arc(cr.get(), w - BORDER_CORNER_RADIUS - .5, | 988 cairo_arc(cr.get(), w - BORDER_CORNER_RADIUS - .5, |
| 992 BORDER_CORNER_RADIUS + .5, BORDER_CORNER_RADIUS, -M_PI / 2, 0); | 989 BORDER_CORNER_RADIUS + .5, BORDER_CORNER_RADIUS, -M_PI / 2, 0); |
| 993 | 990 |
| 994 cairo_line_to(cr.get(), w - .5, BORDER_CORNER_RADIUS); | 991 cairo_line_to(cr.get(), w - .5, BORDER_CORNER_RADIUS); |
| 995 cairo_line_to(cr.get(), w - .5, h); | 992 cairo_line_to(cr.get(), w - .5, h); |
| 996 | 993 |
| 994 if (state_type != GTK_STATE_NORMAL) { |
| 995 // Gradient background for inactive tabs. |
| 996 cairo_path_t* save_path = cairo_copy_path(cr.get()); |
| 997 |
| 998 cairo_close_path(cr.get()); |
| 999 ScopedPattern pattern; |
| 1000 AddRoundRectGradient(cr.get(), &pattern, h, false); |
| 1001 cairo_fill(cr.get()); |
| 1002 |
| 1003 cairo_append_path(cr.get(), save_path); |
| 1004 cairo_path_destroy(save_path); |
| 1005 } |
| 1006 |
| 1007 cairo_set_line_width(cr.get(), 1); |
| 1008 cairo_set_source_rgb(cr.get(), TAB_PANE_BORDER_R, TAB_PANE_BORDER_G, |
| 1009 TAB_PANE_BORDER_B); |
| 997 cairo_stroke(cr.get()); | 1010 cairo_stroke(cr.get()); |
| 998 } | 1011 } |
| 999 | 1012 |
| 1000 static void DrawTabPaneBorder(GtkStyle* style, | 1013 static void DrawTabPaneBorder(GtkStyle* style, |
| 1001 GdkWindow* window, | 1014 GdkWindow* window, |
| 1002 GtkStateType state_type, | 1015 GtkStateType state_type, |
| 1003 GtkShadowType shadow_type, | 1016 GtkShadowType shadow_type, |
| 1004 GdkRectangle* area, | 1017 GdkRectangle* area, |
| 1005 GtkWidget* widget, | 1018 GtkWidget* widget, |
| 1006 gint x, | 1019 gint x, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 gint x, | 1206 gint x, |
| 1194 gint y, | 1207 gint y, |
| 1195 gint w, | 1208 gint w, |
| 1196 gint h) { | 1209 gint h) { |
| 1197 if (GTK_IS_ARROW(widget) && detail && !strcmp("arrow", detail)) { | 1210 if (GTK_IS_ARROW(widget) && detail && !strcmp("arrow", detail)) { |
| 1198 DrawComboboxArrow(style, window, state_type, shadow_type, area, widget, | 1211 DrawComboboxArrow(style, window, state_type, shadow_type, area, widget, |
| 1199 arrow_type, fill, x, y, w, h); | 1212 arrow_type, fill, x, y, w, h); |
| 1200 } else if (GTK_IS_RANGE(widget)) { | 1213 } else if (GTK_IS_RANGE(widget)) { |
| 1201 DrawScrollbarArrow(style, window, state_type, shadow_type, area, widget, | 1214 DrawScrollbarArrow(style, window, state_type, shadow_type, area, widget, |
| 1202 arrow_type, fill, x, y, w, h); | 1215 arrow_type, fill, x, y, w, h); |
| 1203 } else if (GTK_IS_MENU_ITEM(widget) && detail && | 1216 } else if ((GTK_IS_MENU_ITEM(widget) && detail && |
| 1204 !strcmp(detail, "menuitem")) { | 1217 !strcmp(detail, "menuitem")) || |
| 1218 (GTK_IS_MENU(widget) && detail && |
| 1219 (!strcmp(detail, "menu_scroll_arrow_up") || |
| 1220 !strcmp(detail, "menu_scroll_arrow_down")))) { |
| 1205 DrawMenuArrow(style, window, state_type, shadow_type, area, widget, | 1221 DrawMenuArrow(style, window, state_type, shadow_type, area, widget, |
| 1206 arrow_type, fill, x, y, w, h); | 1222 arrow_type, fill, x, y, w, h); |
| 1207 } | 1223 } |
| 1208 } | 1224 } |
| 1209 | 1225 |
| 1210 void ThemeDrawBox(GtkStyle* style, | 1226 void ThemeDrawBox(GtkStyle* style, |
| 1211 GdkWindow* window, | 1227 GdkWindow* window, |
| 1212 GtkStateType state_type, | 1228 GtkStateType state_type, |
| 1213 GtkShadowType shadow_type, | 1229 GtkShadowType shadow_type, |
| 1214 GdkRectangle* area, | 1230 GdkRectangle* area, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 GtkStateType state_type, | 1438 GtkStateType state_type, |
| 1423 GdkRectangle* area, | 1439 GdkRectangle* area, |
| 1424 GtkWidget* widget, | 1440 GtkWidget* widget, |
| 1425 const gchar* detail, | 1441 const gchar* detail, |
| 1426 gint y1, | 1442 gint y1, |
| 1427 gint y2, | 1443 gint y2, |
| 1428 gint x) { | 1444 gint x) { |
| 1429 // We currently don't have any vertical separators. If we do need them, be | 1445 // We currently don't have any vertical separators. If we do need them, be |
| 1430 // sure and special case so that we don't draw the separator for comboboxs: | 1446 // sure and special case so that we don't draw the separator for comboboxs: |
| 1431 } | 1447 } |
| OLD | NEW |