modules/engines/ms-windows/xp_theme.[ch] Add support for drawing

2007-06-26  Cody Russell  <bratsche@gnome.org>

        * modules/engines/ms-windows/xp_theme.[ch]
        * modules/engines/ms-windows/msw_style.c: Add support for
        drawing checkboxes with inconsistent states. (Tor, #164809)


svn path=/trunk/; revision=18246
This commit is contained in:
Cody Russell 2007-06-26 19:50:24 +00:00 committed by Cody Russell
parent 927c852aa9
commit 0aa5be0dec
4 changed files with 183 additions and 133 deletions

View File

@ -1,3 +1,9 @@
2007-06-26 Cody Russell <bratsche@gnome.org>
* modules/engines/ms-windows/xp_theme.[ch]
* modules/engines/ms-windows/msw_style.c: Add support for
drawing checkboxes with inconsistent states. (Tor, #164809)
2007-06-26 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtk-builder-convert (GtkBuilderConverter.to_xml): Encode

View File

@ -68,6 +68,7 @@ typedef enum
CHECK_LIGHT,
CHECK_MID,
CHECK_TEXT,
CHECK_INCONSISTENT,
RADIO_BASE,
RADIO_BLACK,
RADIO_DARK,
@ -113,6 +114,10 @@ static const guint8 check_text_bits[] = {
0xd8, 0x01, 0xf8,
0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const char check_inconsistent_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0xf0,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const guint8 radio_base_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0xf8, 0x03, 0xfc, 0x07, 0xfc, 0x07,
0xfc, 0x07, 0xfc,
@ -157,6 +162,7 @@ static struct
{check_light_bits, NULL},
{check_mid_bits, NULL},
{check_text_bits, NULL},
{check_inconsistent_bits, NULL},
{radio_base_bits, NULL},
{radio_black_bits, NULL},
{radio_dark_bits, NULL},
@ -1118,9 +1124,22 @@ draw_check (GtkStyle * style,
}
else
{
if (!xp_theme_draw (window, shadow == GTK_SHADOW_IN
? XP_THEME_ELEMENT_PRESSED_CHECKBOX
: XP_THEME_ELEMENT_CHECKBOX,
XpThemeElement theme_elt = XP_THEME_ELEMENT_CHECKBOX;
switch (shadow)
{
case GTK_SHADOW_ETCHED_IN:
theme_elt = XP_THEME_ELEMENT_INCONSISTENT_CHECKBOX;
break;
case GTK_SHADOW_IN:
theme_elt = XP_THEME_ELEMENT_PRESSED_CHECKBOX;
break;
default:
break;
}
if (!xp_theme_draw (window, theme_elt,
style, x, y, width, height, state, area))
{
if( detail && !strcmp(detail, "cellcheck") )
@ -1144,6 +1163,11 @@ draw_check (GtkStyle * style,
draw_part (window, style->text_aa_gc[state], area,
x, y, CHECK_AA);
}
else if (shadow == GTK_SHADOW_ETCHED_IN)
{
draw_part (window, style->text_gc[state], area, x, y, CHECK_INCONSISTENT);
draw_part (window, style->text_aa_gc[state], area, x, y, CHECK_AA);
}
}
}
}

View File

@ -97,6 +97,7 @@ static const LPCWSTR class_descriptors[] = {
};
static const short element_part_map[XP_THEME_ELEMENT__SIZEOF] = {
BP_CHECKBOX,
BP_CHECKBOX,
BP_CHECKBOX,
BP_PUSHBUTTON,
@ -358,6 +359,7 @@ xp_theme_get_handle_by_element (XpThemeElement element)
break;
case XP_THEME_ELEMENT_PRESSED_CHECKBOX:
case XP_THEME_ELEMENT_INCONSISTENT_CHECKBOX:
case XP_THEME_ELEMENT_CHECKBOX:
case XP_THEME_ELEMENT_BUTTON:
case XP_THEME_ELEMENT_DEFAULT_BUTTON:
@ -644,6 +646,23 @@ xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state)
}
break;
case XP_THEME_ELEMENT_INCONSISTENT_CHECKBOX:
switch (state)
{
case GTK_STATE_SELECTED:
ret = CBS_MIXEDPRESSED;
break;
case GTK_STATE_PRELIGHT:
ret = CBS_MIXEDHOT;
break;
case GTK_STATE_INSENSITIVE:
ret = CBS_MIXEDDISABLED;
break;
default:
ret = CBS_MIXEDNORMAL;
}
break;
case XP_THEME_ELEMENT_PRESSED_CHECKBOX:
case XP_THEME_ELEMENT_PRESSED_RADIO_BUTTON:
switch (state)

View File

@ -51,6 +51,7 @@ typedef enum
{
XP_THEME_ELEMENT_PRESSED_CHECKBOX = 0,
XP_THEME_ELEMENT_CHECKBOX,
XP_THEME_ELEMENT_INCONSISTENT_CHECKBOX,
XP_THEME_ELEMENT_BUTTON,
XP_THEME_ELEMENT_LIST_HEADER,
XP_THEME_ELEMENT_COMBOBUTTON,