#ifndef __COLMASK_H
#define __COLMASK_H

#ifndef __COLORS_H
#include <colors.h>
#endif   

#ifndef __VARMASK_H
#include <varmask.h>
#endif   

class TColor_row_mask;
class TColor_object_props;

class TSelect_color_mask : public TVariable_mask
{        
  TColor_row_mask * _sheet_mask;
  TArray _color_defs; 
  TFilename _mask_name;
  TString _paragraph;

  HIDDEN TMask * get_mask(int, TMask&);
  TColor_object_props * row(int r) const { return (TColor_object_props *) _color_defs.objptr(r);}
  int items() const { return _color_defs.items();}
  
protected:
  void init(const char * mask_name, const char * para = NULL);
  static bool color_handler(TMask_field& f, KEY k);
  static bool reset_handler(TMask_field& f, KEY k);
  void save() const ;
  
public:
  int add_color_def(const char * key, const char * prompt, COLOR back = NORMAL_BACK_COLOR, COLOR fore = NORMAL_COLOR);
  void get_color_def(const char * key, COLOR & back, COLOR & fore) const ;
  void get_cur_colors(COLOR & back, COLOR & fore) const ;
  int key2pos(const char * key) const;
  COLOR get_back_color(int pos) const;
  COLOR get_fore_color(int pos) const;

  TSelect_color_mask(const char * mask_name, const char * para = NULL);
  TSelect_color_mask(const TSheet_field & field);
  virtual ~TSelect_color_mask();
};

#endif