[rkward-cvs] SF.net SVN: rkward: [1547] trunk/rkward/rkward/windows

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Mar 7 16:53:37 UTC 2007


Revision: 1547
          http://svn.sourceforge.net/rkward/?rev=1547&view=rev
Author:   tfry
Date:     2007-03-07 08:53:37 -0800 (Wed, 07 Mar 2007)

Log Message:
-----------
EXPERIMENTAL: Add frame to indicate, whether an MDI window is active

Modified Paths:
--------------
    trunk/rkward/rkward/windows/rkmdiwindow.cpp
    trunk/rkward/rkward/windows/rkmdiwindow.h

Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-03-07 16:09:26 UTC (rev 1546)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-03-07 16:53:37 UTC (rev 1547)
@@ -18,6 +18,7 @@
 #include "rkmdiwindow.h"
 
 #include <qapplication.h>
+#include <qpainter.h>
 
 #include <kparts/event.h>
 
@@ -26,7 +27,7 @@
 
 #include "../debug.h"
 
-RKMDIWindow::RKMDIWindow (QWidget *parent, Type type, bool tool_window, char *name) : QWidget (parent, name) {
+RKMDIWindow::RKMDIWindow (QWidget *parent, Type type, bool tool_window, char *name) : QFrame (parent, name) {
 	RK_TRACE (APP);
 
 	RKMDIWindow::type = type;
@@ -34,6 +35,7 @@
 	else state = Attached;
 	wrapper = 0;
 	part = 0;
+	active = false;
 }
 
 RKMDIWindow::~RKMDIWindow () {
@@ -120,7 +122,14 @@
 		KParts::PartActivateEvent *ev = static_cast<KParts::PartActivateEvent *> (e);
 		if (ev->activated ()) {
 			emit (windowActivated (this));
+			active = true;
+		} else {
+			active = false;
 		}
+		if (layout()->margin () < 1) {
+			layout()->setMargin (1);
+		}
+		update ();
 	}
 	return FALSE;
 }
@@ -132,4 +141,19 @@
 	getPart ()->installEventFilter (this);
 }
 
+void RKMDIWindow::paintEvent (QPaintEvent *e) {
+	// RK_TRACE (APP); Do not trace!
+
+	QFrame::paintEvent (e);
+
+	if (active) {
+		QPainter paint (this);
+		paint.setPen (QColor (255, 0, 0));
+		paint.drawLine (0, 0, 0, height ()-1);
+		paint.drawLine (0, height ()-1, width ()-1, height ()-1);
+		paint.drawLine (0, 0, width ()-1, 0);
+		paint.drawLine (width ()-1, 0, width ()-1, height ()-1);
+	}
+}
+
 #include "rkmdiwindow.moc"

Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h	2007-03-07 16:09:26 UTC (rev 1546)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h	2007-03-07 16:53:37 UTC (rev 1547)
@@ -26,7 +26,7 @@
 class RKWorkplace;
 
 /** Base class for rkward document mdi windows */
-class RKMDIWindow : public QWidget {
+class RKMDIWindow : public QFrame {
 	Q_OBJECT
 public:
 	enum Type {
@@ -96,6 +96,7 @@
 protected:
 	void setPart (KParts::Part *p) { part = p; };
 	void initializeActivationSignals ();
+	void paintEvent (QPaintEvent *e);
 friend class RKWorkplace;
 /** type of this window */
 	Type type;
@@ -104,6 +105,7 @@
 	KParts::Part *part;
 	State state;
 	KMdiToolViewAccessor *wrapper;
+	bool active;
 };
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list