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

#ifndef DJ_PIXEL_WIDGET_H
#define DJ_PIXEL_WIDGET_H
#include <djPixel.h>
#include <djWidget.h>
#include <djEnumWidget.h>

namespace dj {

// Pixel widget.
//
class PixelWidget : public Widget {
public:

  PixelWidget();
  
  // Value.
  //
  void set(const Pixel &);
  const Pixel & get() const { return _value; }
  
  // Signals.
  //
  Signal<const Pixel &> & sig() { return _sig; }
  
private:

  DJ_CALLBACK(PixelWidget, formatCallback, PIXEL_FORMAT)
  DJ_CALLBACK(PixelWidget, typeCallback, PIXEL_TYPE)

  void widgetUpdate();

  Pixel _value;

  Signal<const Pixel &> _sig;

  EnumWidget<PIXEL_FORMAT> * _formatWidget;
  EnumWidget<PIXEL_TYPE> * _typeWidget;
  bool _callbacks;
};

}

#endif
