#ifndef _TK_DIALOGS_H_
#define _TK_DIALOGS_H_

#include <list>
#include <map>
#include <string>

#include "../../ptr.h"
#include "../tcl_interp.h"

using namespace std;

/**
 * \brief Defines message box types
 */
typedef enum MBoxType
{
    mbox_abortretrycancel	=0,
	mbox_ok					=1,
	mbox_okcancel			=2,
	mbox_retrycancel		=3,
	mbox_yesno				=4,
	mbox_yesnocancel		=5
};

/**
 * \brief Defines message box buttons
 */
typedef enum MBoxButton
{
	mbut_abort				=0,
	mbut_retry				=1,
	mbut_cancel				=2,
	mbut_ok					=3,
	mbut_yes				=4,
	mbut_no					=5
};

/**
 * \brief Defines message box icons
 */
typedef enum MBoxIcon
{
	mico_error		=0,
	mico_info		=1,
	mico_question	=2,
	mico_warning	=3
};

/**
 * \brief Contains static metods for simple dialogs - message box,open and save file dialog.
 *
 * \date 01-12-2006
 *
 * \author Ondrej Svejdar
 *
 * \todo 
 *
 * \bug 
 *
 */
class TkDialogs
{
	static const char* mbox_types[];
	static const char* mbox_buttons[];
	static const char* mbox_icons[];

	inline TkDialogs() {}
public:
	/**
	 * \brief Create dialog
	 * \param interp reference to interpret
	 * \param title dialog title
	 * \param text text to display
	 * \param defaultButton mbut_abort, mbut_retry,	mbut_cancel, mbut_ok , mbut_yes, mbut_no		
	 * \return int index of pressed button
	 */
	static int createDialog(Ptr<TclInterp>& interp,const string& title,const string& text,int defaultButton);

	/**
	 * \brief Create dialog
	 * \param interp reference to interpret
	 * \param title dialog title
	 * \param text text to display
	 * \param defaultButton mbut_abort, mbut_retry,	mbut_cancel, mbut_ok , mbut_yes, mbut_no		
	 * \param button0 text displayed on button 0 (buttons are indexed from left to right)
	 * \return int index of pressed button
	 */
	static int createDialog(Ptr<TclInterp>& interp,const string& title,const string& text,int defaultButton,const string& button0);

	/**
	 * \brief Create dialog
	 * \param interp reference to interpret
	 * \param title dialog title
	 * \param text text to display
	 * \param defaultButton mbut_abort, mbut_retry,	mbut_cancel, mbut_ok , mbut_yes, mbut_no		
	 * \param button0 text displayed on button 0 (buttons are indexed from left to right)
	 * \param button1 text displayed on button 1 (buttons are indexed from left to right)
	 * \return int index of pressed button
	 */
	static int createDialog(Ptr<TclInterp>& interp,const string& title,const string& text,int defaultButton,const string& button0,const string& button1);

	/**
	 * \brief Create dialog
	 * \param interp reference to interpret
	 * \param title dialog title
	 * \param text text to display
	 * \param defaultButton mbut_abort, mbut_retry,	mbut_cancel, mbut_ok , mbut_yes, mbut_no		
	 * \param button0 text displayed on button 0 (buttons are indexed from left to right)
	 * \param button1 text displayed on button 1 (buttons are indexed from left to right)
	 * \param button2 text displayed on button 2 (buttons are indexed from left to right)
	 * \return int index of pressed button
	 */
	static int createDialog(Ptr<TclInterp>& interp,const string& title,const string& text,int defaultButton,const string& button0,const string& button1,const string& button2);
	
	/**
	 * \brief Create dialog
	 * \param interp reference to interpret
	 * \param title dialog title
	 * \param text text to display
	 * \param defaultButton mbut_abort, mbut_retry,	mbut_cancel, mbut_ok , mbut_yes, mbut_no		
	 * \param buttons for each item in this list would be created one button
	 * \return int index of pressed button
	 */
	static int createDialog(Ptr<TclInterp>& interp,const string& title,const string& text,int defaultButton,const list<string>& buttons);

	/**
	 * \brief Create message box
	 * \param interp reference to interpret
	 * \param title dialog title
	 * \param message message to display
	 * \param type type of message box
	 * \param icon displayed icon
	 * \param defaultButton default active button
	 * \return index of pressed button
	 */
	static MBoxButton createMBox(Ptr<TclInterp>& interp,const string& title,const string& message,MBoxType type,MBoxIcon icon,MBoxButton defaultButton);

	/**
	 * \brief Create standard openfile dialog
	 * \param interp reference to interpret
	 * \return path to selected file
	 */
	static const string& createOpenDialog(Ptr<TclInterp>& interp);

	/**
	 * \brief Create standard open dialog
	 * \param interp reference to interpret
	 * \param defaultExtension active extension
	 * \param fileTypes associative array, key is extension, for example ".txt" value is explanation - "Text files"
	 * \param initialDir initial directory
	 * \param multiple true, if we should open multiple files
	 * \param title title of dialog
	 * \return path to selected file(s)
	 */
	static const string& createOpenDialog(Ptr<TclInterp>& interp,const string& defaultExtension,const map<string,string>& fileTypes,const string& initialDir,bool multiple,const string& title);

	/**
	 * \brief Create standard save dialog
	 * \param interp reference to interpret
	 * \param defaultExtension active extension
	 * \param fileTypes associative array, key is extension, for example ".txt" value is explanation - "Text files"
	 * \param initialDir initial directory
	 * \param title title of dialog
	 * \return path to selected file
	 */
	static const string& createSaveDialog(Ptr<TclInterp>& interp,const string& defaultExtension,const map<string,string>& fileTypes,const string& initialDir,const string& title);
};

#endif/*_TK_DIALOGS_H_*/

