/******************************************************************************
 JXSpellCheckerDialog.h

	Interface for the JXSpellCheckerDialog class

	Copyright @ 1997 by Glenn W. Bach.

 ******************************************************************************/

#ifndef _H_JXSpellCheckerDialog
#define _H_JXSpellCheckerDialog

#include <JXWindowDirector.h>
#include <JString.h>

class JXInputField;
class JXTextButton;
class JXStaticText;
class JXSpellList;

class JXSpellCheckerDialog : public JXWindowDirector
{
public:

	enum SpellAction
	{
	kIgnore = 1,
	kIgnoreAll,
	kChange,
	kChangeAll,
	kLearn,
	kLearnCaps,
	kClose
	};

public:

	JXSpellCheckerDialog(JXDirector* supervisor);

	virtual ~JXSpellCheckerDialog();
	
	const JString& 	GetCorrection();
	const JString& 	GetCheckWord();
	SpellAction		GetSpellAction();

	void			SetCheckWord(const JCharacter* word);
	void			SetFirstGuess(const JCharacter* word);
	void			SetSuggestions(const JPtrArray<JString>* words);
	
protected:
	
	virtual void	Receive(JBroadcaster* sender, const Message& message);

private:

// begin JXLayout

    JXStaticText* itsCheckText;
    JXInputField* itsFirstGuess;
    JXTextButton* itsIgnoreButton;
    JXTextButton* itsChangeButton;
    JXTextButton* itsLearnButton;
    JXTextButton* itsIgnoreAllButton;
    JXTextButton* itsChangeAllButton;
    JXTextButton* itsCloseButton;
    JXTextButton* itsLearnCapsButton;

// end JXLayout

	JXSpellList*	itsSuggestions;
	SpellAction		itsCurrentAction;

private:

	void	BuildWindow();

	// not allowed

	JXSpellCheckerDialog(const JXSpellCheckerDialog& source);
	const JXSpellCheckerDialog& operator=(const JXSpellCheckerDialog& source);

public:

	static const JCharacter* kSpellButtonPressed;

	class SpellButtonPressed : public JBroadcaster::Message
		{
		public:

			SpellButtonPressed()
				:
				JBroadcaster::Message(kSpellButtonPressed)
				{ };
		};
};

#endif
