~ubuntu-branches/ubuntu/raring/gtk+2.0/raring-proposed

« back to all changes in this revision

Viewing changes to modules/engines/ms-windows/msw_style.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-02-06 22:03:26 UTC
  • mfrom: (1.14.12)
  • Revision ID: package-import@ubuntu.com-20120206220326-10d7cnkpdpbi9iox
Tags: 2.24.10-0ubuntu1
* New upstream version, dropped patches included in the new version
* debian/patches/090_logging_file_saves.patch:
  - improve the logging of saved filed, thanks Siegfried Gevatter 
    (lp: #920961)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#endif
52
52
 
53
53
 
 
54
#define DETAIL(xx)   ((detail) && (!strcmp(xx, detail)))
 
55
 
 
56
 
54
57
/* Default values, not normally used
55
58
 */
56
59
static const GtkRequisition default_option_indicator_size = { 9, 8 };
661
664
  gtk_rc_parse_string (buf);
662
665
 
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"
668
 
              "{\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"
 
670
              "{\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);
685
689
 
686
690
  /* enable coloring for progress bars */
937
941
  return FALSE;
938
942
}
939
943
 
940
 
/* This function is not needed anymore */
941
 
/* static gboolean
942
 
combo_box_draw_arrow (GtkStyle *style,
943
 
                      GdkWindow *window,
944
 
                      GtkStateType state,
945
 
                      GdkRectangle *area, GtkWidget *widget)
946
 
{
947
 
  if (xp_theme_is_active ())
948
 
    return TRUE;
949
 
 
950
 
  if (widget && GTK_IS_TOGGLE_BUTTON (widget->parent))
951
 
    {
952
 
      DWORD border;
953
 
      RECT rect;
954
 
      HDC dc;
955
 
      XpDCInfo dc_info;
956
 
 
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);
961
 
 
962
 
      InflateRect (&rect, 1, 1);
963
 
      DrawFrameControl (dc, &rect, DFC_SCROLL, DFCS_SCROLLDOWN | border);
964
 
 
965
 
      release_window_dc (&dc_info);
966
 
 
967
 
      return TRUE;
968
 
    }
969
 
 
970
 
  return FALSE;
971
 
}*/
972
 
 
973
944
static void
974
945
draw_part (GdkDrawable *drawable,
975
946
           GdkColor *gc, GdkRectangle *area, gint x, gint y, Part part)
1007
978
  x -= (1 + PART_SIZE - width) / 2;
1008
979
  y -= (1 + PART_SIZE - height) / 2;
1009
980
 
1010
 
  if (detail && strcmp (detail, "check") == 0)  /* Menu item */
 
981
  if (DETAIL("check"))  /* Menu item */
