From 98eb5b995addf1bd754412065a090adb809309ab Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 11 Nov 2012 17:26:20 -0600 Subject: [PATCH] Additional scrollbar fixes --- tdegtk/tdegtk-draw.cpp | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp index 3f616ca..71d704a 100644 --- a/tdegtk/tdegtk-draw.cpp +++ b/tdegtk/tdegtk-draw.cpp @@ -415,7 +415,7 @@ void gtkScrollbarToScrollbarCeData(GtkScrollbar* scrollbarWidget, TQStyleControl // Convert the GTK slider length into a correct pagestep that TQt3 can use to obtain the same slider length value bool threeButtonScrollBar = false; - if (m_scrollbarBack2 | m_scrollbarForward2) threeButtonScrollBar = true; + if (m_scrollbarForward1 | m_scrollbarBack2) threeButtonScrollBar = true; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; int gtkSliderLength = slider_end_pos - slider_start_pos; uint range = ceData.maxSteps - ceData.minSteps; @@ -696,6 +696,17 @@ draw_scrollbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, first = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarFirst); last = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, ceData, elementFlags, TQStyle::SC_ScrollBarLast); + bool threeButtonScrollBar = false; + if (m_scrollbarForward1 | m_scrollbarBack2) threeButtonScrollBar = true; + if (threeButtonScrollBar) { + if (ceData.orientation == TQt::Horizontal) { + addline = TQRect(allocation.width-(subline.width()*2), subline.y(), subline.width()*2, subline.height()); + } + else { + addline = TQRect(subline.x(), allocation.height-(subline.height()*2), subline.width(), subline.height()*2); + } + } + // HACK // This may not be 100% reliable! GdkModifierType mouseStateFlags; @@ -703,7 +714,6 @@ draw_scrollbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, bool mousedown = (mouseStateFlags & GDK_BUTTON1_MASK); if (mousedown) { - bool combine_addlineregion_drawing_areas = tqApp->style().styleHint(TQStyle::SH_ScrollBar_CombineAddLineRegionDrawingAreas); if (lastSliderActiveSubControl != TQStyle::SC_None) { activeSubControl = (TQStyle::SubControl)(activeSubControl | lastSliderActiveSubControl); } @@ -713,17 +723,23 @@ draw_scrollbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, lastSliderActiveSubControl = TQStyle::SC_ScrollBarSubLine; } else if (addline.contains(cursor_pos)) { - // Not so fast...the addline region may contain a subline control! - TQRect internalSubLine; - if (ceData.orientation == TQt::Horizontal) { - internalSubLine = TQRect(addline.x(), addline.y(), addline.width()/2, addline.height()); - } - else { - internalSubLine = TQRect(addline.x(), addline.y(), addline.width(), addline.height()/2); - } - if (internalSubLine.contains(cursor_pos)) { - activeSubControl = (TQStyle::SubControl)(activeSubControl | TQStyle::SC_ScrollBarSubLine); - lastSliderActiveSubControl = TQStyle::SC_ScrollBarSubLine; + if (threeButtonScrollBar) { + // Not so fast...the addline region may contain a subline control! + TQRect internalSubLine; + if (ceData.orientation == TQt::Horizontal) { + internalSubLine = TQRect(addline.x(), addline.y(), addline.width()/2, addline.height()); + } + else { + internalSubLine = TQRect(addline.x(), addline.y(), addline.width(), addline.height()/2); + } + if (internalSubLine.contains(cursor_pos)) { + activeSubControl = (TQStyle::SubControl)(activeSubControl | TQStyle::SC_ScrollBarSubLine); + lastSliderActiveSubControl = TQStyle::SC_ScrollBarSubLine; + } + else { + activeSubControl = (TQStyle::SubControl)(activeSubControl | TQStyle::SC_ScrollBarAddLine); + lastSliderActiveSubControl = TQStyle::SC_ScrollBarAddLine; + } } else { activeSubControl = (TQStyle::SubControl)(activeSubControl | TQStyle::SC_ScrollBarAddLine);