/*------------------------------------------------------------------------------
 src/bin/djview/djImageOpStackWidget.h

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

#ifndef DJ_IMAGE_OP_STACK_WIDGET_H
#define DJ_IMAGE_OP_STACK_WIDGET_H
#include <djWidget.h>

namespace dj {

class ImageOp;
class ImageOpStack;
class TabWidget;

// Image operation stack widget.
//
class ImageOpStackWidget : public Widget {
public:
  
  ImageOpStackWidget();
  ~ImageOpStackWidget();
  
  // Set.
  //
  void set(ImageOpStack *);
  ImageOpStack * get() { return _imageOpStack; }
  
  // Stacks.
  //
  bool stackActive(int);
  void stackNew(const Str & = Str());
  bool stackCopy(int stack);
  bool stackDel(int stack);
  bool stackName(const Str & name, int stack);
  bool stackLeft(int stack);
  bool stackRight(int stack);
  int stackActive() const;
  
  // Operations.
  //
  bool opNew(const Str &, int stack);
  bool opCopy(int, int stack);
  bool opDel(int, int stack);
  bool opLeft(int, int stack);
  bool opRight(int, int stack);
  int opActive() const;

  // Signals.
  //
  Signal<bool> & updateSig() { return _updateSig; }
  Signal<int> & stackActiveSig() { return _stackActiveSig; }
  Signal<int> & stackUpdateSig() { return _stackUpdateSig; }
  
  // Widget.
  //
  void widgetUpdate();

private:

  DJ_CALLBACK(ImageOpStackWidget, stackActiveCallback, int)
  DJ_CALLBACK(ImageOpStackWidget, stackUpdateCallback, bool)
  DJ_CALLBACK(ImageOpStackWidget, stackNameCallback, const Str &)
  DJ_CALLBACK(ImageOpStackWidget, closeCallback, bool)

  ImageOpStack * _imageOpStack;
  Signal<bool> _updateSig;
  Signal<int> _stackActiveSig, _stackUpdateSig;
  TabWidget * _tabWidget;
  List<TabWidget *> _widgetList;
  bool _callbacks;
};

// Utility.
//
void prefs(ImageOpStack *, const Str & name, const Prefs &);
void prefs(const ImageOpStack &, const Str & name, Prefs *);

}

#endif