1011
982
    {
1012
983
      if (shadow == GTK_SHADOW_IN)
1013
984
        {
1035
1006
      if (!xp_theme_draw (window, theme_elt,
1036
1007
                          style, x, y, width, height, state, area))
1037
1008
        {
1038
 
          if (detail && !strcmp (detail, "cellcheck"))
 
1009
          if (DETAIL("cellcheck"))
1039
1010
            state = GTK_STATE_NORMAL;
1040
1011
 
1041
1012
          draw_part (window, &style->black, area, x, y, CHECK_BLACK);
1063
1034
}
1064
1035
 
1065
1036
static void
1066
 
draw_expander (GtkStyle *style,
1067
 
               GdkWindow *window,
1068
 
               GtkStateType state,
1069
 
               GdkRectangle *area,
1070
 
               GtkWidget *widget,
1071
 
               const gchar *detail,
1072
 
               gint x, gint y, GtkExpanderStyle expander_style)
 
1037
draw_expander (GtkStyle        *style,
 
1038
               GdkWindow       *window,
 
1039
               GtkStateType     state,
 
1040
               GdkRectangle    *area,
 
1041
               GtkWidget       *widget,
 
1042
               const gchar     *detail,
 
1043
               gint             x,
 
1044
               gint             y,
 
1045
               GtkExpanderStyle expander_style)
1073
1046
{
1074
1047
  cairo_t *cr = gdk_cairo_create (window);
1075
1048
 
1076
1049
  gint expander_size;
1077
1050
  gint expander_semi_size;
1078
1051
  XpThemeElement xp_expander;
 
1052
  GtkOrientation orientation;
1079
1053
 
1080
1054
  gtk_widget_style_get (widget, "expander_size", &expander_size, NULL);
1081
1055
 
 
1056
  if (DETAIL("tool-palette-header"))
 
1057
    {
 
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. */
 
1066
 
 
1067
      orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (widget));
 
1068
 
 
1069
      if (orientation == GTK_ORIENTATION_HORIZONTAL)
 
1070
          expander_style = GTK_EXPANDER_EXPANDED - expander_style;
 
1071
    }
 
1072
 
1082
1073
  switch (expander_style)
1083
1074
    {
1084
1075
    case GTK_EXPANDER_COLLAPSED:
1086
1077
      xp_expander = XP_THEME_ELEMENT_TREEVIEW_EXPANDER_CLOSED;
1087
1078
      break;
1088
1079
 
1089
 
    default:
 
1080
    case GTK_EXPANDER_EXPANDED:
 
1081
    case GTK_EXPANDER_SEMI_EXPANDED:
1090
1082
      xp_expander = XP_THEME_ELEMENT_TREEVIEW_EXPANDER_OPENED;
1091
1083
      break;
 
1084
 
 
1085
    default:
 
1086
      g_assert_not_reached ();
1092
1087
    }
1093
1088
 
1094
1089
  if ((expander_size % 2) == 0)
1161
1156
  x -= (1 + PART_SIZE - width) / 2;
1162
1157
  y -= (1 + PART_SIZE - height) / 2;
1163
1158
 
1164
 
  if (detail && strcmp (detail, "option") == 0) /* Menu item */
 
1159
  if (DETAIL("option")) /* Menu item */
1165
1160
    {
1166
1161
      if (shadow == GTK_SHADOW_IN)
1167
1162
        {
1178
1173
        }
1179
1174
      else
1180
1175
        {
1181
 
          if (detail && !strcmp (detail, "cellradio"))
 
1176
          if (DETAIL("cellradio"))
1182
1177
            state = GTK_STATE_NORMAL;
1183
1178
 
1184
1179
          draw_part (window, &style->black, area, x, y, RADIO_BLACK);
1228
1223
      y_increment = -1;
1229
1224
    }
1230
1225
 
1231
 
  for (i = extra; i < height; i++)
1232
 
    {
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);
1236
 
    }
 
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);
 
1230
 
 
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);
 
1236
  cairo_fill (cr);
1237
1237
 
1238
1238
  cairo_destroy(cr);
1239
1239
}
1273
1273
      x_increment = -1;
1274
1274
    }
1275
1275
 
1276
 
  for (i = extra; i < width; i++)
1277
 
    {
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);
1281
 
    }
 
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);
 
1280
 
 
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);
 
1286
  cairo_fill (cr);
1282
1287
 
1283
1288
  cairo_destroy(cr);
1284
1289
}
1373
1378
  if (GTK_IS_ARROW (widget) && is_combo_box_child (widget) && xp_theme_is_active ())
1374
1379
    return;
1375
1380
 
1376
 
  if (detail && strcmp (detail, "spinbutton") == 0)
 
1381
  if (DETAIL("spinbutton"))
