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

List:       kde-commits
Subject:    kdebase/kicker/applets/minipager
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2005-04-19 20:02:58
Message-ID: 20050419200258.AEFC6650 () office ! kde ! org
[Download RAW message or body]

CVS commit by aseigo: 

visually differentiate between clicked-but-not-selected and selected,
use this for drag enter/leave/dropping as well


  M +3 -2      Makefile.am   1.12
  M +51 -10    pagerapplet.cpp   1.112


--- kdebase/kicker/applets/minipager/Makefile.am  #1.11:1.12
@@ -1,3 +1,3 @@
-INCLUDES = $(all_includes) -I$(srcdir)/../../taskmanager
+INCLUDES = $(all_includes) -I$(srcdir)/../../taskmanager -I$(srcdir)/../../share
 
 kde_module_LTLIBRARIES = minipager_panelapplet.la
@@ -15,5 +15,6 @@
 minipager_panelapplet_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
 minipager_panelapplet_la_LIBADD = $(LIB_KDEUI) \
-        ../../taskmanager/libtaskmanager.la
+        ../../taskmanager/libtaskmanager.la \
+        ../../share/libkickermain.la
 
 messages:

--- kdebase/kicker/applets/minipager/pagerapplet.cpp  #1.111:1.112
@@ -52,4 +52,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 #include <taskmanager.h>
 
+#include "global.h"
+
 #include "pagerapplet.h"
 #include "pagerapplet.moc"
@@ -83,5 +85,5 @@ KMiniPagerButton::KMiniPagerButton(int d
     deskNum = desk;
     lineedit = 0;
-    connect(this, SIGNAL(clicked()), SLOT(slotClicked()) );
+    connect(this, SIGNAL(clicked()), SLOT(slotClicked()));
     connect(this, SIGNAL(toggled(bool)), SLOT(slotToggled(bool)));
     connect(&dragSwitchTimer, SIGNAL( timeout() ),
@@ -105,5 +107,4 @@ void KMiniPagerButton::paintEvent(QPaint
     setBackgroundOrigin( AncestorOrigin );
 
-    bool active = isOn() || isDown();
     bool transparent = pager()->transparent();
 
@@ -113,15 +114,44 @@ void KMiniPagerButton::paintEvent(QPaint
     QPainter mp( &mask );
 
+    QBrush background;
+
     // background...
-    if( ! transparent ) {
-        // fill with a solid background, if active Midlight, else Mid...
-        QBrush background = colorGroup().brush( active ? QColorGroup::Midlight : QColorGroup::Mid );
-        bp.fillRect( buffer.rect(), background );
-    } else {
+    if (!transparent)
+    {
+        QBrush background;
+
+        if (isOn())
+        {
+            background = colorGroup().brush(QColorGroup::Midlight);
+        }
+        else if (isDown())
+        {
+            background = KickerLib::blendColors(colorGroup().mid(),
+                                                colorGroup().midlight());
+        }
+        else
+        {
+            background = colorGroup().brush(QColorGroup::Mid);
+        }
+
+        bp.fillRect(buffer.rect(), background);
+    }
+    else
+    {
         // transparent windows get an 1 pixel frame...
-        if( active )
-            bp.setPen( colorGroup().midlight() );
+        if (isOn())
+        {
+            bp.setPen(colorGroup().midlight());
+        }
+        else if (isDown())
+        {
+            bp.setPen(KickerLib::blendColors(colorGroup().mid(),
+                                             colorGroup().midlight()));
+        }
         else
-            bp.setPen( colorGroup().dark() );
+        {
+            bp.setPen(colorGroup().dark());
+        }
+
         bp.drawRect( buffer.rect() );
         mp.setPen( Qt::color1 );
@@ -271,4 +301,5 @@ void KMiniPagerButton::dragEnterEvent(QD
     {
         e->accept();
+        setDown(true);
     }
     else 
@@ -293,4 +324,9 @@ void KMiniPagerButton::dropEvent( QDropE
             (*it)->toDesktop(deskNum);
         }
+
+        if (pager()->kwin()->currentDesktop() != deskNum)
+        {
+            setDown(false);
+        }
     }
     else
@@ -304,4 +340,9 @@ void KMiniPagerButton::dragLeaveEvent( Q
     dragSwitchTimer.stop();
 
+    if (pager()->kwin()->currentDesktop() != deskNum)
+    {
+        setDown(false);
+    }
+
     QButton::dragLeaveEvent( e );
 }


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

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