#ifndef __SCRIPTFILE__HXX
#define __SCRIPTFILE__HXX

#include <ui_scriptfile.hxx>
#include <cassert>

class ScriptFile: public QDockWidget, protected Ui::ScriptFile {
    Q_OBJECT;
  Q_SIGNALS:
    void link(QString);
    void include(QString);
    void close(ScriptFile*);
  public:
    ScriptFile(QWidget* p=0): QDockWidget(p) {
      setupUi(this);
      assert(connect(_editor, SIGNAL(include(QString)), SIGNAL(include(QString))));
      assert(connect(_editor, SIGNAL(link(QString)), SIGNAL(link(QString))));
      _searchBar->hide();
      _replaceBar->hide();
      _pageBar->hide();
    }
    CodeEditor* editor() {
      return _editor;
    }
    QString name() {
      return _name;
    }
    void name(QString name) {
      _name = name;
      setWindowTitle(name+"[*]");
      setWindowModified(false);
    }
  protected:
    void closeEvent (QCloseEvent *event) {
      close(this);
    }
  private:
    QString _name;
};

#endif
