/*
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Peter Hofer <ph@desktopbsd.net>
 *         (C) 2004, 2005
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */

#ifndef __DIALOGS_H
#define __DIALOGS_H

class QString;

/**  @brief Simple functions for user interaction.
  *
  *  All dialogs are modal, which means that
  *  no interaction with other windows is possible
  *  as long as the window stays open.
  *
  *  These functions don't return as long as
  *  the dialog is shown.
  */
class Dialogs {
public:
	/** Displays an "info" dialog.
	  * @param text The dialog's text.
	  */
	static void infoDlg(const QString &  msg);


	/** Displays a "warning" dialog.
	  * @param text The dialog's text.
	  */
	static void warnDlg(const QString &  msg);


	/** Displays a "critical" dialog. This
	  * really should only be used for
	  * critical problems.
	  *
	  * @param text The dialog's text.
	  */
	static void critDlg(const QString &  msg);


	/** Displays a "question" dialog with a "Yes"
	  * and a "No" button.
	  * @param text A yes/no question.
	  * @return TRUE when the user clicked "Yes",
	  *         otherwise FALSE.
	  */
	static bool question(const QString &  msg);


	/** Gets an integer value from the user.
	  *
	  * @param text    The dialog's text.
	  * @param defval  Default value.
	  * @param min     Smallest number allowed.
	  * @param max     Largest number allowed.
	  * @param ok      If not NULL, ok is used to store
	  *                whether the user clicked "Ok" (TRUE)
	  *                or "Cancel" (FALSE)
	  */
	static int intInput(const QString &  text,
	                    bool  *ok = NULL,
	                    int  defaultValue = 0,
	                    int  min = INT_MIN,
	                    int  max = INT_MAX);


	/** Gets a QString from the user.
	  * @param text	The dialog's text.
	  * @param ok		If not NULL, ok is used to store
	  * 					whether the user clicked "Ok" (TRUE)
	  * 					or "Cancel" (FALSE)
	  */
	static QString strInput(const QString &  text,
	                        bool  *ok = NULL,
	                        const QString &  defaultValue = "");
};

#endif /* __DIALOGS_H */
