/***********************************************************************
*           See Accompanying licence file QSAS_licence                 *
***********************************************************************/
#ifndef _QTPL_H
#define _QTPL_H

#include <qsplitter.h>
#include <qtextedit.h>
#include <qobject.h>
#include "qt_version.h"

#if QT_VERSION < 0x040000
#include "qgu.h"
#else
#include <QScrollArea>
#include <QLayout>
#include "qgu_qt4.h"
#endif

#include "qtpl_parser.h"
#include "Qdos.h"
#include "qslot.h"
#include "qplug_if.h"


#define QTPL_VERSION  "QTPL V_2.0 [13 Feb 2004]"
#define QTPL_MINWIDTH 600
#define QTPL_MINHEIGHT 300

class qtplMenu : public Q_POPUP_MENU
{
   Q_OBJECT

public:
   qtplMenu(QWidget *parent=0, const char *name=0);
   void addFolderToMenu(const char *folder, bool first= true);
   QString menuPath;
   
signals:
   
public slots:
   void qtplOpen(int id);

protected:

private:
   
};



class QplugSlot : public Q_V_GROUP_BOX
{
   Q_OBJECT

public:
   QplugSlot(const QString &title, const QString & text, 
                    QString qtplType,
                    QWidget *parent=0, const char *name=0);
   int argIndex;
   QString type;
   QString defaultValue;
   QString toolTipText;
   QguWLinput *ioSlot;
   
signals:
   
public slots:

protected:

private:
   
};



class qplugWindow : public QguWindow {

Q_OBJECT
  
public slots:
  void dismiss();
  void defaultAll();
  void runPlugin();
  void launchVersion();
  void launchManPlugins();
  void launchPluginHelp();
  void launchDocPlugin();
  void launchManual();
  void save();
  void saveAs();
  void saveSession(QString);
  void saveLog();
  
signals:

  
public:
    
  qplugWindow(QWidget *parent=0, const char *name=0, QtplParserFile * qtplFile=0);
  void QplugInit ();
  bool QplugBuildInputArgsList (QplugArgList *arg_list);
  void QplugSetDefaults();
  void QplugGetEntryName();

  virtual void save(Vostream&);
  virtual void restore(Vistream& v_is,bool replace=true);
  
#ifdef QT_VERSION
#if QT_VERSION <0x030000
  QMultiLineEdit * textArea;
#else 
  QTextEdit * textArea;		
#endif // end of #if
#endif // end of #ifdef
  QWidget *inputWidget;
  QVBoxLayout *inputVLayout;
  //Q_V_GROUP_BOX *inputBox;
  QWidget *outputWidget;
  QVBoxLayout *outputVLayout;
  QWidget *ioWidget;
  QHBoxLayout *ioHLayout;
  Q_SCROLL_VIEW *scrollW;
  QtplParserFile *qtplf;
  QString PathAndNameSO;
  QString try_entry_name;
  QString qtplName;
  vector <QplugSlot *> iSlots;
  vector <QplugSlot *> oSlots;
  
protected:
  void keyPressEvent(QKeyEvent * e );
  QPushButton *runBtn;
  QPushButton *defaultBtn;
  QPushButton *dismissBtn;
  QPushButton *saveBtn;
};

   
void QtplOpenByName(QString name, QWidget *parent);


#endif