1377
1382
    {
1378
1383
      if (xp_theme_is_drawable (XP_THEME_ELEMENT_SPIN_BUTTON_UP))
1379
1384
        {
1397
1402
 
1398
1403
      return;
1399
1404
    }
1400
 
  else if (detail && (!strcmp (detail, "vscrollbar")
1401
 
                      || !strcmp (detail, "hscrollbar")))
 
1405
  else if (DETAIL("vscrollbar") || DETAIL("hscrollbar"))
1402
1406
    {
1403
1407
      gboolean is_disabled = FALSE;
1404
1408
      UINT btn_type = 0;
1806
1810
          GtkWidget *widget,
1807
1811
          const gchar *detail, gint x, gint y, gint width, gint height)
1808
1812
{
1809
 
  if (is_combo_box_child (widget) && detail && !strcmp (detail, "button"))
 
1813
  if (is_combo_box_child (widget) && DETAIL("button"))
1810
1814
    {
1811
1815
      RECT rect;
1812
1816
      XpDCInfo dc_info;
1836
1840
        }
1837
1841
    }
1838
1842
 
1839
 
  if (detail &&
1840
 
      (!strcmp (detail, "button") || !strcmp (detail, "buttondefault")))
 
1843
  if (DETAIL("button") || DETAIL("buttondefault"))
1841
1844
    {
1842
1845
      if (GTK_IS_TREE_VIEW (widget->parent) || GTK_IS_CLIST (widget->parent))
1843
1846
      {
1891
1894
 
1892
1895
      return;
1893
1896
    }
1894
 
  else if (detail && !strcmp (detail, "spinbutton"))
 
1897
  else if (DETAIL("spinbutton"))
1895
1898
    {
1896
1899
      if (xp_theme_is_drawable (XP_THEME_ELEMENT_SPIN_BUTTON_UP))
1897
1900
        {
1898
1901
          return;
1899
1902
        }
1900
1903
    }
1901
 
  else if (detail && (!strcmp (detail, "spinbutton_up")
1902
 
                      || !strcmp (detail, "spinbutton_down")))
 
1904
  else if (DETAIL("spinbutton_up") || DETAIL("spinbutton_down"))
1903
1905
    {
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))
1920
1922
        }
1921
1923
      return;
1922
1924
    }
1923
 
  else if (detail && !strcmp (detail, "slider"))
 
1925
  else if (DETAIL("slider"))
