/******************************************************************************
 GNBNoteDir.h

	Interface for the GNBNoteDir class

	Written by Glenn Bach - 1997.

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

#ifndef _H_GNBNoteDir
#define _H_GNBNoteDir

#include <JXDocument.h>

#include <JFileArray.h>
#include <JString.h>

class GNBNoteEditor;
class JXTextMenu;
class JXMenuBar;
class JXToolBar;
class ostream;
class istream;
class JXTextButton;

class GNBNoteDir : public JXDocument
{
public:

	GNBNoteDir(JXDirector* supervisor, const JFAID_t id);

	virtual ~GNBNoteDir();
	
	void				Print();
	void				Export();
	void				WriteData(ostream& os);
	void				ReadData(istream& is);
	virtual JBoolean	NeedsSave() const;
	virtual void		SafetySave(const JXDocumentManager::SafetySaveReason reason);
	virtual JXPM		GetMenuIcon() const;
	JBoolean			TextChanged() const;
	JFAID_t				GetID() const;
	void				Append(const JFAID_t id);
	void				PrintFinished();
	void				MakeTempForPrinting();

protected:

	virtual void		Receive(JBroadcaster* sender, const Message& message);
	virtual JBoolean	OKToClose();
	virtual void		DiscardChanges();

private:

	GNBNoteEditor*	 		itsEditor;
	JXTextMenu*				itsFileMenu;
	JXMenuBar*				itsMenuBar;
	JBoolean				itsTextChanged;
	JFAID_t					itsID;
	JString					itsTitle;
	JXTextButton*			itsCloseButton;
	JXToolBar*				itsToolBar;
	JBoolean				itsIsTempForPrinting;

private:

	void Save(const JBoolean tellApp = kFalse);

	void BuildWindow();
	void UpdateFileMenu();
	void HandleFileMenu(const JIndex index);

	// not allowed

	GNBNoteDir(const GNBNoteDir& source);
	const GNBNoteDir& operator=(const GNBNoteDir& source);
	
};

/******************************************************************************
 TextChanged (public)

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

inline JBoolean
GNBNoteDir::TextChanged()
	const
{
	return itsTextChanged;
}

/******************************************************************************
 TextChanged (public)

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

inline JFAID_t
GNBNoteDir::GetID()
	const
{
	return itsID;
}

#endif
