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

Side by Side Diff: src/platform/theme/theme_draw.cc

Issue 2089018: Menu theme tuning. (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: Created 10 years, 7 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
« no previous file with comments | « src/platform/theme/resources/gtkrc ('k') | no next file » | 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) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 static_cast<double>(0x0) / 255.0; 102 static_cast<double>(0x0) / 255.0;
103 static const double INDICATOR_STROKE_PRESSED_G = 103 static const double INDICATOR_STROKE_PRESSED_G =
104 static_cast<double>(0x0) / 255.0; 104 static_cast<double>(0x0) / 255.0;
105 static const double INDICATOR_STROKE_PRESSED_B = 105 static const double INDICATOR_STROKE_PRESSED_B =
106 static_cast<double>(0x0) / 255.0; 106 static_cast<double>(0x0) / 255.0;
107 107
108 static const double INDICATOR_STROKE_R = 0; 108 static const double INDICATOR_STROKE_R = 0;
109 static const double INDICATOR_STROKE_G = 0; 109 static const double INDICATOR_STROKE_G = 0;
110 static const double INDICATOR_STROKE_B = 0; 110 static const double INDICATOR_STROKE_B = 0;
111 111
112 static const double MENU_BG_R = 1;
113 static const double MENU_BG_G = 1;
114 static const double MENU_BG_B = 1;
115
112 static const double MENU_BG_HIGHLIGHT_R = SELECTED_TEXT_BG_R; 116 static const double MENU_BG_HIGHLIGHT_R = SELECTED_TEXT_BG_R;
113 static const double MENU_BG_HIGHLIGHT_G = SELECTED_TEXT_BG_G; 117 static const double MENU_BG_HIGHLIGHT_G = SELECTED_TEXT_BG_G;
114 static const double MENU_BG_HIGHLIGHT_B = SELECTED_TEXT_BG_B; 118 static const double MENU_BG_HIGHLIGHT_B = SELECTED_TEXT_BG_B;
115 119
116 static const double MENU_BORDER_R = static_cast<double>(0x55) / 255.0; 120 static const double MENU_GRADIENT_R0 = 1;
117 static const double MENU_BORDER_G = static_cast<double>(0x55) / 255.0; 121 static const double MENU_GRADIENT_G0 = 1;
118 static const double MENU_BORDER_B = static_cast<double>(0x55) / 255.0; 122 static const double MENU_GRADIENT_B0 = 1;
123 static const double MENU_GRADIENT_R1 = static_cast<double>(0xF0) / 255.0;
124 static const double MENU_GRADIENT_G1 = static_cast<double>(0xF0) / 255.0;
125 static const double MENU_GRADIENT_B1 = static_cast<double>(0xF0) / 255.0;
119 126
120 // Ideal arrow size for menus. 127 // Ideal arrow size for menus.
121 static const int MENU_IDEAL_ARROW_SIZE = 5; 128 static const int MENU_IDEAL_ARROW_SIZE = 5;
122 129
123 // Ideal size of the inner circle for selected radio buttons. 130 // Ideal size of the inner circle for selected radio buttons.
124 static const int MENU_RADIO_BUTTON_INDICATOR_IDEAL_SIZE = 5; 131 static const int MENU_RADIO_BUTTON_INDICATOR_IDEAL_SIZE = 5;
125 132
126 // Ideal size of the inner circle for selected radio buttons. 133 // Ideal size of the inner circle for selected radio buttons.
127 static const int RADIO_BUTTON_INDICATOR_IDEAL_SIZE = 7; 134 static const int RADIO_BUTTON_INDICATOR_IDEAL_SIZE = 7;
128 135
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 static const double TOOLTIP_SHADOW_G = 0; 243 static const double TOOLTIP_SHADOW_G = 0;
237 static const double TOOLTIP_SHADOW_B = 0; 244 static const double TOOLTIP_SHADOW_B = 0;
238 245
239 // Alpha for shadow pixels, from outer-most to inner-most. 246 // Alpha for shadow pixels, from outer-most to inner-most.
240 static const double TOOLTIP_SHADOW_ALPHAS[] = { 0.1, 0.2 }; 247 static const double TOOLTIP_SHADOW_ALPHAS[] = { 0.1, 0.2 };
241 248
242 // Outermost shadow corner radius is 10 pixel tooltip border corner radius 249 // Outermost shadow corner radius is 10 pixel tooltip border corner radius
243 // plus TOOLTIP_SHADOW_DEPTH. 250 // plus TOOLTIP_SHADOW_DEPTH.
244 static const int TOOLTIP_CORNER_RADIUS = 10 + TOOLTIP_SHADOW_DEPTH; 251 static const int TOOLTIP_CORNER_RADIUS = 10 + TOOLTIP_SHADOW_DEPTH;
245 252
253 // Widget name of GtkCombBox popup menu.
254 static const char* kGtkComboBoxPopupMenu = "gtk-combobox-popup-menu";
255
246 // Widget name of ChromeOS options tab. 256 // Widget name of ChromeOS options tab.
247 static const char* kChromeOsOptionsTabName = "chromeos-options-tab"; 257 static const char* kChromeOsOptionsTabName = "chromeos-options-tab";
248 258
249 // Check whether given widget's name is the same as name_to_check. 259 // Check whether given widget's name is the same as name_to_check.
250 static bool WidgetHasName(GtkWidget* widget, const char* name_to_check) { 260 static bool WidgetHasName(GtkWidget* widget, const char* name_to_check) {
251 const char* widget_name = gtk_widget_get_name(widget); 261 const char* widget_name = gtk_widget_get_name(widget);
252 return widget_name && !strcmp(widget_name, name_to_check); 262 return widget_name && !strcmp(widget_name, name_to_check);
253 } 263 }
254 264
255 // Check whether given widget uses RGBA visuals. 265 // Check whether given widget uses RGBA visuals.
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 GtkWidget* widget, 750 GtkWidget* widget,
741 gint x, 751 gint x,
742 gint y, 752 gint y,
743 gint w, 753 gint w,
744 gint h) { 754 gint h) {
745 ScopedSurface cr(window, area); 755 ScopedSurface cr(window, area);
746 756
747 cairo_rectangle(cr.get(), x, y, w, h); 757 cairo_rectangle(cr.get(), x, y, w, h);
748 758
749 ScopedPattern pattern; 759 ScopedPattern pattern;
750 AddRoundRectGradient(cr.get(), &pattern, h, false); 760 if (WidgetHasName(widget, kGtkComboBoxPopupMenu)) {
751 cairo_fill_preserve(cr.get()); 761 cairo_set_source_rgb(cr.get(), MENU_BG_R, MENU_BG_G, MENU_BG_B);
752 762 } else {
753 cairo_set_source_rgb(cr.get(), MENU_BORDER_R, MENU_BORDER_G, MENU_BORDER_B); 763 pattern.reset(cairo_pattern_create_linear(0, 0, 0, h));
754 DrawSinglePixelWideRectangle(cr.get(), x, y, w, h); 764 cairo_pattern_add_color_stop_rgb(pattern.get(), 0, MENU_GRADIENT_R0,
765 MENU_GRADIENT_G0, MENU_GRADIENT_B0);
766 cairo_pattern_add_color_stop_rgb(pattern.get(), 1, MENU_GRADIENT_R1,
767 MENU_GRADIENT_G1, MENU_GRADIENT_B1);
768 cairo_set_source(cr.get(), pattern.get());
769 }
770 cairo_fill(cr.get());
755 } 771 }
756 772
757 static void DrawMenuHorizontalSeparator(GtkStyle* style, 773 static void DrawMenuHorizontalSeparator(GtkStyle* style,
758 GdkWindow* window, 774 GdkWindow* window,
759 GtkStateType state_type, 775 GtkStateType state_type,
760 GdkRectangle* area, 776 GdkRectangle* area,
761 GtkWidget* widget, 777 GtkWidget* widget,
762 gint x1, 778 gint x1,
763 gint x2, 779 gint x2,
764 gint y) { 780 gint y) {
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 GtkStateType state_type, 1526 GtkStateType state_type,
1511 GdkRectangle* area, 1527 GdkRectangle* area,
1512 GtkWidget* widget, 1528 GtkWidget* widget,
1513 const gchar* detail, 1529 const gchar* detail,
1514 gint y1, 1530 gint y1,
1515 gint y2, 1531 gint y2,
1516 gint x) { 1532 gint x) {
1517 // We currently don't have any vertical separators. If we do need them, be 1533 // We currently don't have any vertical separators. If we do need them, be
1518 // sure and special case so that we don't draw the separator for comboboxs: 1534 // sure and special case so that we don't draw the separator for comboboxs:
1519 } 1535 }
OLDNEW
« no previous file with comments | « src/platform/theme/resources/gtkrc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698