demos/embedded/anomaly/src/ControlStrip.cpp
changeset 18 2f34d5167611
parent 0 1918ee327afb
child 19 fcece45ef507
--- a/demos/embedded/anomaly/src/ControlStrip.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/demos/embedded/anomaly/src/ControlStrip.cpp	Fri Apr 16 15:50:13 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -50,6 +50,7 @@
     menuPixmap.load(":/images/edit-find.png");
     backPixmap.load(":/images/go-previous.png");
     forwardPixmap.load(":/images/go-next.png");
+    closePixmap.load(":/images/button-close.png");
 }
 
 QSize ControlStrip::sizeHint() const
@@ -74,16 +75,23 @@
     }
 
     if (x > width() - h) {
-        emit forwardClicked();
-        event->accept();
-        return;
-    }
+    		emit closeClicked();    		
+    		event->accept();
+    		return;
+            
+        }
 
     if ((x < width() - 2 * h) && (x > width() - 3 * h)) {
-        emit backClicked();
-        event->accept();
-        return;
-    }
+    		emit forwardClicked();
+    		event->accept();
+    		return;
+        }
+
+    if ((x < width() - 3 * h) && (x > width() - 5 * h)) {
+    		emit backClicked();
+    		event->accept();
+    		return;
+        }
 }
 
 void ControlStrip::paintEvent(QPaintEvent *event)
@@ -91,11 +99,14 @@
     int h = height();
     int s = (h - menuPixmap.height()) / 2;
 
-    QPainter p(this);
-    p.fillRect(event->rect(), QColor(32, 32, 32, 192));
-    p.setCompositionMode(QPainter::CompositionMode_SourceOver);
-    p.drawPixmap(s, s, menuPixmap);
-    p.drawPixmap(width() - 3 * h + s, s, backPixmap);
-    p.drawPixmap(width() - h + s, s, forwardPixmap);
-    p.end();
+
+	QPainter p(this);
+	p.fillRect(event->rect(), QColor(32, 32, 32, 192));
+	p.setCompositionMode(QPainter::CompositionMode_SourceOver);
+	p.drawPixmap(s, s, menuPixmap);
+	p.drawPixmap(width() - h + s, s, closePixmap);	    
+	p.drawPixmap(width() - 3 * h + s, s, forwardPixmap);
+	p.drawPixmap(width() - 5 * h + s, s, backPixmap);
+	    
+	p.end();
 }