re-sync with gtk-wimp's cvs repository

This commit is contained in:
Dom Lachowicz 2005-06-03 19:54:03 +00:00
parent 66ba57b637
commit d751518bd7
6 changed files with 132 additions and 24 deletions

View File

@ -1,3 +1,9 @@
2005-06-03 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/msw_style.c: Re-sync with gtk-wimp
* modules/engines/ms-windows/xp_theme.c: Ditto
* modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: Ditto
Thu May 26 16:43:27 2005 Manish Singh <yosh@gimp.org>
* gtk/gtkentrycompletion.h: Add declarations for

View File

@ -1,3 +1,9 @@
2005-06-03 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/msw_style.c: Re-sync with gtk-wimp
* modules/engines/ms-windows/xp_theme.c: Ditto
* modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: Ditto
Thu May 26 16:43:27 2005 Manish Singh <yosh@gimp.org>
* gtk/gtkentrycompletion.h: Add declarations for

View File

@ -1,3 +1,9 @@
2005-06-03 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/msw_style.c: Re-sync with gtk-wimp
* modules/engines/ms-windows/xp_theme.c: Ditto
* modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: Ditto
Thu May 26 16:43:27 2005 Manish Singh <yosh@gimp.org>
* gtk/gtkentrycompletion.h: Add declarations for

View File

