mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Bug 538840 – [Win32] GTK menu theming could be improved
2009-03-21 Cody Russell <bratsche@gnome.org> Bug 538840 – [Win32] GTK menu theming could be improved * modules/engines/ms-windows/xp_theme.c * modules/engines/ms-windows/msw_style.c: Use newer menu styling API. This makes gtk+ look much better on Windows Vista. svn path=/trunk/; revision=22577
This commit is contained in:
parent
4bf41bbf53
commit
b48e4b070f
@ -1,3 +1,12 @@
|
||||
2009-03-21 Cody Russell <bratsche@gnome.org>
|
||||
|
||||
Bug 538840 – [Win32] GTK menu theming could be improved
|
||||
|
||||
* modules/engines/ms-windows/xp_theme.c
|
||||
* modules/engines/ms-windows/msw_style.c: Use newer
|
||||
menu styling API. This makes gtk+ look much better on
|
||||
Windows Vista.
|
||||
|
||||
2009-03-19 Claudio Saavedra <csaavedra@igalia.com>
|
||||
|
||||
Bug 574283 – unused assignment and dead code in
|
||||
|
@ -536,29 +536,42 @@ sys_font_to_pango_font (XpThemeClass klazz, XpThemeFont type, char *buf,
|
||||
for now */
|
||||
#define XP_THEME_CLASS_TEXT XP_THEME_CLASS_BUTTON
|
||||
|
||||
static void
|
||||
setup_menu_settings (GtkSettings *settings)
|
||||
#define WIN95_VERSION 0x400
|
||||
#define WIN2K_VERSION 0x500
|
||||
#define WINXP_VERSION 0x501
|
||||
#define WIN2K3_VERSION 0x502
|
||||
#define VISTA_VERSION 0x600
|
||||
|
||||
static gint32
|
||||
get_windows_version ()
|
||||
{
|
||||
int menu_delay;
|
||||
gboolean win95 = FALSE;
|
||||
static gint32 version = 0;
|
||||
static gboolean have_version = FALSE;
|
||||
|
||||
if (!have_version)
|
||||
{
|
||||
have_version = TRUE;
|
||||
OSVERSIONINFOEX osvi;
|
||||
GObjectClass *klazz = G_OBJECT_GET_CLASS (G_OBJECT (settings));
|
||||
|
||||
ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
|
||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
|
||||
|
||||
if (!GetVersionEx ((OSVERSIONINFO *) & osvi))
|
||||
win95 = TRUE; /* assume the worst */
|
||||
GetVersionEx((OSVERSIONINFO*) &osvi);
|
||||
|
||||
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
|
||||
{
|
||||
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
|
||||
{
|
||||
win95 = TRUE;
|
||||
}
|
||||
version = (osvi.dwMajorVersion & 0xff) << 8 | (osvi.dwMinorVersion & 0xff);
|
||||
}
|
||||
|
||||
if (!win95)
|
||||
return version;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_menu_settings (GtkSettings *settings)
|
||||
{
|
||||
int menu_delay;
|
||||
OSVERSIONINFOEX osvi;
|
||||
GObjectClass *klazz = G_OBJECT_GET_CLASS (G_OBJECT (settings));
|
||||
|
||||
if (get_windows_version () > WIN95_VERSION)
|
||||
{
|
||||
if (SystemParametersInfo (SPI_GETMENUSHOWDELAY, 0, &menu_delay, 0))
|
||||
{
|
||||
@ -685,7 +698,8 @@ setup_msw_rc_style (void)
|
||||
GdkColor text_prelight;
|
||||
|
||||
/* Prelight */
|
||||
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHTTEXT,
|
||||
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT,
|
||||
get_windows_version () == VISTA_VERSION ? COLOR_MENUTEXT : COLOR_HIGHLIGHTTEXT,
|
||||
&fg_prelight);
|
||||
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHT, &bg_prelight);
|
||||
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHT,
|
||||
@ -1810,6 +1824,12 @@ draw_menu_item (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
|
||||
HDC dc;
|
||||
RECT rect;
|
||||
|
||||
if (xp_theme_is_active ())
|
||||
{
|
||||
return (xp_theme_draw (window, XP_THEME_ELEMENT_MENU_ITEM, style,
|
||||
x, y, width, height, state_type, area));
|
||||
}
|
||||
|
||||
if ((parent = gtk_widget_get_parent (widget))
|
||||
&& GTK_IS_MENU_BAR (parent) && !xp_theme_is_active ())
|
||||
{
|
||||
|
@ -79,6 +79,16 @@
|
||||
|
||||
#define TRS_NORMAL 1
|
||||
|
||||
#define MBI_NORMAL 1
|
||||
#define MBI_HOT 2
|
||||
#define MBI_PUSHED 3
|
||||
#define MBI_DISABLED 4
|
||||
#define MBI_DISABLEDHOT 5
|
||||
#define MBI_DISABLEDPUSHED 6
|
||||
|
||||
#define MENU_POPUPITEM 14
|
||||
#define MENU_POPUPSEPARATOR 15
|
||||
|
||||
static const LPCWSTR class_descriptors[] = {
|
||||
L"Scrollbar", /* XP_THEME_CLASS_SCROLLBAR */
|
||||
L"Button", /* XP_THEME_CLASS_BUTTON */
|
||||
@ -139,8 +149,8 @@ static const short element_part_map[XP_THEME_ELEMENT__SIZEOF] = {
|
||||
RP_GRIPPERVERT,
|
||||
RP_CHEVRON,
|
||||
TP_BUTTON,
|
||||
MP_MENUITEM,
|
||||
MP_SEPARATOR,
|
||||
MENU_POPUPITEM, /*MP_MENUITEM,*/
|
||||
MENU_POPUPSEPARATOR, /*MP_SEPARATOR,*/
|
||||
SP_GRIPPER,
|
||||
SP_PANE,
|
||||
GP_LINEHORZ,
|
||||
@ -780,12 +790,16 @@ xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state)
|
||||
ret = MS_SELECTED;
|
||||
break;
|
||||
|
||||
case GTK_STATE_PRELIGHT:
|
||||
ret = MBI_HOT;
|
||||
break;
|
||||
|
||||
case GTK_STATE_INSENSITIVE:
|
||||
ret = MS_DEMOTED;
|
||||
ret = MBI_DISABLED;
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = MS_NORMAL;
|
||||
ret = MBI_NORMAL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user