From 469e7d600f4d801ca53547b28a981688dcb0a60e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 3 Nov 2012 17:59:02 -0500 Subject: Fix scrollbars and buttons --- tdegtk/tdegtk-theme.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'tdegtk/tdegtk-theme.cpp') diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp index 79763b6..40c96c3 100644 --- a/tdegtk/tdegtk-theme.cpp +++ b/tdegtk/tdegtk-theme.cpp @@ -41,6 +41,8 @@ bool tde_showIconsOnPushButtons = false; void initTDESettings(); void writeGtkThemeControlFile(int forceRecreate); +int m_scrollBarSubLineWidth = -1; + extern "C" { #include #include @@ -603,26 +605,28 @@ void writeGtkThemeControlFile(int forceRecreate) { stream << parse_rc_string(TQString("-GtkScrollbar-has-secondary-forward-stepper: ") + (forward1 ? "1" : "0"), "*"); stream << parse_rc_string(TQString("-GtkScrollbar-has-secondary-backward-stepper: ") + (back2 ? "1" : "0"), "*"); - stream << parse_rc_string("-GtkScrollbar-stepper-size: " + TQString::number(tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, &sbar, TQStyle::SC_ScrollBarSubLine).width() - 1), "*"); + m_scrollBarSubLineWidth = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, &sbar, TQStyle::SC_ScrollBarSubLine).width() - 1; - stream << parse_rc_string("-GtkScrollbar-min-slider-length: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarSliderMin)), "*"); + stream << parse_rc_string("-GtkRange-stepper-size: " + TQString::number(m_scrollBarSubLineWidth), "GtkScrollbar"); stream << parse_rc_string("-GtkRange-slider-width: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarExtent)), "GtkScrollbar"); - stream << parse_rc_string("-GtkRange-stepper-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarExtent)), "GtkScrollbar"); stream << parse_rc_string("-GtkRange-trough-border: 0", "GtkScrollbar"); + stream << parse_rc_string("-GtkRange-trough-under-steppers: 1", "GtkScrollbar"); + stream << parse_rc_string("-GtkScrollbar-min-slider-length: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ScrollBarSliderMin)), "*"); - { - //stream << parse_rc_string("-GtkRange-slider-width: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_SliderControlThickness, ceData, elementFlags)), "GtkScale"); - //stream << parse_rc_string("-GtkRange-stepper-size: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_SliderControlThickness)), "GtkScale"); + // FIXME + // This is currently set to the scrollbar stepper button size, as TQt3 does not have the concept of a stepper for a TQSlider + stream << parse_rc_string("-GtkRange-stepper-size: " + TQString::number(m_scrollBarSubLineWidth), "GtkScale"); - // FIXME - // These are hardcoded for now as TQt3 does not easily give up its slider sizes - // We need to read the Gtk slider width for this to make any sense! - // Also, GTK does not seem to be able to set a minimum slider length at this time - stream << parse_rc_string("-GtkRange-slider-width: " + TQString::number(20), "GtkScale"); - } + TQSlider slider(NULL); // To keep BlueCurve happy + stream << parse_rc_string("-GtkRange-slider-width: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_SliderThickness, &slider)), "GtkScale"); + stream << parse_rc_string("-GtkScale-slider-length: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_SliderLength, &slider)), "*"); stream << parse_rc_string("-GtkButton-child-displacement-x: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftHorizontal)), "*"); stream << parse_rc_string("-GtkButton-child-displacement-y: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftVertical)), "*"); + stream << parse_rc_string("-GtkRange-arrow-displacement-x: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftHorizontal)), "*"); + stream << parse_rc_string("-GtkRange-arrow-displacement-y: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_ButtonShiftVertical)), "*"); + stream << parse_rc_string("-GtkRange-arrow-displacement-x: " + TQString::number(0), "GtkScrollbar"); + stream << parse_rc_string("-GtkRange-arrow-displacement-y: " + TQString::number(0), "GtkScrollbar"); stream << parse_rc_string("-GtkButton-default-border: 0 0 0 0", "*"); stream << parse_rc_string("-GtkButton-default-outside-border: 0 0 0 0", "*"); #ifdef USE_NATIVE_GTK_BUTTON_DRAWING @@ -640,9 +644,6 @@ void writeGtkThemeControlFile(int forceRecreate) { stream << parse_rc_string("-GtkButtonBox-child_internal_pad_x: 0", "*"); stream << parse_rc_string("-GtkButtonBox-child_internal_pad_y: 0", "*"); - TQSlider slider(NULL); // To keep BlueCurve happy - stream << parse_rc_string("-GtkScale-slider-length: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_SliderLength, &slider)), "*"); - stream << parse_rc_string("-GtkRange-arrow-scaling: 1.0", "GtkScrollbar"); stream << parse_rc_string("-xthickness: " + TQString::number(tqApp->style().pixelMetric(TQStyle::PM_DefaultFrameWidth)), "*.GtkMenu"); @@ -704,6 +705,11 @@ void writeGtkThemeControlFile(int forceRecreate) { stream << parse_rc_string("padding: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkList>*>GtkButton"); stream << parse_rc_string("border-width: " + TQString::number(0) + "px " + TQString::number(0) + "px", "GtkList>*>GtkButton"); + // Ensure group boxes are not cut off by their labels + // FIXME + // Where do these 2px values actually come from? + stream << parse_rc_string("padding: " + TQString::number(2) + "px " + TQString::number(2) + "px", "GtkFrame"); + // Separators appear to be hardcoded to 1px high in TQt3 // Anything else will cause a silent drawing failure! stream << parse_rc_string("-GtkWidget-separator-height: " + TQString::number(1), "*"); -- cgit v1.2.3