@ -1,22 +1,40 @@
gtk-icon-sizes="gtk-menu=14,14:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32"
gtk-toolbar-icon-size=large-toolbar
gtk-button-images=0
gtk-alternative-button-order=1
gtk-icon-sizes = "gtk-menu=13,13:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32"
gtk-toolbar-icon-size = small-toolbar
# disable images in buttons. i've only seen ugly delphi apps use this feature.
gtk-button-images = 0
# enable/disable images in menus. most "stock" microsoft apps don't use these, except sparingly.
# the office apps use them heavily, though.
gtk-menu-images = 1
# use the win32 button ordering instead of the GNOME HIG one, where applicable
gtk-alternative-button-order = 1
style "msw-default"
{
GtkWidget::interior_focus = 1
GtkOptionMenu::indicator_size = { 9, 5 }
GtkOptionMenu::indicator_spacing = { 7, 5, 2, 2 }
GtkToolbar::shadow-type = etched-in
GtkHandleBox::shadow-type = etched-in
GtkWidget::interior-focus = 1
GtkOptionMenu::indicator-size = { 9, 5 }
GtkOptionMenu::indicator-spacing = { 7, 5, 2, 2 }
GtkSpinButton::shadow-type = in
GtkComboBox::add-tearoffs = false
# Owen and I disagree that these should be themable
#GtkUIManager::add-tearoffs = 0
#GtkComboBox::add-tearoffs = 0
GtkComboBox::appears-as-list = 1
GtkComboBox::focus-on-click = 1
GOComboBox::add_tearoffs = 0
GtkTreeView::allow-rules = 0
GtkTreeView::expander_size = 11
GtkUIManager::add-tearoffs = false
GtkTreeView::expander-size = 12
# etched-in is closer to how Win32's explorer.exe does things, but it makes apps with
# multiple toolbars or a menubar and a toolbar look like garbage
GtkToolbar::shadow-type = out
GtkHandleBox::shadow-type = out
engine "wimp"
{
}

View File

@ -20,6 +20,13 @@
* Boston, MA 02111-1307, USA.
*/
/*
* Useful resources:
*
* http://lxr.mozilla.org/mozilla/source/gfx/src/windows/nsNativeThemeWin.cpp
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/functions/drawthemebackground.asp
*/
#include "msw_style.h"
#include "xp_theme.h"
@ -30,6 +37,7 @@
#include "gtk/gtk.h"
#include "gtk/gtk.h"
/* #include <gdk/gdkwin32.h> */
#include "gdk/win32/gdkwin32.h"
@ -148,7 +156,7 @@ get_system_font(XpThemeClass klazz, XpThemeFont type, LOGFONT *out_lf)
return FALSE;
}
/***************************** STOLEN FROM PANGO *****************************/
/***************************** BEGIN STOLEN FROM PANGO *****************************/
/*
This code is stolen from Pango 1.4. It attempts to address the following problems:
@ -200,7 +208,7 @@ struct name_record
guint16 string_offset;
};
gboolean
static gboolean
pango_win32_get_name_header (HDC hdc,
struct name_header *header)
{
@ -213,7 +221,7 @@ pango_win32_get_name_header (HDC hdc,
return TRUE;
}
gboolean
static gboolean
pango_win32_get_name_record (HDC hdc,
gint i,
struct name_record *record)
@ -356,7 +364,7 @@ get_family_name (LOGFONT *lfp, HDC pango_win32_hdc)
return g_locale_to_utf8 (lfp->lfFaceName, -1, NULL, NULL, NULL);
}
/***************************** STOLEN FROM PANGO *****************************/
/***************************** END STOLEN FROM PANGO *****************************/
static char *
sys_font_to_pango_font (XpThemeClass klazz, XpThemeFont type, char * buf, size_t bufsiz)
@ -485,14 +493,12 @@ msw_style_setup_system_settings (void)
g_object_set (settings, "gtk-cursor-blink", cursor_blink_time > 0, NULL);
if (cursor_blink_time > 0)
{
g_object_set (settings, "gtk-cursor-blink-time", 2*cursor_blink_time,
NULL);
}
g_object_set (settings, "gtk-double-click-distance", GetSystemMetrics(SM_CXDOUBLECLK), NULL);
g_object_set (settings, "gtk-double-click-time", GetDoubleClickTime(), NULL);
g_object_set (settings, "gtk-dnd-drag-threshold", GetSystemMetrics(SM_CXDRAG),
NULL);
g_object_set (settings, "gtk-dnd-drag-threshold", GetSystemMetrics(SM_CXDRAG), NULL);
setup_menu_settings (settings);
@ -627,7 +633,7 @@ setup_msw_rc_style(void)
"style \"msw-menu-bar\" = \"msw-menu\"\n"
"{\n"
"bg[NORMAL] = { %d, %d, %d }\n"
"GtkMenuBar::shadow-type = etched-in\n"
"GtkMenuBar::shadow-type = out\n"
"}widget_class \"*MenuBar*\" style \"msw-menu-bar\"\n",
btn_face.red,
btn_face.green,
@ -1272,7 +1278,7 @@ draw_arrow (GtkStyle *style,
return;
}
/* probably a gtk combo box on a toolbar */
else if (widget->parent && GTK_IS_BUTTON (widget->parent))
else if (0 /*widget->parent && GTK_IS_BUTTON (widget->parent)*/)
{
if (xp_theme_draw(window, XP_THEME_ELEMENT_COMBOBUTTON, style, x-3, widget->allocation.y+1,
width+5, widget->allocation.height-4, state, area))
@ -1547,6 +1553,14 @@ draw_box (GtkStyle *style,
if (scrollbar->range.adjustment->page_size >= (scrollbar->range.adjustment->upper-scrollbar->range.adjustment->lower))
shadow_type = GTK_SHADOW_OUT;
}
else if (detail && strcmp (detail, "handlebox_bin") == 0)
{
if (xp_theme_draw(window, XP_THEME_ELEMENT_REBAR,
style, x, y, width, height, state_type, area))
{
return;
}
}
else
{
const gchar * name = gtk_widget_get_name (widget);
@ -1556,6 +1570,39 @@ draw_box (GtkStyle *style,
{
return;
}
else {
HBRUSH brush;
gint xoff, yoff;
GdkDrawable *drawable;
RECT rect;
HDC hdc;
if (!GDK_IS_WINDOW(window))
{
xoff = 0;
yoff = 0;
drawable = window;
}
else
{
gdk_window_get_internal_paint_info(window, &drawable, &xoff, &yoff);
}
rect.left = x - xoff;
rect.top = y - yoff;
rect.right = rect.left + width;
rect.bottom = rect.top + height;
hdc = gdk_win32_hdc_get(window, style->dark_gc[state_type], 0);
brush = GetSysColorBrush(COLOR_3DDKSHADOW);
if (brush)
FrameRect(hdc, &rect, brush);
InflateRect(&rect, -1, -1);
FillRect(hdc, &rect, (HBRUSH) (COLOR_INFOBK+1));
return;
}
}
}
@ -1800,9 +1847,12 @@ draw_resize_grip (GtkStyle *style,
gint height)
{
if (detail && !strcmp(detail, "statusbar")) {
#if 0
/* DAL: TODO: find out why this regressed */
if (xp_theme_draw(window, XP_THEME_ELEMENT_STATUS_GRIPPER, style, x, y, width, height,
state_type, area))
return;
#endif
}
parent_class->draw_resize_grip (style, window, state_type, area,

View File

@ -22,12 +22,16 @@
#include "xp_theme.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <windows.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
/* #include "gdk/gdkwin32.h" */
#include "gdk/win32/gdkwin32.h"
#ifdef HAVE_UXTHEME_H
@ -129,6 +133,8 @@ typedef HRESULT (FAR PASCAL *DrawThemeBackgroundFunc)
typedef HRESULT (FAR PASCAL *EnableThemeDialogTextureFunc)(HWND hwnd, DWORD dwFlags);
typedef BOOL (FAR PASCAL *IsThemeActiveFunc)(VOID);
typedef BOOL (FAR PASCAL *IsAppThemedFunc)(VOID);
typedef BOOL (FAR PASCAL *IsThemeBackgroundPartiallyTransparentFunc)(HTHEME hTheme, int iPartId, int iStateId);
typedef HRESULT (FAR PASCAL *DrawThemeParentBackgroundFunc)(HWND hwnd, HDC hdc, RECT *prc);
static GetThemeSysFontFunc get_theme_sys_font_func = NULL;
static GetThemeSysColorFunc get_theme_sys_color_func = NULL;
@ -139,6 +145,8 @@ static DrawThemeBackgroundFunc draw_theme_background_func = NULL;
static EnableThemeDialogTextureFunc enable_theme_dialog_texture_func = NULL;
static IsThemeActiveFunc is_theme_active_func = NULL;
static IsAppThemedFunc is_app_themed_func = NULL;
static IsThemeBackgroundPartiallyTransparentFunc is_theme_partially_transparent_func = NULL;
static DrawThemeParentBackgroundFunc draw_theme_parent_background_func = NULL;
static void
xp_theme_close_open_handles (void)
@ -179,6 +187,8 @@ xp_theme_init (void)
get_theme_sys_font_func = (GetThemeSysFontFunc) GetProcAddress(uxtheme_dll, "GetThemeSysFont");
get_theme_sys_color_func = (GetThemeSysColorFunc) GetProcAddress(uxtheme_dll, "GetThemeSysColor");
get_theme_sys_metric_func = (GetThemeSysSizeFunc) GetProcAddress(uxtheme_dll, "GetThemeSysSize");
is_theme_partially_transparent_func = (IsThemeBackgroundPartiallyTransparentFunc) GetProcAddress(uxtheme_dll, "IsThemeBackgroundPartiallyTransparent");
draw_theme_parent_background_func = (DrawThemeParentBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeParentBackground");
}
}
@ -208,6 +218,8 @@ xp_theme_exit (void)
get_theme_sys_font_func = NULL;
get_theme_sys_color_func = NULL;
get_theme_sys_metric_func = NULL;
is_theme_partially_transparent_func = NULL;
draw_theme_parent_background_func = NULL;
}
static HTHEME
@ -325,7 +337,7 @@ xp_theme_get_handle_by_element (XpThemeElement element)
static int
xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state)
{
int ret;
int ret = 0;
switch(element)
{
@ -334,6 +346,9 @@ xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state)
break;
case XP_THEME_ELEMENT_REBAR:
ret = 0;
break;
case XP_THEME_ELEMENT_REBAR_GRIPPER_H:
case XP_THEME_ELEMENT_REBAR_GRIPPER_V:
ret = CHEVS_NORMAL;
@ -671,6 +686,7 @@ xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style,
{
gdk_window_get_internal_paint_info(win, &drawable, &xoff, &yoff);
}
rect.left = x - xoff;
rect.top = y - yoff;
rect.right = rect.left + width;
@ -712,6 +728,12 @@ xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style,
}
#endif
if (is_theme_partially_transparent_func && draw_theme_parent_background_func &&
is_theme_partially_transparent_func(theme, element_part_map[element], part_state))
{
draw_theme_parent_background_func(GDK_WINDOW_HWND(win), dc, pClip);
}
draw_theme_background_func(theme, dc, element_part_map[element], part_state, &rect, pClip);
gdk_win32_hdc_release(drawable, style->dark_gc[state_type], 0);