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

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

#ifndef DJVIEW_IMAGE_OPS_TOOL_H
#define DJVIEW_IMAGE_OPS_TOOL_H
#include "base.h"
#include <djDialog.h>

namespace dj {
class ImageOp;
class ImageOpStackWidget;
class MenuItems;
class MenubarWidget;
}

namespace djview {

// Image operations tool.
//
class ImageOpTool : public DialogBase {
public:
  
  ImageOpTool();
  ~ImageOpTool();
  void die();

  // Set.
  //
  void stackActive(int);

  // Get.
  //
  int stackActive() const;
  
  // Signals.
  //
  Signal<bool> & updateSig() { return _updateSig; }
  Signal<int> & stackUpdateSig() { return _stackUpdateSig; }
    
  // Widget.
  //
  void widgetUpdate();
  
private:

  DJ_CALLBACK(ImageOpTool, updateCallback, bool);

  DJ_FL_WIDGET_CALLBACK(ImageOpTool, stackActiveCallback)
  DJ_CALLBACK(ImageOpTool, stackActiveCallback, int)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, stackNewCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, stackCopyCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, stackDelCallback)
  DJ_CALLBACK(ImageOpTool, stackNameCallback, const Str &)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, stackNameCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, stackLeftCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, stackRightCallback)
  DJ_CALLBACK(ImageOpTool, stackUpdateCallback, int);
  
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, opNewCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, opCopyCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, opDelCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, opLeftCallback)
  DJ_FL_WIDGET_CALLBACK(ImageOpTool, opRightCallback)
  
  DJ_CALLBACK(ImageOpTool, closeCallback, bool)
  
  void menuUpdate();

  Signal<bool> _updateSig;
  Signal<int> _stackUpdateSig;
  
  ImageOpStackWidget * _widget;
  MenuItems * _menuItems;
  MenubarWidget * _menubar;
  IntList _stackMenuId, _opMenuId;
  bool _callbacks;
};

}

#endif
