summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDom Lachowicz <cinamod@hotmail.com>2006-01-29 03:28:25 +0000
committerDom Lachowicz <doml@src.gnome.org>2006-01-29 03:28:25 +0000
commitcca151bab7ff3f26d0f3b613ce1661dcfe199826 (patch)
tree52b901a23f91e473b3ea4a97e93c49d9dbf92a61 /modules
parent40aa02249b9f527994e8d7f624bca28ef3aad93b (diff)
downloadgtk+-cca151bab7ff3f26d0f3b613ce1661dcfe199826.tar.gz
Re-sync with gtk-wimp Ditto
2006-01-28 Dom Lachowicz <cinamod@hotmail.com> * modules/engines/ms-windows/msw-style.c: Re-sync with gtk-wimp * modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: Ditto
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/engines/ms-windows/Theme/gtk-2.0/gtkrc16
-rwxr-xr-xmodules/engines/ms-windows/msw_style.c109
2 files changed, 122 insertions, 3 deletions
diff --git a/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc b/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc
index da1ad4bb49..92c8b4b038 100755
--- a/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc
+++ b/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc
@@ -23,7 +23,7 @@ style "msw-default"
#GtkComboBox::add-tearoffs = 0
GtkComboBox::appears-as-list = 1
- GtkComboBox::focus-on-click = 1
+ GtkComboBox::focus-on-click = 0
GOComboBox::add_tearoffs = 0
@@ -37,3 +37,17 @@ style "msw-default"
}
}
class "*" style "msw-default"
+
+style "msw-combobox-toggle" = "msw-default"
+{
+ xthickness = 0
+ ythickness = 0
+ GtkButton::default-border = { 0, 0, 0, 0 }
+ GtkButton::default-outside-border = { 0, 0, 0, 0 }
+ GtkButton::child-displacement-x = 0
+ GtkButton::child-displacement-y = 0
+ GtkWidget::focus-padding = 0
+ GtkWidget::focus-line-width = 0
+}
+widget_class "*ComboBox*ToggleButton*" style "msw-combobox-toggle"
+
diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c
index cd637ffa83..740255e16f 100755
--- a/modules/engines/ms-windows/msw_style.c
+++ b/modules/engines/ms-windows/msw_style.c
@@ -922,6 +922,91 @@ map_gtk_progress_bar_to_xp (GtkProgressBar * progress_bar, gboolean trough)
return ret;
}
+static gboolean
+is_combo_box_child (GtkWidget* w)
+{
+ GtkWidget* tmp;
+
+ if (w == NULL)
+ return FALSE;
+
+ for (tmp = w->parent; tmp; tmp = tmp->parent)
+ {
+ if (GTK_IS_COMBO_BOX(tmp))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+combo_box_draw_arrow (GtkStyle * style,
+ GdkWindow * window,
+ GtkStateType state,
+ GdkRectangle * area,
+ GtkWidget * widget)
+{
+ if (xp_theme_draw (window, XP_THEME_ELEMENT_COMBOBUTTON,
+ style, widget->allocation.x, widget->allocation.y,
+ widget->allocation.width, widget->allocation.height,
+ state, area))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* This is ugly because no box drawing function is invoked for the combo
+ box as a whole, so we draw part of the entire box in every subwidget.
+ We do this by finding the allocation of the combo box in the given
+ window's coordinates and drawing. The xp drawing routines take care
+ of the clipping. */
+static gboolean
+combo_box_draw_box (GtkStyle * style,
+ GdkWindow * window,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ GdkRectangle * area,
+ GtkWidget * widget,
+ const gchar * detail, gint x, gint y, gint width, gint height)
+{
+ GtkWidget* combo_box;
+ GdkRectangle combo_alloc;
+
+ if (!widget)
+ return FALSE;
+ for (combo_box = widget->parent; combo_box; combo_box = combo_box->parent)
+ {
+ if (GTK_IS_COMBO_BOX(combo_box))
+ break;
+ }
+ if (!combo_box)
+ return FALSE;
+
+ combo_alloc = combo_box->allocation;
+ if (window != combo_box->window)
+ {
+ GtkWidget* tmp;
+ for (tmp = widget; tmp && tmp != combo_box; tmp = widget->parent)
+ {
+ if (tmp->parent && tmp->window != tmp->parent->window)
+ {
+ combo_alloc.x -= tmp->allocation.x;
+ combo_alloc.y -= tmp->allocation.y;
+ }
+ }
+ }
+
+ if (xp_theme_draw (window, XP_THEME_ELEMENT_EDIT_TEXT,
+ style, combo_alloc.x, combo_alloc.y,
+ combo_alloc.width, combo_alloc.height,
+ state_type, area))
+ return TRUE;
+
+ return FALSE;
+}
+
static void
draw_part (GdkDrawable * drawable,
GdkGC * gc, GdkRectangle * area, gint x, gint y, Part part)
@@ -1294,6 +1379,14 @@ draw_arrow (GtkStyle * style,
sanitize_size (window, &width, &height);
+ if (GTK_IS_ARROW(widget) && is_combo_box_child(widget))
+ {
+ if (combo_box_draw_arrow (style, window, state, area, widget))
+ {
+ return;
+ }
+ }
+
if (detail && strcmp (detail, "spinbutton") == 0)
{
if (xp_theme_is_drawable (XP_THEME_ELEMENT_SPIN_BUTTON_UP))
@@ -1491,7 +1584,13 @@ draw_box (GtkStyle * style,
GtkWidget * widget,
const gchar * detail, gint x, gint y, gint width, gint height)
{
- if (detail &&
+ if (is_combo_box_child (widget)
+ && combo_box_draw_box (style, window, state_type, shadow_type,
+ area, widget, detail, x, y, width, height))
+ {
+ return;
+ }
+ else if (detail &&
(!strcmp (detail, "button") || !strcmp (detail, "buttondefault")))
{
if (GTK_IS_TREE_VIEW (widget->parent)
@@ -1736,7 +1835,7 @@ draw_box (GtkStyle * style,
{
return;
}
- }
+ }
else if (detail
&& (strcmp (detail, "vscrollbar") == 0
|| strcmp (detail, "hscrollbar") == 0))
@@ -2064,6 +2163,12 @@ draw_shadow (GtkStyle * style,
{
gboolean is_handlebox_grippie = (detail && !strcmp (detail, "handlebox"));
+ if (is_combo_box_child (widget)
+ && combo_box_draw_box (style, window, state_type, shadow_type,
+ area, widget, detail, x, y, width, height))
+ {
+ return;
+ }
if (detail && !strcmp (detail, "entry"))
{
if (xp_theme_draw (window, XP_THEME_ELEMENT_EDIT_TEXT, style,