demos/embedded/anomaly/src/ControlStrip.cpp
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 7 3f74d0d4af4c
--- a/demos/embedded/anomaly/src/ControlStrip.cpp	Fri Feb 19 23:40:16 2010 +0200
+++ b/demos/embedded/anomaly/src/ControlStrip.cpp	Fri Mar 12 15:46:37 2010 +0200
@@ -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();
 }