void RenderThemeGtk::adjustSliderThumbSize(RenderObject* o) const { ControlPart part = o->style()->appearance(); #if ENABLE(VIDEO) if (part == MediaSliderThumbPart) { o->style()->setWidth(Length(m_mediaSliderThumbWidth, Fixed)); o->style()->setHeight(Length(m_mediaSliderThumbHeight, Fixed)); return; } if (part == MediaVolumeSliderThumbPart) return; #endif GtkWidget* widget = part == SliderThumbHorizontalPart ? gtkHScale() : gtkVScale(); int length = 0, width = 0; gtk_widget_style_get(widget, "slider_length", &length, "slider_width", &width, NULL); if (part == SliderThumbHorizontalPart) { o->style()->setWidth(Length(length, Fixed)); o->style()->setHeight(Length(width, Fixed)); return; } ASSERT(part == SliderThumbVerticalPart); o->style()->setWidth(Length(width, Fixed)); o->style()->setHeight(Length(length, Fixed)); }
bool RenderThemeGtk::paintSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect) { if (info.context->paintingDisabled()) return false; ControlPart part = object->style()->appearance(); ASSERT(part == SliderHorizontalPart || part == SliderVerticalPart); // We shrink the trough rect slightly to make room for the focus indicator. IntRect troughRect(IntPoint(), rect.size()); // This is relative to rect. GtkWidget* widget = 0; if (part == SliderVerticalPart) { widget = gtkVScale(); troughRect.inflateY(-gtk_widget_get_style(widget)->ythickness); } else { widget = gtkHScale(); troughRect.inflateX(-gtk_widget_get_style(widget)->xthickness); } gtk_widget_set_direction(widget, gtkTextDirection(object->style()->direction())); WidgetRenderingContext widgetContext(info.context, rect); widgetContext.gtkPaintBox(troughRect, widget, GTK_STATE_ACTIVE, GTK_SHADOW_OUT, "trough"); if (isFocused(object)) widgetContext.gtkPaintFocus(IntRect(IntPoint(), rect.size()), widget, getGtkStateType(object), "trough"); return false; }
bool RenderThemeGtk::paintSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect) { if (info.context->paintingDisabled()) return false; ControlPart part = object->style()->appearance(); ASSERT(part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart); GtkWidget* widget = 0; const char* detail = 0; GtkOrientation orientation; if (part == SliderThumbVerticalPart) { widget = gtkVScale(); detail = "vscale"; orientation = GTK_ORIENTATION_VERTICAL; } else { widget = gtkHScale(); detail = "hscale"; orientation = GTK_ORIENTATION_HORIZONTAL; } gtk_widget_set_direction(widget, gtkTextDirection(object->style()->direction())); // Only some themes have slider thumbs respond to clicks and some don't. This information is // gathered via the 'activate-slider' property, but it's deprecated in GTK+ 2.22 and removed in // GTK+ 3.x. The drawback of not honoring it is that slider thumbs change color when you click // on them. IntRect thumbRect(IntPoint(), rect.size()); WidgetRenderingContext widgetContext(info.context, rect); widgetContext.gtkPaintSlider(thumbRect, widget, getGtkStateType(object), GTK_SHADOW_OUT, detail, orientation); return false; }
void RenderThemeGtk::adjustSliderThumbSize(RenderStyle* style, Element*) const { ControlPart part = style->appearance(); if (part != SliderThumbHorizontalPart && part != SliderThumbVerticalPart) return; GtkWidget* widget = part == SliderThumbHorizontalPart ? gtkHScale() : gtkVScale(); int length = 0, width = 0; gtk_widget_style_get(widget, "slider_length", &length, "slider_width", &width, NULL); if (part == SliderThumbHorizontalPart) { style->setWidth(Length(length, Fixed)); style->setHeight(Length(width, Fixed)); return; } ASSERT(part == SliderThumbVerticalPart || part == MediaVolumeSliderThumbPart); style->setWidth(Length(width, Fixed)); style->setHeight(Length(length, Fixed)); }