/*------------------------------------------------------------------------------
 src/lib/djWidget/djImageOpGenWidget.h
 
 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

#ifndef DJ_IMAGE_OP_GEN_WIDGET_H
#define DJ_IMAGE_OP_GEN_WIDGET_H
#include <djEnumWidget.h>
#include <djImageOpGen.h>
#include <djImageOpWidget.h>

namespace dj {

class IntWidget;
class FileNameWidget;
class Vec2iWidget;
class PixelWidget;
class ColorWidget;

// Image input operation widget.
//
class ImageOpInputWidget : public ImageOpWidget {
public:

  ImageOpInputWidget();
  
  const Str name() const { return "Input"; }
  Plugin * copy() const { return new ImageOpInputWidget; }
  void set(ImageOp *);
  void widgetUpdate();
  
private:

  DJ_CALLBACK(ImageOpInputWidget, fileNameCallback, const Str &)
  DJ_CALLBACK(ImageOpInputWidget, proxyCallback, int)
  DJ_CALLBACK(ImageOpInputWidget, formatCallback, int)
  DJ_CALLBACK(ImageOpInputWidget, typeCallback, int)

  FileNameWidget * _fileNameWidget;
  IntWidget * _proxyWidget;
  EnumWidget<int> * _formatWidget, * _typeWidget;
  bool _callbacks;
};

// Image solid operation widget.
//
class ImageOpSolidWidget : public ImageOpWidget {
public:

  ImageOpSolidWidget();
  
  const Str name() const { return "Solid"; }
  Plugin * copy() const { return new ImageOpSolidWidget; }
  void set(ImageOp *);
  void widgetUpdate();
  
private:

  DJ_CALLBACK(ImageOpSolidWidget, sizeCallback, const Vec2i &)
  DJ_CALLBACK(ImageOpSolidWidget, pixelCallback, const Pixel &)
  DJ_CALLBACK(ImageOpSolidWidget, colorCallback, const Color &)

  Vec2iWidget * _sizeWidget;
  PixelWidget * _pixelWidget;
  ColorWidget * _colorWidget;
  bool _callbacks;
};

// Image noise operation widget.
//
class ImageOpNoiseWidget : public ImageOpWidget {
public:

  ImageOpNoiseWidget();
  
  const Str name() const { return "Noise"; }
  Plugin * copy() const { return new ImageOpNoiseWidget; }
  void set(ImageOp *);
  void widgetUpdate();
  
private:

  DJ_CALLBACK(ImageOpNoiseWidget, sizeCallback, const Vec2i &)
  DJ_CALLBACK(ImageOpNoiseWidget, pixelCallback, const Pixel &)
  DJ_CALLBACK(ImageOpNoiseWidget, colorCallback, const Color &)
  DJ_CALLBACK(ImageOpNoiseWidget, color2Callback, const Color &)
  DJ_CALLBACK(ImageOpNoiseWidget, randSeedCallback, int)

  Vec2iWidget * _sizeWidget;
  PixelWidget * _pixelWidget;
  ColorWidget * _colorWidget, * _color2Widget;
  IntWidget * _randSeedWidget;
  bool _callbacks;
};

// Image gradient operation widget.
//
class ImageOpGradientWidget : public ImageOpWidget {
public:

  ImageOpGradientWidget();
  
  const Str name() const { return "Gradient"; }
  Plugin * copy() const { return new ImageOpGradientWidget; }
  void set(ImageOp *);
  void widgetUpdate();
  
private:

  DJ_CALLBACK(ImageOpGradientWidget, sizeCallback, const Vec2i &)
  DJ_CALLBACK(ImageOpGradientWidget, pixelCallback, const Pixel &)
  DJ_CALLBACK(ImageOpGradientWidget, positionCallback, const Vec2i &)
  DJ_CALLBACK(ImageOpGradientWidget, position2Callback, const Vec2i &)
  DJ_CALLBACK(ImageOpGradientWidget, colorCallback, const Color &)
  DJ_CALLBACK(ImageOpGradientWidget, color2Callback, const Color &)

  Vec2iWidget * _sizeWidget;
  PixelWidget * _pixelWidget;
  Vec2iWidget * _positionWidget, * _position2Widget;
  ColorWidget * _colorWidget, * _color2Widget;
  bool _callbacks;
};

// Utility.
//
inline const List<ImageOpWidget *> imageOpGenWidgetList()
{
  List<ImageOpWidget *> out;
  out += new ImageOpInputWidget;
  out += new ImageOpSolidWidget;
  out += new ImageOpNoiseWidget;
  out += new ImageOpGradientWidget;
  return out;
}

}

#endif
