/* -*- mode: c++; tab-width: 4; -*-
 *
 * Copyright (c) 2000-2003, Roland Jesse
 * All rights reserved.
 *
 * This file is part of the Mango recipe management distribution.
 * For license and copyright information see the file COPYRIGHT or 
 * <http://www.opensource.org/licenses/bsd-license.html>.
 *
 * $Id: CreateRecipeWindow.h,v 1.9 2003/10/27 14:14:43 rjesse Exp $
 */

#ifndef CREATE_RECIPE_WINDOW_H
#define CREATE_RECIPE_WINDOW_H

#include "CreateRecipeForm.h"
#include "Recipe.h"

/**
 * This window provides the user with facilities to enter a new recipe
 * manually.
 */
class CreateRecipeWindow : public CreateRecipeForm {
	  Q_OBJECT
	  typedef CreateRecipeForm inherited;

   public:
	  CreateRecipeWindow( QWidget* parent = 0);
	  CreateRecipeWindow( const Recipe&, QWidget* parent = 0);
	  ~CreateRecipeWindow();

   public slots:
      virtual bool close();
	  void update();

   protected slots:
	  virtual void slotApply();
	  virtual void slotAddCategory();
	  virtual void slotDeleteCategories();
	  virtual void slotAddIngredient();
	  virtual void slotDeleteIngredients();
	  virtual void slotDeleteIngredientGroup();
	  virtual void slotAddCookbook( const QString&);
      virtual void slotNewCookbook();
      virtual void slotRemoveSelectedCookbooks();
	  virtual void slotLoadPicture();
	  virtual void slotDeletePicture();
      void slotDeletePicture( const QString&);
	  virtual void slotTypistChanged( const QString&);
	  virtual void slotSourceChanged( const QString&);
	  virtual void slotTitleChanged( const QString&);
	  virtual void slotYieldQtyChanged( int);
      virtual void slotYieldRangeChanged( int);
      virtual void slotYieldUnitChanged( const QString&);
	  virtual void slotReturnPressedInDirections();
	  virtual void slotShowIngredients( const Recipe::IngredientList&);
	  virtual void slotShowIngredients( const QString&);
      virtual void slotSelectPicture( const QString&);

     void slotAddRemark();
     void slotRemoveSelectedRemarks();
     void slotRemarksUserChanged( const QString&);

   private:
	  void initWidgets();
      void addIngredientRow();
      QMap<QString, Measurement> m_measurements; //!< key: mea's description.
	  Recipe m_recipe;			//!< The "original"
	  Recipe m_cache;			//!< Working copy, thrown away on "Cancel"
};
#endif // CREATE_RECIPE_WINDOW_H
