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

#ifndef DJ_IMAGE_OP_COLOR_WIDGET_H
#define DJ_IMAGE_OP_COLOR_WIDGET_H
#include <djImageOpColor.h>
#include <djImageOpWidget.h>

namespace dj {

class FileNameWidget;
class ColorWidget;

// Image lookup table operation widget.
//
class ImageOpLutWidget : public ImageOpWidget {
public:

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

  DJ_CALLBACK(ImageOpLutWidget, widgetCallback, const Str &)

  FileNameWidget * _widget;
};

// Image color operation widget base.
//
class ImageOpColorWidget : public ImageOpWidget {
public:

  ImageOpColorWidget();
  
  void set(ImageOp *);
  void widgetUpdate();
  
protected:

  ColorWidget * widget() { return _widget; }
  
private:

  DJ_CALLBACK(ImageOpColorWidget, widgetCallback, const Color &)

  ColorWidget * _widget;
};
class ImageOpColor2Widget : public ImageOpWidget {
public:

  ImageOpColor2Widget();
  
  void set(ImageOp *);
  void widgetUpdate();
  
protected:

  ColorWidget * widget() { return _widget; }
  ColorWidget * widget2() { return _widget2; }
  
private:

  DJ_CALLBACK(ImageOpColor2Widget, widgetCallback, const Color &)
  DJ_CALLBACK(ImageOpColor2Widget, widget2Callback, const Color &)

  ColorWidget * _widget, * _widget2;
};

// Image brightness/constrast operation widgets.
//
class ImageOpBrightnessWidget : public ImageOpColorWidget {
public:

  const Str name() const { return "Brightness"; }
  Plugin * copy() const { return new ImageOpBrightnessWidget; }
};
class ImageOpContrastWidget : public ImageOpColorWidget {
public:

  const Str name() const { return "Contrast"; }
  Plugin * copy() const { return new ImageOpContrastWidget; }
};

// Image hue/saturation operation widgets.
//
class ImageOpHueWidget : public ImageOpColorWidget {
public:

  ImageOpHueWidget();
  
  const Str name() const { return "Hue"; }
  Plugin * copy() const { return new ImageOpHueWidget; }
};
class ImageOpSaturationWidget : public ImageOpColorWidget {
public:

  const Str name() const { return "Saturation"; }
  Plugin * copy() const { return new ImageOpSaturationWidget; }
};

// Image gamma/levels operation widgets.
//
class ImageOpGammaWidget : public ImageOpColorWidget {
public:

  const Str name() const { return "Gamma"; }
  Plugin * copy() const { return new ImageOpGammaWidget; }
};
class ImageOpLevelsInWidget : public ImageOpColor2Widget {
public:  

  ImageOpLevelsInWidget();
  
  const Str name() const { return "Levels In"; }
  Plugin * copy() const { return new ImageOpLevelsInWidget; }
};
class ImageOpLevelsOutWidget : public ImageOpColor2Widget {
public:

  ImageOpLevelsOutWidget();
  
  const Str name() const { return "Levels Out"; }
  Plugin * copy() const { return new ImageOpLevelsOutWidget; }
};

// Image soft clip operation widget.
//
class ImageOpSoftClipWidget : public ImageOpColorWidget {
public:

  ImageOpSoftClipWidget();
  
  const Str name() const { return "Soft Clip"; }
  Plugin * copy() const { return new ImageOpSoftClipWidget; }
};

// Utility.
//
inline const List<ImageOpWidget *> imageOpColorWidgetList()
{
  List<ImageOpWidget *> out;
  out += new ImageOpLutWidget;
  out += new ImageOpBrightnessWidget;
  out += new ImageOpContrastWidget;
  out += new ImageOpHueWidget;
  out += new ImageOpSaturationWidget;
  out += new ImageOpGammaWidget;
  out += new ImageOpLevelsInWidget;
  out += new ImageOpLevelsOutWidget;
  out += new ImageOpSoftClipWidget;
  return out;
}

}

#endif
