[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-usability
Subject:    Re: Grey out scrollbar button when border reached? (+KStyle patch)
From:       Wilco Greven <greven () kde ! org>
Date:       2002-08-29 12:11:20
[Download RAW message or body]

On Thursday 29 August 2002 11:30, Friedrich W. H. Kossebau wrote:
> [..]
> For the records: I just saw a screenshot of openoffice. Guess what one
> could see there: Greyed out scrollbar buttons (where the bar had reached
> the border)!
>
> So this might be something to become a standard in KDE, too. But that is
> left to others. I don't code (right now), so I don't decide ;)
>
> Bu at least I will file a wish to the KDE bugsystem. As I am no user of
> KDE 3.x I would like to know: Are there any qt/kde styles where there is
> already such a feature implemented?

Yes, .NET does change the arrows when the top/botton is reached. Because I 
liked the idea and wanted to try it out with the highcolor default style I 
made some rough changes to KStyle (see the attached patch). It works by 
disabling the appropriate arrow button.

My first impression was that the button changes were a bit disturbing. But 
that could be caused by the fact that I'm paying extra attention to them. So 
I have to use it for a longer time before I can decide if I like it.

-- 
Greetings,
Wilco


["kstyle.cpp.diff" (text/x-diff)]

Index: kstyle.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdefx/kstyle.cpp,v
retrieving revision 1.25
diff -u -p -b -r1.25 kstyle.cpp
--- kstyle.cpp	2002/08/18 00:35:49	1.25
+++ kstyle.cpp	2002/08/29 12:00:03
@@ -962,8 +962,16 @@ void KStyle::drawComplexControl( Complex
 			const QScrollBar *sb = (const QScrollBar*)widget;
 			bool   maxedOut   = (sb->minValue()    == sb->maxValue());
 			bool   horizontal = (sb->orientation() == Qt::Horizontal);
-			SFlags sflags     = ((horizontal ? Style_Horizontal : Style_Default) |
-								 (maxedOut   ? Style_Default : Style_Enabled));
+			bool   atMinimum  = (sb->value()       == sb->minValue());
+			bool   atMaximum  = (sb->value()       == sb->maxValue());
+			SFlags sflags     = ((horizontal ? Style_Horizontal : Style_Default)
+							  |  (maxedOut   ? Style_Default : Style_Enabled));
+			SFlags addLineFlags = (horizontal ? Style_Horizontal : Style_Default)
+								| (atMaximum  ? Style_Default : Style_Enabled)
+								| ((active == SC_ScrollBarAddLine) && !atMaximum ? Style_Down : Style_Default);
+			SFlags subLineFlags = (horizontal ? Style_Horizontal : Style_Default)
+								| (atMinimum  ? Style_Default : Style_Enabled)
+								| ((active == SC_ScrollBarSubLine) && !atMinimum ? Style_Down : Style_Default);
 
 			QRect  addline, subline, subline2, addpage, subpage, slider, first, last;
 			subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, opt);
@@ -982,21 +990,15 @@ void KStyle::drawComplexControl( Complex
 					subline2.moveBy(0, -addline.height());
 
 			// Draw the up/left button set
-			if ((controls & SC_ScrollBarSubLine) && subline.isValid()) {
-				drawPrimitive(PE_ScrollBarSubLine, p, subline, cg,
-							sflags | (active == SC_ScrollBarSubLine ?
-								Style_Down : Style_Default));
+			if (/*(controls & SC_ScrollBarSubLine) &&*/ subline.isValid()) {
+				drawPrimitive(PE_ScrollBarSubLine, p, subline, cg, subLineFlags);
 
 				if (useThreeButtonScrollBar && subline2.isValid())
-					drawPrimitive(PE_ScrollBarSubLine, p, subline2, cg,
-							sflags | (active == SC_ScrollBarSubLine ?
-								Style_Down : Style_Default));
+					drawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, subLineFlags);
 			}
 
-			if ((controls & SC_ScrollBarAddLine) && addline.isValid())
-				drawPrimitive(PE_ScrollBarAddLine, p, addline, cg,
-							sflags | ((active == SC_ScrollBarAddLine) ?
-										Style_Down : Style_Default));
+			if (/*(controls & SC_ScrollBarAddLine) &&*/ addline.isValid())
+				drawPrimitive(PE_ScrollBarAddLine, p, addline, cg, addLineFlags);
 
 			if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
 				drawPrimitive(PE_ScrollBarSubPage, p, subpage, cg,

_______________________________________________
kde-usability mailing list
kde-usability@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-usability

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic