[rkward-cvs] SF.net SVN: rkward: [759] trunk/rkward/rkward/misc/rkworkplace.h

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Sep 24 19:42:59 UTC 2006


Revision: 759
          http://svn.sourceforge.net/rkward/?rev=759&view=rev
Author:   tfry
Date:     2006-09-24 12:42:52 -0700 (Sun, 24 Sep 2006)

Log Message:
-----------
Second draft of RKWorkplace API. Since KMdi will be gone in KDE4, we might as well start replacing some of the more problematic aspects
(we'll keep kmdi for the tool-windows for now, as there does not seem to be a good replacement in Qt3 (but in Qt4))

Modified Paths:
--------------
    trunk/rkward/rkward/misc/rkworkplace.h

Modified: trunk/rkward/rkward/misc/rkworkplace.h
===================================================================
--- trunk/rkward/rkward/misc/rkworkplace.h	2006-09-21 18:20:41 UTC (rev 758)
+++ trunk/rkward/rkward/misc/rkworkplace.h	2006-09-24 19:42:52 UTC (rev 759)
@@ -20,43 +20,57 @@
 
 #include <qvaluelist.h>
 #include <qstring.h>
+#include <qtabwidget.h>
 
 #include <kurl.h>
 
 #include "../rbackend/rcommandreceiver.h"
 
-class KMdiChildView;
 class RObject;
 class RCommandChain;
+class RKWorkplaceView;
 
 /** This class (only one instance will probably be around) keeps track of which windows are opened in the
-workplace, which are detached, etc. Will replace RKEditorManager. TODO: maybe this class can also keep track of the active view more reliably than KMDI-framework does? */
-class RKWorkPlace : public QObject, public RCommandReceiver {
+workplace, which are detached, etc. Will replace RKEditorManager.
+It also provides a QWidget (RKWorkplace::view ()), which actually manages the document windows (only those, so far. I.e. this is a half-replacement for KMdi, which will be gone in KDE 4). Currently layout of the document windows is always tabbed. */
+class RKWorkplace : public QObject, public RCommandReceiver {
 	Q_OBJECT
 public:
-	RKWorkPlace (QObject *parent);
-	~RKWorkPlace ();
+/** ctor.
+ at param parent: The parent widget for the workspace view (see view ()) */
+	RKWorkplace (QWidget *parent);
+	~RKWorkplace ();
 
-	enum RKWorkPlaceObjectType {
-		EditorWindow=1,
+	enum RKWorkplaceObjectType {
+		DataEditorWindow=1,
 		CommandEditorWindow=2,
-		OutputWindow=3,
-		HelpWindo=4
+		OutputWindow=4,
+		HelpWindow=8,
+		AnyType=DataEditorWindow | CommandEditorWindow | OutputWindow | HelpWindow
 	};
 
-	struct RKWorkPlaceObject {
-		KMdiChildView *view;
-		RKWorkPlaceObjectType type;
-		QString location_or_name;
+	enum RKWorkplaceObjectState {
+		Attached=1,
+		Detached=2,
+		AnyState=Attached | Detached
+	};
+
+	struct RKWorkplaceObjectInfo {
+		RKWorkplaceObjectType type;
+		QString location_or_name;		// do we need this?
 		bool detached;
 	};
 
-	typedef QValueList<RKWorkPlaceObject *> RKWorkPlaceObjectList;
+	typedef QMap<QWidget *, RKWorkplaceObjectInfo *> RKWorkplaceObjectMap;
 
-	RKWorkPlaceObjectList getObjectList ();
+	RKWorkplaceView *view ();
 
-	void detachView (KMdiChildView *view);
+	RKWorkplaceObjectMap getObjectList () { return windows; };
 
+	void detachWindow (QWidget *window);
+/** Attach an already created window. */
+	void attachWindow (QWidget *window);
+
 	void openScriptEditor (const KURL &url=KURL ());
 	void openHelpWindow (const KURL &url=KURL ());
 	void openOutputWindow (const KURL &url=KURL ());
@@ -64,27 +78,31 @@
 	bool canEditObject (RObject *object);
 	void editObject (RObject *object, bool initialize_to_empty=false);
 
+/** tell all DataEditorWindow s to syncronize changes to the R backend
+// TODO: add RCommandChain parameter */
 	void flushAllData ();
-	void closeAll ();
-	void closeAllData ();
+/** Closes all windows of the given type(s). Default call (no arguments) closes all windows
+ at param type: A bitwise OR of RKWorkplaceObjectType
+ at param state: A bitwise OR of RKWorkplaceObjectState */
+	void closeAll (int type=AnyType, int state=AnyState);
 
 	void saveWorkplace (RCommandChain *chain=0);
 	void restoreWorkplace (RCommandChain *chain=0);
 signals:
 	void lastWindowClosed ();
 public slots:
-	// TODO: eventually, this class should do all the work, not just receive the signals
-	void viewDetached (KMdiChildView *view);
-	void viewAttached (KMdiChildView *view);
+	void windowDestroyed (QWidget *window);
 
-	void viewDestroyed (KMdiChildView *view);
-
-	void updateViewCaption (KMdiChildView *view);
+	void updateWindowCaption (QWidget *window);
 protected:
 	void rCommandDone (RCommand *command);
 private:
-	RKWorkPlaceObjectList attached_windows;
-	RKWorkPlaceObjectList detached_windows;
+	RKWorkplaceObjectMap windows;
 };
 
+class RKWorkplaceView : public QTabWidget {
+	RKWorkplaceView (QWidget *parent);
+	~RKWorkplaceView ();
+};
+
 #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