1924
1926
    {
1925
1927
      if (GTK_IS_SCROLLBAR (widget))
1926
1928
        {
1927
1929
          GtkScrollbar *scrollbar = GTK_SCROLLBAR (widget);
1928
 
          gboolean is_v = GTK_IS_VSCROLLBAR (widget);
 
1930
          GtkOrientation orientation;
 
1931
          gboolean is_vertical;
 
1932
 
 
1933
          orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
 
1934
 
 
1935
          if (orientation == GTK_ORIENTATION_VERTICAL)
 
1936
            is_vertical = TRUE;
 
1937
          else
 
1938
            is_vertical = FALSE;
1929
1939
 
1930
1940
          if (xp_theme_draw (window,
1931
 
                             is_v
 
1941
                             is_vertical
1932
1942
                             ? XP_THEME_ELEMENT_SCROLLBAR_V
1933
1943
                             : XP_THEME_ELEMENT_SCROLLBAR_H,
1934
1944
                             style, x, y, width, height, state_type, area))
1935
1945
            {
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);
1939
1949
 
1940
1950
              /* Do not display grippers on tiny scroll bars,
1965
1975
            }
1966
1976
        }
1967
1977
    }
1968
 
  else if (detail && !strcmp (detail, "bar"))
 
1978
  else if (DETAIL("bar"))
1969
1979
    {
1970
1980
      if (widget && GTK_IS_PROGRESS_BAR (widget))
1971
1981
        {
1982
1992
          shadow_type = GTK_SHADOW_NONE;
1983
1993
        }
1984
1994
    }
1985
 
  else if (detail && strcmp (detail, "menuitem") == 0)
 
1995
  else if (DETAIL("menuitem"))
1986
1996
    {
1987
1997
      shadow_type = GTK_SHADOW_NONE;
1988
1998
      if (draw_menu_item (window, widget, style,
1991
2001
          return;
1992
2002
        }
1993
2003
    }
1994
 
  else if (detail && !strcmp (detail, "trough"))
 
2004
  else if (DETAIL("trough"))
1995
2005
    {
1996
2006
      if (widget && GTK_IS_PROGRESS_BAR (widget))
1997
2007
        {
2011
2021
        }
2012
2022
      else if (widget && GTK_IS_SCROLLBAR (widget))
2013
2023
        {
2014
 
          gboolean is_vertical = GTK_IS_VSCROLLBAR (widget);
 
2024
          GtkOrientation orientation;
 
2025
          gboolean is_vertical;
 
2026
 
 
2027
          orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
 
2028
 
 
2029
          if (orientation == GTK_ORIENTATION_VERTICAL)
 
2030
            is_vertical = TRUE;
 
2031
          else
 
2032
            is_vertical = FALSE;
2015
2033
 
2016
2034
          if (xp_theme_draw (window,
2017
2035
                             is_vertical
2041
2059
        }
2042
2060
      else if (widget && GTK_IS_SCALE (widget))
2043
2061
        {
2044
 
          gboolean is_vertical = GTK_IS_VSCALE (widget);
 
2062
          GtkOrientation orientation;
 
2063
 
 
2064
          orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
2045
2065
 
2046
2066
          if (!xp_theme_is_active ())
2047
2067
            {
2050
2070
                                      widget, detail, x, y, width, height);
2051
2071
            }
2052
2072
 
2053
 
          if (is_vertical)
 
2073
          if (orientation == GTK_ORIENTATION_VERTICAL)
2054
2074
            {
2055
2075
              if (xp_theme_draw
2056
2076
                  (window, XP_THEME_ELEMENT_SCALE_TROUGH_V,
2084
2104
          return;
2085
2105
        }
2086
2106
    }
2087
 
  else if (detail && strcmp (detail, "optionmenu") == 0)
 
2107
  else if (DETAIL("optionmenu"))
2088
2108
    {
2089
2109
      if (xp_theme_draw (window, XP_THEME_ELEMENT_EDIT_TEXT,
2090
2110
                         style, x, y, width, height, state_type, area))
2092
2112
          return;
2093
2113
        }
2094
2114
    }
2095
 
  else if (detail
2096
 
           && (strcmp (detail, "vscrollbar") == 0
2097
 
               || strcmp (detail, "hscrollbar") == 0))
 
2115
  else if (DETAIL("vscrollbar") || DETAIL("hscrollbar"))
2098
2116
    {
2099
2117
      return;
2100
2118
    }
2101
 
  else if (detail
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"))
2105
2120
    {
2106
2121
      sanitize_size (window, &width, &height);
2107
2122
      if (xp_theme_draw (window, XP_THEME_ELEMENT_REBAR,
2110
2125
          return;
2111
2126
        }
2112
2127
    }
2113
 
  else if (detail && (!strcmp (detail, "handlebox")))   /* grip */
 
2128
  else if (DETAIL("handlebox")) /* grip */
2114
2129
    {
2115
2130
      if (!xp_theme_is_active ())
2116
2131
        {
2117
2132
          return;
2118
2133
        }
2119
2134
    }
2120
 
  else if (detail && !strcmp (detail, "notebook") && GTK_IS_NOTEBOOK (widget))
 
2135
  else if (DETAIL("notebook") && GTK_IS_NOTEBOOK (widget))
2121
2136
    {
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);
2169
2184
 
2170
 
  if (detail && strcmp (detail, "optionmenu") == 0)
 
2185
  if (DETAIL("optionmenu"))
2171
2186
    {
2172
2187
      GtkRequisition indicator_size;
2173
2188
      GtkBorder indicator_spacing;
2214
2229
  g_return_if_fail (style != NULL);
2215
2230
  g_return_if_fail (window != NULL);
2216
2231
 
2217
 
  if (detail && !strcmp (detail, "optionmenutab"))
 
2232
  if (DETAIL("optionmenutab"))
2218
2233
    {
2219
2234
      if (xp_theme_draw (window, XP_THEME_ELEMENT_COMBOBUTTON,
2220
2235
                         style, x - 5, widget->allocation.y + 1,
2699
2714
                gint x, gint y,
2700
2715
                gint width, gint height, GtkPositionType gap_side)
2701
2716
{
2702
 
  if (widget && GTK_IS_NOTEBOOK (widget) && detail && !strcmp (detail, "tab"))
 
2717
  if (widget && GTK_IS_NOTEBOOK (widget) && DETAIL("tab"))
2703
2718
    {
2704
2719
      GtkNotebook *notebook = GTK_NOTEBOOK (widget);
2705
2720
 
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);
2711
2726
 
2712
2727
      if (!draw_themed_tab_button (style, window, state_type,
2743
2758
              gint gap_x,
2744
2759
              gint gap_width)
2745
2760
{
2746
 
  if (GTK_IS_NOTEBOOK (widget) && detail && !strcmp (detail, "notebook"))
 
2761
  if (GTK_IS_NOTEBOOK (widget) && DETAIL("notebook"))
2747
2762
    {
2748
2763
      GtkNotebook *notebook = GTK_NOTEBOOK (widget);
2749
2764
 
2819
2834
 
2820
2835
          return;
2821
2836
        }
2822
 
      else if (!strcmp (detail, "checkbutton"))
 
2837
      else if (DETAIL("checkbutton"))
2823
2838
        {
2824
2839
          if (state_type == GTK_STATE_PRELIGHT)
2825
2840
            {
2871
2886
  gboolean is_handlebox;
2872
2887
  gboolean is_toolbar;
2873
2888
 
2874
 
  if (detail && !strcmp (detail, "frame"))
 
2889
  if (DETAIL("frame"))
2875
2890
    {
2876
2891
 
2877
2892
      HDC dc;
2922
2937
 
2923
2938
      return;
2924
2939
    }
2925
 
  if (detail && (!strcmp (detail, "entry") || !strcmp (detail, "combobox")))
 
2940
  if (DETAIL("entry") || DETAIL("combobox"))
2926
2941
    {
2927
2942
      if (shadow_type != GTK_SHADOW_IN)
2928
2943
        return;
2944
2959
      return;
2945
2960
    }
2946
2961
 
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))
2950
2965
    {
2951
2966
      return;
2952
2967
    }
2953
2968
 
2954
 
  if (detail && !strcmp (detail, "spinbutton"))
 
2969
  if (DETAIL("spinbutton"))
2955
2970
    return;
2956
2971
 
2957
 
  if (detail && !strcmp (detail, "menu"))
 
2972
  if (DETAIL("menu"))
2958
2973
    {
2959
2974
      if (draw_menu_border (window, style, x, y, width, height))
2960
2975
        {
2962
2977
        }
2963
2978
    }
2964
2979
 
2965
 
  if (detail && !strcmp (detail, "handlebox"))
 
2980
  if (DETAIL("handlebox"))
2966
2981
    return;
2967
2982
 
2968
 
  is_handlebox = (detail && !strcmp (detail, "handlebox_bin"));
2969
 
  is_toolbar = (detail
2970
 
                && (!strcmp (detail, "toolbar")
2971
 
                    || !strcmp (detail, "menubar")));
 
2983
  is_handlebox = (DETAIL("handlebox_bin"));
 
2984
  is_toolbar = (DETAIL("toolbar") || DETAIL("menubar"));
2972
2985
 
2973
2986
  if (is_toolbar || is_handlebox)
2974
2987
    {
3068
3081
      return;
3069
3082
    }
3070
3083
 
3071
 
  if (detail && !strcmp (detail, "statusbar"))
 
3084
  if (DETAIL("statusbar"))
3072
3085
    {
3073
3086
      return;
3074
3087
    }
3089
3102
  
3090
3103
  cr = gdk_cairo_create (window);
3091
3104
 
3092
 
  if (xp_theme_is_active () && detail && !strcmp (detail, "menuitem"))
 
3105
  if (xp_theme_is_active () && DETAIL("menuitem"))
3093
3106
    {
3094
3107
      gint cx, cy;
3095
3108
      gint new_y, new_height;
3218
3231
  
3219
3232
  cr = gdk_cairo_create (window);
3220
3233
  
3221
 
  if (detail && !strcmp (detail, "statusbar"))
 
3234
  if (DETAIL("statusbar"))
3222
3235
    {
3223
3236
      if (xp_theme_draw
3224
3237
          (window, XP_THEME_ELEMENT_STATUS_GRIPPER, style, x, y, width,
3372
3385
   * notebook tabs, so we give them a gentle nudge two pixels to the
3373
3386
   * right.  A little hackish, but what are 'ya gonna do?  -- Cody
3374
3387
   */
3375
 
  if (xp_theme_is_active () && detail && !strcmp (detail, "label"))
 
3388
  if (xp_theme_is_active () && DETAIL("label"))
3376
3389
    {
3377
3390
      if (widget->parent != NULL)
3378
3391
        {