661
664
gtk_rc_parse_string (buf);
663
666
/* enable coloring for text on buttons
664
* TODO: use GetThemeMetric for the border and outside border
665
* TODO: child-displacement-x & y should be 0 when XP theme is active */
667
* TODO: use GetThemeMetric for the border and outside border */
666
668
g_snprintf (buf, sizeof (buf),
667
"style \"msw-button\" = \"msw-default\"\n"
669
"bg[NORMAL] = { %d, %d, %d }\n"
670
"bg[PRELIGHT] = { %d, %d, %d }\n"
671
"bg[INSENSITIVE] = { %d, %d, %d }\n"
672
"fg[PRELIGHT] = { %d, %d, %d }\n"
673
"GtkButton::default-border = { 0, 0, 0, 0 }\n"
674
"GtkButton::default-outside-border = { 0, 0, 0, 0 }\n"
675
"GtkButton::child-displacement-x = 1\n"
676
"GtkButton::child-displacement-y = 1\n"
677
"GtkButton::focus-padding = %d\n"
678
"}widget_class \"*Button*\" style \"msw-button\"\n",
679
btn_face.red, btn_face.green, btn_face.blue,
680
btn_face.red, btn_face.green, btn_face.blue,
681
btn_face.red, btn_face.green, btn_face.blue,
682
btn_fore.red, btn_fore.green, btn_fore.blue,
683
xp_theme_is_active ()? 1 : 2);
669
"style \"msw-button\" = \"msw-default\"\n"
671
"bg[NORMAL] = { %d, %d, %d }\n"
672
"bg[PRELIGHT] = { %d, %d, %d }\n"
673
"bg[INSENSITIVE] = { %d, %d, %d }\n"
674
"fg[PRELIGHT] = { %d, %d, %d }\n"
675
"GtkButton::default-border = { 0, 0, 0, 0 }\n"
676
"GtkButton::default-outside-border = { 0, 0, 0, 0 }\n"
677
"GtkButton::child-displacement-x = %d\n"
678
"GtkButton::child-displacement-y = %d\n"
679
"GtkWidget::focus-padding = %d\n"
680
"}widget_class \"*Button*\" style \"msw-button\"\n",
681
btn_face.red, btn_face.green, btn_face.blue,
682
btn_face.red, btn_face.green, btn_face.blue,
683
btn_face.red, btn_face.green, btn_face.blue,
684
btn_fore.red, btn_fore.green, btn_fore.blue,
685
xp_theme_is_active ()? 0 : 1,
686
xp_theme_is_active ()? 0 : 1,
687
xp_theme_is_active ()? 1 : 2);
684
688
gtk_rc_parse_string (buf);
686
690
/* enable coloring for progress bars */
940
/* This function is not needed anymore */
942
combo_box_draw_arrow (GtkStyle *style,
945
GdkRectangle *area, GtkWidget *widget)
947
if (xp_theme_is_active ())
950
if (widget && GTK_IS_TOGGLE_BUTTON (widget->parent))
957
dc = get_window_dc (style, window, state, &dc_info, area->x, area->y, area->width,
958
area->height, &rect);
959
border = (GTK_TOGGLE_BUTTON (widget->parent)->
960
active ? DFCS_PUSHED | DFCS_FLAT : 0);
962
InflateRect (&rect, 1, 1);
963
DrawFrameControl (dc, &rect, DFC_SCROLL, DFCS_SCROLLDOWN | border);
965
release_window_dc (&dc_info);
974
945
draw_part (GdkDrawable *drawable,
975
946
GdkColor *gc, GdkRectangle *area, gint x, gint y, Part part)
1035
1006
if (!xp_theme_draw (window, theme_elt,
1036
1007
style, x, y, width, height, state, area))
1038
if (detail && !strcmp (detail, "cellcheck"))
1009
if (DETAIL("cellcheck"))
1039
1010
state = GTK_STATE_NORMAL;
1041
1012
draw_part (window, &style->black, area, x, y, CHECK_BLACK);
1066
draw_expander (GtkStyle *style,
1071
const gchar *detail,
1072
gint x, gint y, GtkExpanderStyle expander_style)
1037
draw_expander (GtkStyle *style,
1042
const gchar *detail,
1045
GtkExpanderStyle expander_style)
1074
1047
cairo_t *cr = gdk_cairo_create (window);
1076
1049
gint expander_size;
1077
1050
gint expander_semi_size;
1078
1051
XpThemeElement xp_expander;
1052
GtkOrientation orientation;
1080
1054
gtk_widget_style_get (widget, "expander_size", &expander_size, NULL);
1056
if (DETAIL("tool-palette-header"))
1058
/* Expanders are usually drawn as little triangles and unfortunately
1059
* do not support rotated drawing modes. So a hack is applied (see
1060
* gtk_tool_item_group_header_expose_event_cb for details) when
1061
* drawing a GtkToolItemGroup's header for horizontal GtkToolShells,
1062
* forcing the triangle to point in the right direction. Except we
1063
* don't draw expanders as triangles on Windows. Usually, expanders
1064
* are represented as "+" and "-". It sucks for "+" to become "-" and
1065
* the inverse when we don't want to, so reverse the hack here. */
1067
orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (widget));
1069
if (orientation == GTK_ORIENTATION_HORIZONTAL)
1070
expander_style = GTK_EXPANDER_EXPANDED - expander_style;
1082
1073
switch (expander_style)
1084
1075
case GTK_EXPANDER_COLLAPSED:
1228
1223
y_increment = -1;
1231
for (i = extra; i < height; i++)
1233
_cairo_draw_line (cr, gc,
1234
x + (i - extra), y_start + i * y_increment,
1235
x + width - (i - extra) - 1, y_start + i * y_increment);
1226
gdk_cairo_set_source_color (cr, gc);
1227
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
1228
cairo_set_line_width (cr, 1.0);
1229
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
1231
cairo_move_to (cr, x + 0.5, y_start + extra * y_increment + 0.5);
1232
cairo_line_to (cr, x + width - 1 + 0.5, y_start + extra * y_increment + 0.5);
1233
cairo_line_to (cr, x + (height - 1 - extra) + 0.5, y_start + (height - 1) * y_increment + 0.5);
1234
cairo_close_path (cr);
1235
cairo_stroke_preserve (cr);
1238
1238
cairo_destroy(cr);
1273
1273
x_increment = -1;
1276
for (i = extra; i < width; i++)
1278
_cairo_draw_line (cr, gc,
1279
x_start + i * x_increment, y + (i - extra),
1280
x_start + i * x_increment, y + height - (i - extra) - 1);
1276
gdk_cairo_set_source_color (cr, gc);
1277
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
1278
cairo_set_line_width (cr, 1.0);
1279
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
1281
cairo_move_to (cr, x_start + extra * x_increment + 0.5, y + 0.5);
1282
cairo_line_to (cr, x_start + extra * x_increment + 0.5, y + height - 1 + 0.5);
1283
cairo_line_to (cr, x_start + (width - 1) * x_increment + 0.5, y + height - (width - 1 - extra) - 1 + 0.5);
1284
cairo_close_path (cr);
1285
cairo_stroke_preserve (cr);
1283
1288
cairo_destroy(cr);
1894
else if (detail && !strcmp (detail, "spinbutton"))
1897
else if (DETAIL("spinbutton"))
1896
1899
if (xp_theme_is_drawable (XP_THEME_ELEMENT_SPIN_BUTTON_UP))
1901
else if (detail && (!strcmp (detail, "spinbutton_up")
1902
|| !strcmp (detail, "spinbutton_down")))
1904
else if (DETAIL("spinbutton_up") || DETAIL("spinbutton_down"))
1904
1906
if (!xp_theme_draw (window,
1905
(!strcmp (detail, "spinbutton_up"))
1907
DETAIL("spinbutton_up")
1906
1908
? XP_THEME_ELEMENT_SPIN_BUTTON_UP
1907
1909
: XP_THEME_ELEMENT_SPIN_BUTTON_DOWN,
1908
1910
style, x, y, width, height, state_type, area))
1923
else if (detail && !strcmp (detail, "slider"))
1925
else if (DETAIL("slider"))
1925
1927
if (GTK_IS_SCROLLBAR (widget))
1927
1929
GtkScrollbar *scrollbar = GTK_SCROLLBAR (widget);
1928
gboolean is_v = GTK_IS_VSCROLLBAR (widget);
1930
GtkOrientation orientation;
1931
gboolean is_vertical;
1933
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
1935
if (orientation == GTK_ORIENTATION_VERTICAL)
1938
is_vertical = FALSE;
1930
1940
if (xp_theme_draw (window,
1932
1942
? XP_THEME_ELEMENT_SCROLLBAR_V
1933
1943
: XP_THEME_ELEMENT_SCROLLBAR_H,
1934
1944
style, x, y, width, height, state_type, area))
1936
1946
XpThemeElement gripper =
1937
(is_v ? XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_V :
1947
(is_vertical ? XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_V :
1938
1948
XP_THEME_ELEMENT_SCROLLBAR_GRIPPER_H);
1940
1950
/* Do not display grippers on tiny scroll bars,
2096
&& (strcmp (detail, "vscrollbar") == 0
2097
|| strcmp (detail, "hscrollbar") == 0))
2115
else if (DETAIL("vscrollbar") || DETAIL("hscrollbar"))
2102
&& (strcmp (detail, "handlebox_bin") == 0
2103
|| strcmp (detail, "toolbar") == 0
2104
|| strcmp (detail, "menubar") == 0))
2119
else if (DETAIL("handlebox_bin") || DETAIL("toolbar") || DETAIL("menubar"))
2106
2121
sanitize_size (window, &width, &height);
2107
2122
if (xp_theme_draw (window, XP_THEME_ELEMENT_REBAR,
2113
else if (detail && (!strcmp (detail, "handlebox"))) /* grip */
2128
else if (DETAIL("handlebox")) /* grip */
2115
2130
if (!xp_theme_is_active ())
2120
else if (detail && !strcmp (detail, "notebook") && GTK_IS_NOTEBOOK (widget))
2135
else if (DETAIL("notebook") && GTK_IS_NOTEBOOK (widget))
2122
2137
if (xp_theme_draw (window, XP_THEME_ELEMENT_TAB_PANE, style,
2123
2138
x, y, width, height, state_type, area))
2167
2182
parent_class->draw_box (style, window, state_type, shadow_type, area,
2168
2183
widget, detail, x, y, width, height);
2170
if (detail && strcmp (detail, "optionmenu") == 0)
2185
if (DETAIL("optionmenu"))
2172
2187
GtkRequisition indicator_size;
2173
2188
GtkBorder indicator_spacing;
2699
2714
gint x, gint y,
2700
2715
gint width, gint height, GtkPositionType gap_side)
2702
if (widget && GTK_IS_NOTEBOOK (widget) && detail && !strcmp (detail, "tab"))
2717
if (widget && GTK_IS_NOTEBOOK (widget) && DETAIL("tab"))
2704
2719
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
2706
2721
/* draw_themed_tab_button and draw_tab_button expect to work with tab
2707
* position, instead of simply taking the "side of the gap" (gap_side)
2708
* which simply said is the side of the tab that touches the notebook
2709
* frame and is always the exact opposite of the gap side... */
2722
* position, instead of simply taking the "side of the gap" (gap_side).
2723
* The gap side, simply said, is the side of the tab that touches the notebook
2724
* frame and is always the exact opposite of the tab position... */
2710
2725
int tab_pos = gtk_notebook_get_tab_pos (notebook);
2712
2727
if (!draw_themed_tab_button (style, window, state_type,
2947
if (detail && !strcmp (detail, "scrolled_window") &&
2962
if (DETAIL("scrolled_window") &&
2948
2963
xp_theme_draw (window, XP_THEME_ELEMENT_EDIT_TEXT, style,
2949
2964
x, y, width, height, state_type, area))
2954
if (detail && !strcmp (detail, "spinbutton"))
2969
if (DETAIL("spinbutton"))
2957
if (detail && !strcmp (detail, "menu"))
2959
2974
if (draw_menu_border (window, style, x, y, width, height))