#ifndef __GOLEM_H
#define __GOLEM_H

#ifndef __WINDOW_H
#include <window.h>
#endif

#ifndef __CONFIG_H
class TConfig;
#endif

#ifndef __RELATION_H
class TRelation;
#endif

// Generic Object Linking & Embedding Mechanism

class TGolem : public TSortable
{     
  static long _count;
  static TConfig* _config; 
  static TFilename* _path;
  static TRelation* _golem;

  TString16 _class;
  long _id;

protected:
  const TFilename& path(bool test = FALSE) const;
  const char* ext() const;
  TConfig& config() const;
  long new_id() const;
  
protected:// TSortable
  virtual int compare(const TSortable& o) const;

public:   // TObject
  virtual const char* class_name() const;
  virtual word class_id() const;
  virtual bool ok() const;

public:
  virtual short icon() const;
  virtual bool edit();
  virtual bool import();
  
  long id() const { return _id; } 

  TGolem(const char* cls, long id);
  virtual ~TGolem();
};


class TDDE : public TWindow
{ 
  word _hwnd;
  word _server;
  long _old_hook;

public:
  void set_server(word s) { _server = s; }
  bool initiate(const char* app, const char* topic);
  bool execute(const char* cmd) const;
  void terminate();

  TDDE();
  virtual ~TDDE();
};

#endif