зеркало из https://github.com/mozilla/gecko-dev.git
Bug 118296: implement NS_THEME_MENUBAR, NS_THEME_TOOLBAR, NS_THEME_MENUPOPUP and NS_THEME_MENUITEM (GTK2)
r=bryner, sr=roc
This commit is contained in:
Родитель
0058d1f7b8
Коммит
8b16e11d1f
|
@ -306,7 +306,6 @@ CSS_KEY(ltr, ltr)
|
|||
CSS_KEY(margin-box, margin_box)
|
||||
CSS_KEY(medium, medium)
|
||||
CSS_KEY(menu, menu)
|
||||
CSS_KEY(menubar, menubar)
|
||||
CSS_KEY(menutext, menutext)
|
||||
CSS_KEY(message-box, message_box)
|
||||
CSS_KEY(middle, middle)
|
||||
|
@ -488,6 +487,9 @@ CSS_KEY(scrollbargripper-horizontal, scrollbargripper_horizontal)
|
|||
CSS_KEY(scrollbargripper-vertical, scrollbargripper_vertical)
|
||||
CSS_KEY(textfield, textfield)
|
||||
CSS_KEY(caret, caret)
|
||||
CSS_KEY(menubar, menubar)
|
||||
CSS_KEY(menupopup, menupopup)
|
||||
CSS_KEY(menuitem, menuitem)
|
||||
CSS_KEY(menulist, menulist)
|
||||
CSS_KEY(menulist-button, menulistbutton)
|
||||
CSS_KEY(menulist-text, menulisttext)
|
||||
|
|
|
@ -231,8 +231,9 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
|||
eCSSKeyword_radiocontainer, NS_THEME_RADIO_CONTAINER,
|
||||
eCSSKeyword_window, NS_THEME_WINDOW,
|
||||
eCSSKeyword_dialog, NS_THEME_DIALOG,
|
||||
eCSSKeyword_menu, NS_THEME_MENU,
|
||||
eCSSKeyword_menubar, NS_THEME_MENUBAR,
|
||||
eCSSKeyword_menupopup, NS_THEME_MENUPOPUP,
|
||||
eCSSKeyword_menuitem, NS_THEME_MENUITEM,
|
||||
-1,-1
|
||||
};
|
||||
|
||||
|
|
|
@ -189,6 +189,9 @@
|
|||
#define NS_THEME_WINDOW 200
|
||||
#define NS_THEME_DIALOG 201
|
||||
|
||||
// Menu and Menu Bar backgrounds
|
||||
#define NS_THEME_MENU 210
|
||||
#define NS_THEME_MENUBAR 211
|
||||
// Menu Bar background
|
||||
#define NS_THEME_MENUBAR 210
|
||||
// Menu Popup background
|
||||
#define NS_THEME_MENUPOPUP 211
|
||||
// <menu> and <menuitem> appearances
|
||||
#define NS_THEME_MENUITEM 212
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com> (Original Author)
|
||||
* Pierre Chanial <p_ch@verizon.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -62,10 +63,18 @@ static GtkWidget* gEntryWidget;
|
|||
static GtkWidget* gArrowWidget;
|
||||
static GtkWidget* gDropdownButtonWidget;
|
||||
static GtkWidget* gHandleBoxWidget;
|
||||
static GtkWidget* gToolbarWidget;
|
||||
static GtkWidget* gFrameWidget;
|
||||
static GtkWidget* gProgressWidget;
|
||||
static GtkWidget* gTabWidget;
|
||||
static GtkWidget* gTooltipWidget;
|
||||
static GtkWidget* gMenuBarWidget;
|
||||
static GtkWidget* gMenuBarItemWidget;
|
||||
static GtkWidget* gMenuPopupWidget;
|
||||
static GtkWidget* gMenuItemWidget;
|
||||
|
||||
static GtkShadowType gMenuBarShadowType;
|
||||
static GtkShadowType gToolbarShadowType;
|
||||
|
||||
static style_prop_t style_prop_func;
|
||||
|
||||
|
@ -178,6 +187,20 @@ ensure_handlebox_widget()
|
|||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
ensure_toolbar_widget()
|
||||
{
|
||||
if (!gToolbarWidget) {
|
||||
ensure_handlebox_widget();
|
||||
gToolbarWidget = gtk_toolbar_new();
|
||||
gtk_container_add(GTK_CONTAINER(gHandleBoxWidget), gToolbarWidget);
|
||||
gtk_widget_realize(gToolbarWidget);
|
||||
gtk_widget_style_get(gToolbarWidget, "shadow_type", &gToolbarShadowType,
|
||||
NULL);
|
||||
}
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
ensure_tooltip_widget()
|
||||
{
|
||||
|
@ -218,15 +241,67 @@ ensure_frame_widget()
|
|||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
ensure_menu_bar_widget()
|
||||
{
|
||||
if (!gMenuBarWidget) {
|
||||
gMenuBarWidget = gtk_menu_bar_new();
|
||||
setup_widget_prototype(gMenuBarWidget);
|
||||
gtk_widget_style_get(gMenuBarWidget, "shadow_type", &gMenuBarShadowType,
|
||||
NULL);
|
||||
}
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
ensure_menu_bar_item_widget()
|
||||
{
|
||||
if (!gMenuBarItemWidget) {
|
||||
ensure_menu_bar_widget();
|
||||
gMenuBarItemWidget = gtk_menu_item_new();
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuBarWidget),
|
||||
gMenuBarItemWidget);
|
||||
gtk_widget_realize(gMenuBarItemWidget);
|
||||
}
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
ensure_menu_popup_widget()
|
||||
{
|
||||
if (!gMenuPopupWidget) {
|
||||
ensure_menu_bar_item_widget();
|
||||
gMenuPopupWidget = gtk_menu_new();
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(gMenuBarItemWidget),
|
||||
gMenuPopupWidget);
|
||||
gtk_widget_realize(gMenuPopupWidget);
|
||||
}
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
ensure_menu_item_widget()
|
||||
{
|
||||
if (!gMenuItemWidget) {
|
||||
ensure_menu_popup_widget();
|
||||
gMenuItemWidget = gtk_menu_item_new_with_label("M");
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
|
||||
gMenuItemWidget);
|
||||
gtk_widget_realize(gMenuItemWidget);
|
||||
}
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static GtkStateType
|
||||
ConvertGtkState(GtkWidgetState* state)
|
||||
{
|
||||
if (state->disabled)
|
||||
return GTK_STATE_INSENSITIVE;
|
||||
else if (state->active)
|
||||
return GTK_STATE_ACTIVE;
|
||||
else if (state->inHover)
|
||||
return (state->active ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT);
|
||||
else
|
||||
return GTK_STATE_NORMAL;
|
||||
return GTK_STATE_PRELIGHT;
|
||||
return GTK_STATE_NORMAL;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -296,13 +371,15 @@ moz_gtk_button_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
|||
width -= 2;
|
||||
height -= 2;
|
||||
}
|
||||
|
||||
shadow_type = (state->active && state->inHover) ?
|
||||
GTK_SHADOW_IN : GTK_SHADOW_OUT;
|
||||
|
||||
|
||||
shadow_type = button_state == GTK_STATE_ACTIVE ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
|
||||
|
||||
if (relief != GTK_RELIEF_NONE || (button_state != GTK_STATE_NORMAL &&
|
||||
button_state != GTK_STATE_INSENSITIVE)) {
|
||||
TSOffsetStyleGCs(style, x, y);
|
||||
/* the following line can trigger an assertion (Crux theme)
|
||||
file ../../gdk/gdkwindow.c: line 1846 (gdk_window_clear_area):
|
||||
assertion `GDK_IS_WINDOW (window)' failed */
|
||||
gtk_paint_box(style, drawable, button_state, shadow_type, cliprect,
|
||||
widget, "button", x, y, width, height);
|
||||
}
|
||||
|
@ -739,23 +816,21 @@ moz_gtk_toolbar_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
|||
GdkRectangle* cliprect)
|
||||
{
|
||||
GtkStyle* style;
|
||||
GtkShadowType shadow_type;
|
||||
|
||||
ensure_handlebox_widget();
|
||||
style = gHandleBoxWidget->style;
|
||||
ensure_toolbar_widget();
|
||||
style = gToolbarWidget->style;
|
||||
|
||||
TSOffsetStyleGCs(style, rect->x, rect->y);
|
||||
|
||||
if (style->bg_pixmap[GTK_STATE_NORMAL]) {
|
||||
gtk_style_apply_default_background(style, drawable, TRUE,
|
||||
GTK_STATE_NORMAL,
|
||||
cliprect, rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
else {
|
||||
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
||||
cliprect, gHandleBoxWidget, "dockitem_bin",
|
||||
rect->x, rect->y, rect->width, rect->height);
|
||||
}
|
||||
gtk_style_apply_default_background(style, drawable, TRUE,
|
||||
GTK_STATE_NORMAL,
|
||||
cliprect, rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
|
||||
gtk_paint_box (style, drawable, GTK_STATE_NORMAL, gToolbarShadowType,
|
||||
cliprect, gToolbarWidget, "toolbar",
|
||||
rect->x, rect->y, rect->width, rect->height);
|
||||
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
@ -924,6 +999,66 @@ moz_gtk_tabpanels_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
|||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_menu_bar_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect)
|
||||
{
|
||||
GtkStyle* style;
|
||||
GtkShadowType shadow_type;
|
||||
ensure_menu_bar_widget();
|
||||
style = gMenuBarWidget->style;
|
||||
|
||||
TSOffsetStyleGCs(style, rect->x, rect->y);
|
||||
gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
|
||||
cliprect, rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, gMenuBarShadowType,
|
||||
cliprect, gMenuBarWidget, "menubar", rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_menu_popup_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect)
|
||||
{
|
||||
GtkStyle* style;
|
||||
ensure_menu_popup_widget();
|
||||
style = gMenuPopupWidget->style;
|
||||
|
||||
TSOffsetStyleGCs(style, rect->x, rect->y);
|
||||
gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
|
||||
cliprect, rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
||||
cliprect, gMenuPopupWidget, "menu",
|
||||
rect->x, rect->y, rect->width, rect->height);
|
||||
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect, GtkWidgetState* state)
|
||||
{
|
||||
GtkStyle* style;
|
||||
GtkShadowType shadow_type;
|
||||
|
||||
if (state->inHover && !state->disabled) {
|
||||
ensure_menu_item_widget();
|
||||
|
||||
style = gMenuItemWidget->style;
|
||||
TSOffsetStyleGCs(style, rect->x, rect->y);
|
||||
gtk_widget_style_get(gMenuItemWidget, "selected_shadow_type",
|
||||
&shadow_type, NULL);
|
||||
gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, shadow_type,
|
||||
cliprect, gMenuItemWidget, "menuitem", rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
|
||||
return MOZ_GTK_SUCCESS;
|
||||
}
|
||||
|
||||
static gint
|
||||
moz_gtk_window_paint(GdkDrawable* drawable, GdkRectangle* rect,
|
||||
GdkRectangle* cliprect)
|
||||
|
@ -946,14 +1081,15 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* xthickness,
|
|||
gint* ythickness)
|
||||
{
|
||||
GtkWidget* w;
|
||||
|
||||
switch (widget) {
|
||||
case MOZ_GTK_BUTTON:
|
||||
ensure_button_widget();
|
||||
w = gButtonWidget;
|
||||
break;
|
||||
case MOZ_GTK_TOOLBAR:
|
||||
ensure_handlebox_widget();
|
||||
w = gHandleBoxWidget;
|
||||
ensure_toolbar_widget();
|
||||
w = gToolbarWidget;
|
||||
break;
|
||||
case MOZ_GTK_ENTRY:
|
||||
ensure_entry_widget();
|
||||
|
@ -984,6 +1120,18 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* xthickness,
|
|||
*ythickness = 1;
|
||||
return MOZ_GTK_SUCCESS;
|
||||
break;
|
||||
case MOZ_GTK_MENUBAR:
|
||||
ensure_menu_bar_widget();
|
||||
w = gMenuBarWidget;
|
||||
break;
|
||||
case MOZ_GTK_MENUPOPUP:
|
||||
ensure_menu_popup_widget();
|
||||
w = gMenuPopupWidget;
|
||||
break;
|
||||
case MOZ_GTK_MENUITEM:
|
||||
ensure_menu_item_widget();
|
||||
w = gMenuItemWidget;
|
||||
break;
|
||||
/* These widgets have no borders, since they are not containers. */
|
||||
case MOZ_GTK_CHECKBUTTON:
|
||||
case MOZ_GTK_RADIOBUTTON:
|
||||
|
@ -1139,6 +1287,15 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
|
|||
case MOZ_GTK_TABPANELS:
|
||||
return moz_gtk_tabpanels_paint(drawable, rect, cliprect);
|
||||
break;
|
||||
case MOZ_GTK_MENUBAR:
|
||||
return moz_gtk_menu_bar_paint(drawable, rect, cliprect);
|
||||
break;
|
||||
case MOZ_GTK_MENUPOPUP:
|
||||
return moz_gtk_menu_popup_paint(drawable, rect, cliprect);
|
||||
break;
|
||||
case MOZ_GTK_MENUITEM:
|
||||
return moz_gtk_menu_item_paint(drawable, rect, cliprect, state);
|
||||
break;
|
||||
case MOZ_GTK_WINDOW:
|
||||
return moz_gtk_window_paint(drawable, rect, cliprect);
|
||||
break;
|
||||
|
|
|
@ -128,6 +128,12 @@ typedef enum {
|
|||
MOZ_GTK_TAB,
|
||||
/* Paints the background and border of a GtkNotebook. */
|
||||
MOZ_GTK_TABPANELS,
|
||||
/* Paints the background of the menu bar. */
|
||||
MOZ_GTK_MENUBAR,
|
||||
/* Paints the background of menus, context menus. */
|
||||
MOZ_GTK_MENUPOPUP,
|
||||
/* Paints items of menubar and popups. */
|
||||
MOZ_GTK_MENUITEM,
|
||||
/* Paints the background of a window, dialog or page. */
|
||||
MOZ_GTK_WINDOW
|
||||
} GtkThemeWidgetType;
|
||||
|
|
|
@ -84,6 +84,7 @@ nsNativeThemeGTK::nsNativeThemeGTK()
|
|||
mFirstTabAtom = do_GetAtom("first-tab");
|
||||
mCurPosAtom = do_GetAtom("curpos");
|
||||
mMaxPosAtom = do_GetAtom("maxpos");
|
||||
mMenuActiveAtom = do_GetAtom("_moz-menuactive");
|
||||
|
||||
memset(mDisabledWidgetTypes, 0, sizeof(mDisabledWidgetTypes));
|
||||
memset(mSafeWidgetStates, 0, sizeof(mSafeWidgetStates));
|
||||
|
@ -242,20 +243,25 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
// reset the entire struct to zero
|
||||
memset(aState, 0, sizeof(GtkWidgetState));
|
||||
} else {
|
||||
|
||||
// for dropdown textfields, look at the parent frame (the textbox)
|
||||
if (aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD)
|
||||
aFrame = aFrame->GetParent();
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame);
|
||||
|
||||
aState->active = ((eventState & NS_EVENT_STATE_ACTIVE) == NS_EVENT_STATE_ACTIVE);
|
||||
aState->disabled = IsDisabled(aFrame);
|
||||
aState->active = (eventState & NS_EVENT_STATE_ACTIVE) == NS_EVENT_STATE_ACTIVE;
|
||||
aState->focused = (eventState & NS_EVENT_STATE_FOCUS) == NS_EVENT_STATE_FOCUS;
|
||||
aState->inHover = (eventState & NS_EVENT_STATE_HOVER) == NS_EVENT_STATE_HOVER;
|
||||
aState->isDefault = FALSE; // XXX fix me
|
||||
aState->canDefault = FALSE; // XXX fix me
|
||||
|
||||
if (aWidgetType == NS_THEME_TEXTFIELD ||
|
||||
aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD ||
|
||||
aWidgetType == NS_THEME_RADIO_CONTAINER)
|
||||
aWidgetType == NS_THEME_RADIO_CONTAINER) {
|
||||
aState->focused = CheckBooleanAttr(aFrame, mFocusedAtom);
|
||||
else
|
||||
aState->focused = ((eventState & NS_EVENT_STATE_FOCUS) == NS_EVENT_STATE_FOCUS);
|
||||
}
|
||||
|
||||
if (aWidgetType == NS_THEME_SCROLLBAR_THUMB_VERTICAL ||
|
||||
aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL) {
|
||||
|
@ -267,10 +273,12 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
aState->maxpos = CheckIntegerAttr(tmpFrame, mMaxPosAtom);
|
||||
}
|
||||
|
||||
aState->inHover = ((eventState & NS_EVENT_STATE_HOVER) == NS_EVENT_STATE_HOVER);
|
||||
aState->disabled = IsDisabled(aFrame);
|
||||
aState->isDefault = FALSE; // XXX fix me
|
||||
aState->canDefault = FALSE; // XXX fix me
|
||||
// menu item state is determined by the attribute "_moz-menuactive",
|
||||
// and not by the mouse hovering (accessibility).
|
||||
if (aWidgetType == NS_THEME_MENUITEM) {
|
||||
aState->inHover = CheckBooleanAttr(aFrame, mMenuActiveAtom);
|
||||
aState->active = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +347,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
case NS_THEME_RADIO_CONTAINER:
|
||||
aGtkWidgetType = MOZ_GTK_RADIOBUTTON_CONTAINER;
|
||||
break;
|
||||
case NS_THEME_TOOLBOX:
|
||||
case NS_THEME_TOOLBAR:
|
||||
aGtkWidgetType = MOZ_GTK_TOOLBAR;
|
||||
break;
|
||||
case NS_THEME_TOOLTIP:
|
||||
|
@ -379,6 +387,15 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
aGtkWidgetType = MOZ_GTK_TAB;
|
||||
}
|
||||
break;
|
||||
case NS_THEME_MENUBAR:
|
||||
aGtkWidgetType = MOZ_GTK_MENUBAR;
|
||||
break;
|
||||
case NS_THEME_MENUPOPUP:
|
||||
aGtkWidgetType = MOZ_GTK_MENUPOPUP;
|
||||
break;
|
||||
case NS_THEME_MENUITEM:
|
||||
aGtkWidgetType = MOZ_GTK_MENUITEM;
|
||||
break;
|
||||
case NS_THEME_WINDOW:
|
||||
case NS_THEME_DIALOG:
|
||||
aGtkWidgetType = MOZ_GTK_WINDOW;
|
||||
|
@ -584,6 +601,8 @@ nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
aWidgetType == NS_THEME_PROGRESSBAR_CHUNK_VERTICAL ||
|
||||
aWidgetType == NS_THEME_PROGRESSBAR ||
|
||||
aWidgetType == NS_THEME_PROGRESSBAR_VERTICAL ||
|
||||
aWidgetType == NS_THEME_MENUBAR ||
|
||||
aWidgetType == NS_THEME_MENUPOPUP ||
|
||||
aWidgetType == NS_THEME_TOOLTIP ||
|
||||
aWidgetType == NS_THEME_WINDOW ||
|
||||
aWidgetType == NS_THEME_DIALOG) {
|
||||
|
@ -636,8 +655,8 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
|||
case NS_THEME_BUTTON:
|
||||
case NS_THEME_RADIO:
|
||||
case NS_THEME_CHECKBOX:
|
||||
case NS_THEME_TOOLBOX:
|
||||
// case NS_THEME_TOOLBAR: (not in skin)
|
||||
case NS_THEME_TOOLBOX: // N/A
|
||||
case NS_THEME_TOOLBAR:
|
||||
case NS_THEME_TOOLBAR_BUTTON:
|
||||
case NS_THEME_TOOLBAR_DUAL_BUTTON: // so we can override the border with 0
|
||||
// case NS_THEME_TOOLBAR_DUAL_BUTTON_DROPDOWN:
|
||||
|
@ -694,11 +713,12 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsIPresContext* aPresContext,
|
|||
case NS_THEME_CHECKBOX_CONTAINER:
|
||||
case NS_THEME_RADIO_CONTAINER:
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
case NS_THEME_MENUBAR:
|
||||
case NS_THEME_MENUPOPUP:
|
||||
case NS_THEME_MENUITEM:
|
||||
case NS_THEME_WINDOW:
|
||||
case NS_THEME_DIALOG:
|
||||
#endif
|
||||
// case NS_THEME_MENU:
|
||||
// case NS_THEME_MENUBAR:
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ private:
|
|||
nsCOMPtr<nsIAtom> mFirstTabAtom;
|
||||
nsCOMPtr<nsIAtom> mCurPosAtom;
|
||||
nsCOMPtr<nsIAtom> mMaxPosAtom;
|
||||
nsCOMPtr<nsIAtom> mMenuActiveAtom;
|
||||
|
||||
PRUint8 mDisabledWidgetTypes[32];
|
||||
PRUint8 mSafeWidgetStates[1024]; // 256 widgets * 32 bits per widget
|
||||
|
|
|
@ -334,7 +334,7 @@ nsNativeThemeMac::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame*
|
|||
::SetThemeBackground(kThemeBrushWhite, 24, true);
|
||||
break;
|
||||
|
||||
case NS_THEME_MENU:
|
||||
case NS_THEME_MENUPOPUP:
|
||||
::SetThemeBackground(kThemeBrushDialogBackgroundActive, 24, true);
|
||||
::EraseRect(&macRect);
|
||||
::SetThemeBackground(kThemeBrushWhite, 24, true);
|
||||
|
@ -713,7 +713,7 @@ nsNativeThemeMac::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_TAB_PANEL:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_DIALOG:
|
||||
case NS_THEME_MENU:
|
||||
case NS_THEME_MENUPOPUP:
|
||||
*aShouldRepaint = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ nsNativeThemeMac::ThemeSupportsWidget(nsIPresContext* aPresContext, nsIFrame* aF
|
|||
switch ( aWidgetType ) {
|
||||
case NS_THEME_DIALOG:
|
||||
case NS_THEME_WINDOW:
|
||||
// case NS_THEME_MENU: // no support for painting menu backgrounds
|
||||
// case NS_THEME_MENUPOPUP: // no support for painting menu backgrounds
|
||||
case NS_THEME_TOOLTIP:
|
||||
|
||||
case NS_THEME_CHECKBOX:
|
||||
|
|
|
@ -306,7 +306,6 @@ CSS_KEY(ltr, ltr)
|
|||
CSS_KEY(margin-box, margin_box)
|
||||
CSS_KEY(medium, medium)
|
||||
CSS_KEY(menu, menu)
|
||||
CSS_KEY(menubar, menubar)
|
||||
CSS_KEY(menutext, menutext)
|
||||
CSS_KEY(message-box, message_box)
|
||||
CSS_KEY(middle, middle)
|
||||
|
@ -488,6 +487,9 @@ CSS_KEY(scrollbargripper-horizontal, scrollbargripper_horizontal)
|
|||
CSS_KEY(scrollbargripper-vertical, scrollbargripper_vertical)
|
||||
CSS_KEY(textfield, textfield)
|
||||
CSS_KEY(caret, caret)
|
||||
CSS_KEY(menubar, menubar)
|
||||
CSS_KEY(menupopup, menupopup)
|
||||
CSS_KEY(menuitem, menuitem)
|
||||
CSS_KEY(menulist, menulist)
|
||||
CSS_KEY(menulist-button, menulistbutton)
|
||||
CSS_KEY(menulist-text, menulisttext)
|
||||
|
|
|
@ -231,8 +231,9 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = {
|
|||
eCSSKeyword_radiocontainer, NS_THEME_RADIO_CONTAINER,
|
||||
eCSSKeyword_window, NS_THEME_WINDOW,
|
||||
eCSSKeyword_dialog, NS_THEME_DIALOG,
|
||||
eCSSKeyword_menu, NS_THEME_MENU,
|
||||
eCSSKeyword_menubar, NS_THEME_MENUBAR,
|
||||
eCSSKeyword_menupopup, NS_THEME_MENUPOPUP,
|
||||
eCSSKeyword_menuitem, NS_THEME_MENUITEM,
|
||||
-1,-1
|
||||
};
|
||||
|
||||
|
|
|
@ -147,9 +147,9 @@ resizer[dir="bottomright"] {
|
|||
/* XXXBlake yeah, shoot me -- these don't belong here. I'll move them later. */
|
||||
|
||||
sidebarheader {
|
||||
-moz-appearance: toolbar;
|
||||
height: 25px;
|
||||
background-color: -moz-Dialog;
|
||||
-moz-appearance: toolbox;
|
||||
border-bottom: 1px solid ThreeDShadow;
|
||||
border-top: 1px solid ThreeDHighlight;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ classic.jar:
|
|||
+ skin/classic/global/linkTree.css
|
||||
+ skin/classic/global/listbox.css
|
||||
+ skin/classic/global/menulist.css
|
||||
+ skin/classic/global/popup.css
|
||||
*+ skin/classic/global/popup.css
|
||||
+ skin/classic/global/progressmeter.css
|
||||
+ skin/classic/global/radio.css
|
||||
+ skin/classic/global/scrollbars.css
|
||||
|
@ -26,7 +26,7 @@ classic.jar:
|
|||
+ skin/classic/global/tree.css
|
||||
+ skin/classic/global/wizard.css
|
||||
+ skin/classic/global/button.css
|
||||
+ skin/classic/global/menu.css
|
||||
*+ skin/classic/global/menu.css
|
||||
skin/classic/global/expander.css
|
||||
+ skin/classic/global/toolbar.css
|
||||
+ skin/classic/global/globalBindings.xml
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
|
||||
/* ::::: menu/menuitem ::::: */
|
||||
|
||||
menu, menuitem {
|
||||
-moz-appearance: menuitem !important;
|
||||
}
|
||||
|
||||
menu,
|
||||
menuitem {
|
||||
-moz-box-align: center;
|
||||
|
@ -93,13 +97,20 @@ menuitem[_moz-menuactive="true"][disabled="true"] {
|
|||
-moz-image-region: auto;
|
||||
}
|
||||
|
||||
/* ::::: menu/menuitems in menubar ::::: */
|
||||
/* ::::: menubar ::::: */
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
menubar > menu {
|
||||
padding: 0px 6px 0px 4px;
|
||||
}
|
||||
#else
|
||||
menubar > menu {
|
||||
border: 1px solid transparent;
|
||||
padding: 2px 5px 2px 7px;
|
||||
margin: 1px 0px 1px 0px;
|
||||
}
|
||||
#endif
|
||||
|
||||
menubar > menu[_moz-menuactive="true"] {
|
||||
border-top: 1px solid ThreeDHighlight;
|
||||
border-right: 1px solid ThreeDShadow;
|
||||
|
@ -131,10 +142,13 @@ menupopup > menu,
|
|||
popup > menu,
|
||||
menupopup > menuitem,
|
||||
popup > menuitem {
|
||||
#ifndef MOZ_WIDGET_GTK2
|
||||
padding: 2px;
|
||||
#endif
|
||||
max-width: 42em;
|
||||
}
|
||||
|
||||
menubar > menu[_moz-menuactive="true"],
|
||||
menupopup > menu[_moz-menuactive="true"],
|
||||
menupopup > menuitem[_moz-menuactive="true"],
|
||||
popup > menu[_moz-menuactive="true"],
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
|
||||
/* ::::: menupopup ::::: */
|
||||
|
||||
menupopup, popup {
|
||||
-moz-appearance: menupopup !important;
|
||||
}
|
||||
|
||||
menupopup,
|
||||
popup {
|
||||
border: 2px solid;
|
||||
|
@ -36,7 +40,9 @@ popup {
|
|||
-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
|
||||
-moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
|
||||
-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;
|
||||
#ifndef MOZ_WIDGET_GTK2
|
||||
padding: 1px;
|
||||
#endif
|
||||
min-width: 1px;
|
||||
background-color: Menu;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,20 @@ toolbox {
|
|||
background-color: -moz-Dialog;
|
||||
}
|
||||
|
||||
/* ::::: toolbar & menubar ::::: */
|
||||
/* ::::: menubar & toolbar ::::: */
|
||||
|
||||
menubar,
|
||||
toolbar[type="menubar"] {
|
||||
-moz-appearance: menubar !important;
|
||||
}
|
||||
toolbar {
|
||||
-moz-appearance: toolbar !important;
|
||||
}
|
||||
|
||||
/* in browser.xul, the menubar is inside a toolbar... */
|
||||
toolbar > toolbaritem > menubar {
|
||||
-moz-appearance: none !important;
|
||||
}
|
||||
|
||||
toolbar {
|
||||
min-width: 1px;
|
||||
|
|
|
@ -149,9 +149,8 @@ nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor& aColor)
|
|||
aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
|
||||
break;
|
||||
case eColor_graytext:
|
||||
// disabled text
|
||||
// disabled text in windows, menus, etc.
|
||||
aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_INSENSITIVE]);
|
||||
// or maybe mStyle->text?
|
||||
break;
|
||||
case eColor_highlight:
|
||||
// background of selected item
|
||||
|
|
Загрузка…
Ссылка в новой задаче