/* Default values, not normally used
*/
-static GtkRequisition default_option_indicator_size = { 9, 8 };
-static GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 };
+static const GtkRequisition default_option_indicator_size = { 9, 8 };
+static const GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 };
static GtkStyleClass *parent_class;
static gboolean
get_system_font(SystemFontType type, LOGFONT *out_lf)
{
- gboolean ok;
-
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
- ok = SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
- sizeof(NONCLIENTMETRICS), &ncm, 0);
- if (ok)
+
+ if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
+ sizeof(NONCLIENTMETRICS), &ncm, 0))
{
- if (type == CAPTION_FONT)
- *out_lf = ncm.lfCaptionFont;
- else if (type == MENU_FONT)
- *out_lf = ncm.lfMenuFont;
- else if (type == STATUS_FONT)
- *out_lf = ncm.lfStatusFont;
- else
- *out_lf = ncm.lfMessageFont;
+ if (type == CAPTION_FONT)
+ *out_lf = ncm.lfCaptionFont;
+ else if (type == MENU_FONT)
+ *out_lf = ncm.lfMenuFont;
+ else if (type == STATUS_FONT)
+ *out_lf = ncm.lfStatusFont;
+ else
+ *out_lf = ncm.lfMessageFont;
+
+ return TRUE;
}
- return ok;
+ return FALSE;
}
static char *
return NULL;
}
+static void
+setup_system_settings (GtkStyle * style)
+{
+ GtkSettings * settings;
+ int menu_delay, cursor_blink_time;
+ gboolean win95 = FALSE;
+
+ settings = gtk_settings_get_default ();
+ if (!settings)
+ return;
+
+ cursor_blink_time = GetCaretBlinkTime ();
+ g_object_set (G_OBJECT (settings), "gtk-cursor-blink",
+ cursor_blink_time > 0, NULL);
+
+ if (cursor_blink_time > 0)
+ {
+ g_object_set (G_OBJECT (settings), "gtk-cursor-blink-time",
+ cursor_blink_time, NULL);
+ }
+
+ g_object_set (G_OBJECT (settings), "gtk-double-clink-time",
+ GetDoubleClickTime(), NULL);
+ g_object_set (G_OBJECT (settings), "gtk-dnd-drag-threshold",
+ GetSystemMetrics (SM_CXDRAG), NULL);
+
+#if 0
+ /* TODO: there's an ICONMETRICS struct that we should probably use instead */
+ g_object_set (G_OBJECT (settings), "gtk-toolbar-icon-size",
+ GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
+
+ g_object_set (G_OBJECT (settings), "gtk-icon-sizes",
+ "gtk-menu=10,10", NULL);
+
+ {
+ OSVERSIONINFOEX osvi;
+
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+
+ if (!GetVersionEx ( (OSVERSIONINFO *) &osvi))
+ win95 = TRUE; /* assume the worst */
+
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
+ win95 = TRUE;
+ }
+
+ if (!win95) {
+ if (SystemParametersInfo (SPI_GETMENUSHOWDELAY, 0, &menu_delay, 0)) {
+ g_object_set (G_OBJECT (settings), "gtk-menu-bar-popup-delay",
+ menu_delay, NULL);
+ g_object_set (G_OBJECT (settings), "gtk-menu-popdown-delay",
+ menu_delay, NULL);
+ g_object_set (G_OBJECT (settings), "gtk-menu-popup-delay",
+ menu_delay, NULL);
+ }
+ }
+#endif
+
+ /*
+ http://developer.gnome.org/doc/API/2.0/gtk/GtkSettings.html
+ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/systemparametersinfo.asp
+ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsystemmetrics.asp
+ */
+}
+
static void
setup_system_font(GtkStyle *style)
{
TODO: use GetThemeMetric for the border and outside border */
sprintf(buf, "style \"wimp-button\" = \"wimp-default\"\n"
"{fg[NORMAL] = { %d, %d, %d }\n"
- "GtkButton::default_border = { 1, 1, 1, 1 }\n"
- "GtkButton::default_outside_border = { 0, 0, 0, 0 }\n"
- "GtkButton::child_displacement_x = 1\n"
- "GtkButton::child_displacement_y = 1\n"
+ "GtkButton::default-border = { 1, 1, 1, 1 }\n"
+ "GtkButton::default-outside-border = { 0, 0, 0, 0 }\n"
+ "GtkButton::child-displacement-x = 1\n"
+ "GtkButton::child-displacement-y = 1\n"
"}widget_class \"*GtkButton*\" style \"wimp-button\"\n",
btn_fore.red,
btn_fore.green,
if (xp_theme_draw(window, shadow == GTK_SHADOW_IN
? XP_THEME_ELEMENT_PRESSED_CHECKBOX
: XP_THEME_ELEMENT_CHECKBOX,
- style, x, y, width, height, state))
+ style, x, y, width, height, state, area))
{
}
else
if (xp_theme_draw(window, xp_expander, style,
x, y - expander_size / 2,
- expander_size, expander_size, state))
+ expander_size, expander_size, state, area))
{
return;
}
{
if (xp_theme_draw(window,
XP_THEME_ELEMENT_RADIO_BUTTON, style,
- x, y, width, height, state))
+ x, y, width, height, state, area))
{
}
else
*height = box_height;
}
-
static void
draw_arrow (GtkStyle *style,
GdkWindow *window,
xp_arrow = XP_THEME_ELEMENT_ARROW_RIGHT;
break;
}
- if (xp_theme_draw(window, xp_arrow, style, box_x, box_y, box_width, box_height, state))
+ if (xp_theme_draw(window, xp_arrow, style, box_x, box_y, box_width, box_height, state, area))
{
}
else if (arrow_type == GTK_ARROW_UP || arrow_type == GTK_ARROW_DOWN)
/* draw the toolbar chevrons - waiting for GTK 2.4 */
if (name && !strcmp (name, "gtk-toolbar-arrow"))
{
- if (xp_theme_draw(window, XP_THEME_ELEMENT_CHEVRON, style, x, y, width, height, state))
+ if (xp_theme_draw(window, XP_THEME_ELEMENT_CHEVRON, style, x, y, width, height, state, area))
return;
}
if (GTK_IS_TREE_VIEW (widget->parent) || GTK_IS_CLIST (widget->parent))
{
if (xp_theme_draw(window, XP_THEME_ELEMENT_LIST_HEADER, style, x, y,
- width, height, state_type))
+ width, height, state_type, area))
return;
}
else
gboolean is_default = !strcmp (detail, "buttondefault");
if (xp_theme_draw(window, is_default ? XP_THEME_ELEMENT_DEFAULT_BUTTON
: XP_THEME_ELEMENT_BUTTON, style, x, y,
- width, height, state_type))
+ width, height, state_type, area))
return;
}
}
(! strcmp (detail, "spinbutton_up"))
? XP_THEME_ELEMENT_SPIN_BUTTON_UP
: XP_THEME_ELEMENT_SPIN_BUTTON_DOWN,
- style, x, y, width, height, state_type))
+ style, x, y, width, height, state_type, area))
{
return;
}
(! GTK_IS_VSCROLLBAR(widget))
? XP_THEME_ELEMENT_SCROLLBAR_V
: XP_THEME_ELEMENT_SCROLLBAR_H,
- style, x, y, width, height, state_type))
+ style, x, y, width, height, state_type, area))
{
return;
}
GtkProgressBar *progress_bar = GTK_PROGRESS_BAR(widget);
XpThemeElement xp_progress_bar = map_gtk_progress_bar_to_xp (progress_bar, FALSE);
if (xp_theme_draw (window, xp_progress_bar,
- style, x, y, width, height, state_type))
+ style, x, y, width, height, state_type, area))
{
return;
}
}
}
else if (detail && !strcmp (detail, "handlebox_bin")) {
- if (xp_theme_draw (window, XP_THEME_ELEMENT_REBAR, style, x, y, width, height, state_type))
+ if (xp_theme_draw (window, XP_THEME_ELEMENT_REBAR, style, x, y, width, height, state_type, area))
{
return;
}
}
else if (name && !strcmp (name, "gtk-tooltips")) {
- if (xp_theme_draw (window, XP_THEME_ELEMENT_TOOLTIP, style, x, y, width, height, state_type))
+ if (xp_theme_draw (window, XP_THEME_ELEMENT_TOOLTIP, style, x, y, width, height, state_type, area))
{
return;
}
GtkProgressBar *progress_bar = GTK_PROGRESS_BAR(widget);
XpThemeElement xp_progress_bar = map_gtk_progress_bar_to_xp (progress_bar, TRUE);
if (xp_theme_draw (window, xp_progress_bar,
- style, x, y, width, height, state_type))
+ style, x, y, width, height, state_type, area))
{
return;
}
? XP_THEME_ELEMENT_TROUGH_V
: XP_THEME_ELEMENT_TROUGH_H,
style,
- x, y, width, height, state_type))
+ x, y, width, height, state_type, area))
{
return;
}
else if (detail && strcmp (detail, "optionmenu") == 0)
{
if (xp_theme_draw(window, XP_THEME_ELEMENT_EDIT_TEXT,
- style, x, y, width, height, state_type))
+ style, x, y, width, height, state_type, area))
{
return;
}
{
if (xp_theme_draw(window, XP_THEME_ELEMENT_COMBOBUTTON,
style, x-5, widget->allocation.y+1,
- width+10, widget->allocation.height-2, state))
+ width+10, widget->allocation.height-2, state, area))
{
return;
}
gtk_notebook_get_current_page(notebook)==0
? XP_THEME_ELEMENT_TAB_ITEM_LEFT_EDGE
: XP_THEME_ELEMENT_TAB_ITEM,
- style, x, y, width, height, state_type))
+ style, x, y, width, height, state_type, area))
{
return;
}
{
GtkNotebook *notebook = GTK_NOTEBOOK(widget);
- /* FIXME: pos != TOP to be implemented */
+ /* FIXME: pos != TOP to be implemented */
if (gtk_notebook_get_tab_pos(notebook) == GTK_POS_TOP && xp_theme_draw(window, XP_THEME_ELEMENT_TAB_PANE, style, x, y, width, height,
- state_type))
+ state_type, area))
{
return;
}
if(detail && ! strcmp(detail, "entry"))
{
if (xp_theme_draw(window, XP_THEME_ELEMENT_EDIT_TEXT, style,
- x, y, width, height, state_type))
+ x, y, width, height, state_type, area))
{
return;
}
gint x2,
gint y)
{
- /* TODO: GP_LINEHORIZ : LHS_FLAT, LHS_RAISED, LHS_SUNKEN*/
- parent_class->draw_hline (style, window, state_type, area, widget,
- detail, x1, x2, y);
+#if UXTHEME_HAS_LINES
+ if (xp_theme_draw(window, XP_THEME_ELEMENT_HLINE, style, x1, y, x2,
+ style->ythickness, state_type, area))
+ {
+ }
+ else
+#endif
+ {
+ parent_class->draw_hline (style, window, state_type, area, widget,
+ detail, x1, x2, y);
+ }
}
static void
gint y2,
gint x)
{
- /* TODO: GP_LINEVERT : LVS_FLAT, LVS_RAISED, LVS_SUNKEN */
- parent_class->draw_vline (style, window, state_type, area, widget,
- detail, y1, y2, x);
+#if UXTHEME_HAS_LINES
+ if (xp_theme_draw(window, XP_THEME_ELEMENT_VLINE, style, x, y1,
+ style->xthickness, y2, state_type, area))
+ {
+ }
+ else
+#endif
+ {
+ parent_class->draw_vline (style, window, state_type, area, widget,
+ detail, y1, y2, x);
+ }
}
static void
else
hndl = XP_THEME_ELEMENT_GRIPPER_H;
- if (xp_theme_draw(window, hndl, style, x, y, width, height, state_type))
+ if (xp_theme_draw(window, hndl, style, x, y, width, height, state_type, area))
{
return;
}
{
setup_system_font (style);
setup_system_styles (style);
+ setup_system_settings (style);
parent_class->init_from_rc(style, rc_style);
}
"WimpStyle",
&object_info, 0);
}
-