Bug 404493 - "Native GTK style for arrows" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r+sr=roc a1.9=beltzner]

This commit is contained in:
reed@reedloden.com 2007-11-28 14:45:21 -08:00
Родитель 5b6771674a
Коммит da951f93a3
4 изменённых файлов: 39 добавлений и 25 удалений

Просмотреть файл

@ -146,31 +146,12 @@ menulist > menupopup > menu {
margin-bottom: 0px;
-moz-margin-start: 6px;
-moz-margin-end: 0px;
width: 8px;
list-style-image: url("chrome://global/skin/menu/Menu-arrow.png");
width: 1ex;
height: 1ex;
/* These next two rules are needed to prevent inheritance and thus ugliness */
list-style-image: none;
-moz-image-region: auto;
}
.menu-right[_moz-menuactive="true"] {
list-style-image: url("chrome://global/skin/menu/Menu-arrow-hover.png");
-moz-image-region: auto;
}
.menu-right[disabled="true"] {
list-style-image: url("chrome://global/skin/menu/Menu-arrow-disabled.png");
-moz-image-region: auto;
}
.menu-right[chromedir="rtl"] {
list-style-image: url("chrome://global/skin/menu/Menu-arrow-rtl.png");
}
.menu-right[chromedir="rtl"][_moz-menuactive="true"] {
list-style-image: url("chrome://global/skin/menu/Menu-arrow-hover-rtl.png");
}
.menu-right[chromedir="rtl"][disabled="true"] {
list-style-image: url("chrome://global/skin/menu/Menu-arrow-disabled-rtl.png");
-moz-appearance: menuarrow;
}
.menubar-left {

Просмотреть файл

@ -1588,6 +1588,28 @@ moz_gtk_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect,
return MOZ_GTK_SUCCESS;
}
static gint
moz_gtk_menu_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
GdkRectangle* cliprect, GtkWidgetState* state)
{
GtkStyle* style;
GtkTextDirection chromedir;
GtkStateType state_type = ConvertGtkState(state);
ensure_menu_item_widget();
style = gMenuItemWidget->style;
chromedir = gtk_widget_get_direction(gMenuItemWidget);
TSOffsetStyleGCs(style, rect->x, rect->y);
gtk_paint_arrow(style, drawable, state_type,
(state_type == GTK_STATE_PRELIGHT) ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
cliprect, gMenuItemWidget, "menuitem",
(chromedir == GTK_TEXT_DIR_LTR) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT,
TRUE, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
}
static gint
moz_gtk_check_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect,
GdkRectangle* cliprect, GtkWidgetState* state,
@ -1875,6 +1897,7 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
case MOZ_GTK_TOOLTIP:
case MOZ_GTK_WINDOW:
case MOZ_GTK_RESIZER:
case MOZ_GTK_MENUARROW:
*left = *top = *right = *bottom = 0;
return MOZ_GTK_SUCCESS;
default:
@ -2064,6 +2087,9 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
case MOZ_GTK_MENUITEM:
return moz_gtk_menu_item_paint(drawable, rect, cliprect, state);
break;
case MOZ_GTK_MENUARROW:
return moz_gtk_menu_arrow_paint(drawable, rect, cliprect, state);
break;
case MOZ_GTK_CHECKMENUITEM:
case MOZ_GTK_RADIOMENUITEM:
return moz_gtk_check_menu_item_paint(drawable, rect, cliprect, state,

Просмотреть файл

@ -165,6 +165,8 @@ typedef enum {
MOZ_GTK_MENUBAR,
/* Paints the background of menus, context menus. */
MOZ_GTK_MENUPOPUP,
/* Paints the arrow of menuitems that contain submenus */
MOZ_GTK_MENUARROW,
/* Paints items of menubar and popups. */
MOZ_GTK_MENUITEM,
MOZ_GTK_CHECKMENUITEM,

Просмотреть файл

@ -272,7 +272,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
if (aWidgetType == NS_THEME_MENUITEM ||
aWidgetType == NS_THEME_CHECKMENUITEM ||
aWidgetType == NS_THEME_RADIOMENUITEM) {
aWidgetType == NS_THEME_RADIOMENUITEM ||
aWidgetType == NS_THEME_MENUARROW) {
PRBool isTopLevel = PR_FALSE;
nsIMenuFrame *menuFrame;
CallQueryInterface(aFrame, &menuFrame);
@ -484,6 +485,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
case NS_THEME_MENUITEM:
aGtkWidgetType = MOZ_GTK_MENUITEM;
break;
case NS_THEME_MENUARROW:
aGtkWidgetType = MOZ_GTK_MENUARROW;
break;
case NS_THEME_CHECKMENUITEM:
aGtkWidgetType = MOZ_GTK_CHECKMENUITEM;
break;
@ -1053,6 +1057,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case NS_THEME_MENUBAR:
case NS_THEME_MENUPOPUP:
case NS_THEME_MENUITEM:
case NS_THEME_MENUARROW:
case NS_THEME_CHECKMENUITEM:
case NS_THEME_RADIOMENUITEM:
case NS_THEME_WINDOW: