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

List:       kde-commits
Subject:    kdelibs/kstyles/highcolor
From:       Fredrik Höglund <fredrik () kde ! org>
Date:       2003-01-16 20:38:40
[Download RAW message or body]

CVS commit by fredrik: 

- Improved drawing of mouse hover effects for flat buttons.


  M +13 -12    highcolor.cpp   1.49


--- kdelibs/kstyles/highcolor/highcolor.cpp  #1.48:1.49
@@ -302,4 +302,5 @@ void HighColorStyle::drawPrimitive( Prim
                 case PE_ButtonCommand: {
                         bool sunken = on || down;
+                        bool flat = !(flags & (Style_Raised | Style_Sunken));
                         int  x, y, w, h;
                         r.rect(&x, &y, &w, &h);
@@ -311,5 +312,5 @@ void HighColorStyle::drawPrimitive( Prim
                                                 &cg.brush(QColorGroup::Mid) );
                         
-                        else if ( flags & Style_MouseOver ) {
+                        else if ( flags & Style_MouseOver && !flat ) {
                                 QBrush brush(cg.button().light(110));
                                 kDrawBeButton( p, x, y, w, h, cg, false, &brush );
@@ -317,16 +318,16 @@ void HighColorStyle::drawPrimitive( Prim
 
                         // "Flat" button
-                        else if (!(flags & (Style_Raised | Style_Sunken)))
-                            {
-                                //p->fillRect(r, cg.button());
+                        else if ( flat ) {
+                                if ( flags & Style_MouseOver )
+                                        p->fillRect(r, cg.button().light(110));
+                                else
                                 renderGradient(p, QRect(x, y, w-1, h-1),
                                                                 cg.button(), false);
-                                p->setPen(cg.button().light(75));
                                 
+                                p->setPen(cg.button().light(75));
                                 p->drawLine(x, y, x2, y);
                                 p->drawLine(x, y, x, y2);
                                 p->drawLine(x, y2, x2, y2);
                                 p->drawLine(x2, y, x2, y2);
-                                
                         }          
                         
@@ -1211,5 +1212,5 @@ void HighColorStyle::drawControl( Contro
                 // MENUBAR BACKGROUND
                 // -------------------------------------------------------------------
-                case CE_MenuBarEmptyArea: // will be CE_MenuBarEmptyArea in Qt3.1b2
+                case CE_MenuBarEmptyArea:
                 {
                         renderGradient(p, r, cg.button(), false);


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

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