#ifndef EDITORMANAGER_H
#define    EDITORMANAGER_H
#include <kaction.h>
#include <qtabwidget.h>
#include <qtabbar.h>
#include <qptrlist.h>
// #include <qlist.h>
#include <qptrlist.h>
#include <qevent.h>
#include "KBEditor.h"

//
// Regroupe toutes les commandes pour piloter un editeur
// KBEditor, et regle les pb d'interaction entre icone/menu et editeur
//
class EditorManager : public QTabWidget
{
    Q_OBJECT
public:
        EditorManager ( QWidget *parent, KActionCollection *ac)   ;
        ~EditorManager() ;
	KBEditor *currentEditor();
        KBEditor *findOrCreate(const QString& newedit) ;
        KBEditor *findEditor(const QString&  name)  ;
  /** returns the name of the currently displayed  file.
Empty string if no opened file */
  QString currentFile();
  /** Returns the names of all currently opened files. */
  QStringList getAllFileNames();
  /** No descriptions */
  int editorCount();
  /** No descriptions */
  QPtrList<KBEditor>& getEditors();

public slots:
	void createEditor() ;
	void removeCurrentEditor();
	void undoRedoManagement();
	void viewsManagement();
	void selectionManagement();
	void saveManagement();
	void titleManagement();
	void eolManagement();
	void focusManagement();
	void changeToEditor(QWidget *ge) ;
	void openFile() ;      
  void closeAllFiles() ;
	void slotDropEvent( QDropEvent *e) ;
  /** Switch to editor buffer specified by filename
Il filename file is not currently loaded,
a new tab is created for it, and it is loaded.
\return
not NULL if switch successfull, NULL otherwise.
 */
  KBEditor *switchToEditor(const QString &filename);
  /** No descriptions */
  void slotOpenFile(const KURL &url);
    /** Save all source files (ie: .asm) */
  void saveAllFiles();
private:
        void connectEditor(KBEditor *editor) ;
        void disconnectEditor(KBEditor *editor) ;
	KAction *act(const char *) ;
	QString shortName(const QString& s, int max) ;

private:
        KActionCollection   	*actions ;
        KBEditor 		*currenteditor ;
        QPtrList<KBEditor>	 	editors ;


signals:   
 } ;
#endif
