#include <applicat.h>
#include <config.h>
#include <form.h>
#include <msksheet.h>
#include <prefix.h>
#include <relation.h>
#include <utility.h>
#include <urldefid.h>

#include "bafrm.h"

class TForm_editor : public TApplication
{
  TForm* _form; 
  TMask* _m;
  bool _extra;
  TString16 _frm_date;
  TToken_string _frm_number;
  

protected: 
  
  // maschera usata per selezione profilo (quando non specificato)
  virtual const char* selection_mask() const { return "ba2100b"; }
  
  virtual bool create();
  virtual bool destroy();
  virtual bool menu(MENU_TAG);
  virtual void print();

  static bool file_handler(TMask_field& f, KEY k);
  static bool cod_handler(TMask_field&f, KEY k);
  static bool date_example(TMask_field&f, KEY k);
  
  bool& extra() { return _extra;}
  void set_form(TForm * f) { _form = f; }
  virtual bool ask_profile();
  bool edit_relation();
  bool edit_fincatura();
  bool edit_formato_numero();
  bool edit_formato_data();
  const char* get_formato_numero() { return _frm_number; }
  const char* get_formato_data()   { return _frm_date;   }
  void  set_formato_numero(const char* s) { _frm_number = s;}
  void  set_formato_data(const char* s)   { _frm_date = s;}   
  virtual bool edit(char s, pagetype p);
  bool form_config() const;
  void check_form() { if (_form != NULL) delete _form; }
  TForm& form() { return *_form; }
  TMask& mask() { return *_m; }
  
public:

  TForm_editor();
  virtual ~TForm_editor();

};

