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

List:       kde-commits
Subject:    branches/KDE/3.5/kdebase/kicker/libkicker
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2006-04-21 21:44:32
Message-ID: 1145655872.727049.24734.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 532418 by aseigo:

draw button text with the proper color
see if anyone moans about on-hover arrows for menu buttons ;)


 M  +10 -8     panelbutton.cpp  


--- branches/KDE/3.5/kdebase/kicker/libkicker/panelbutton.cpp #532417:532418
@@ -580,7 +580,6 @@
         int tX = reverse ? 3 : icon.width() + KMIN(25, KMAX(5, fm.width('m') / 2));
         int tY = fm.ascent() + ((h - fm.height()) / 2);
 
-        QColor shadCol = KickerLib::shadowColor(m_textColor);
 
         // get a transparent pixmap
         QPainter pixPainter;
@@ -591,7 +590,7 @@
 
         // draw text
         pixPainter.begin(&textPixmap);
-        pixPainter.setPen(shadCol);
+        pixPainter.setPen(m_textColor);
         pixPainter.setFont(p->font()); // get the font from the root painter
         pixPainter.drawText(tX, tY, m_buttonText, -1, rtl);
         pixPainter.end();
@@ -609,7 +608,10 @@
         // draw shadow
         QImage img = s_textShadowEngine->makeShadow(textPixmap, shadCol);
         p->drawImage(0, 0, img);
+        p->save();
+        p->setPen(m_textColor);
         p->drawText(tX, tY, m_buttonText, -1, rtl);
+        p->restore();
 
         if (reverse && !icon.isNull())
         {
@@ -620,15 +622,15 @@
     }
     else if (!icon.isNull())
     {
-        int y = (height() - icon.height())/2;
-        int x = (width()  - icon.width() )/2;
+        int y = (height() - icon.height()) / 2;
+        int x = (width()  - icon.width()) / 2;
         p->drawPixmap(x, y, icon);
     }
 
-    if (m_drawArrow)
+    if (m_drawArrow && (m_highlight || active))
     {
         QStyle::PrimitiveElement e = QStyle::PE_ArrowUp;
-        QRect r(0, 0, 8, 8);
+        QRect r(width() / 2 - 4, 0, 8, 8);
 
         switch (m_arrowDirection)
         {
@@ -663,7 +665,7 @@
         }
 
         int flags = QStyle::Style_Enabled;
-        if (isDown() || isOn())
+        if (active)
         {
             flags |= QStyle::Style_Down;
         }
@@ -840,7 +842,6 @@
     m_pressedDuringPopup(false),
     m_initialized(false)
 {
-    setDrawArrow(true);
     connect(this, SIGNAL(pressed()), SLOT(slotExecMenu()));
 }
 
@@ -853,6 +854,7 @@
     }
 
     m_popup = popup;
+    setDrawArrow(m_popup != 0);
 
     if (m_popup)
     {
[prev in list] [next in list] [prev in thread] [next in thread] 

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