/******************************************************************************
 GMApp.h

	Interface for the GMApp class

	Copyright © 1997 by Glenn W. Bach.  All rights reserved.
	
	Base code generated by Codemill v0.1.0

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

#ifndef _H_GMApp
#define _H_GMApp

#include <JXApplication.h>

class GMessageTableDir;
class GMessageEditDir;
class GLockFileTask;
class GPOPRetriever;
class GMailboxTreeDir;
class GAddressBookTreeDir;

class GMApp : public JXApplication
{
public:

	GMApp(int* argc, char* argv[], JBoolean* displayAbout, JString* prevVersStr);
	virtual ~GMApp();

	virtual void	Suspend();
	virtual void	Resume();

	void	OpenMailbox();
	void	OpenMailbox(const JCharacter* filename);
	void	OpenIconifiedMailbox(const JCharacter* filename, 
									const JBoolean beep = kTrue);
	void	NewMailbox(const JCharacter* filename, const JBoolean openFile = kTrue);
	void	OpenSystemMailbox();

	void	AppendNewMessage(GMessageEditDir* dir);
	
	void	DisplayAbout(const JCharacter* prevVersStr = NULL);
	virtual JBoolean Close();

	void	CheckMail();

	JBoolean	OpenSession();

	void		NewMessage(const JCharacter* to);

protected:

	virtual void	Receive(JBroadcaster* sender,
								const JBroadcaster::Message& message);
	virtual void	DirectorClosed(JXDirector* theDirector);
	virtual void	CleanUpBeforeSuddenDeath(const JXDocumentManager::SafetySaveReason reason);

private:

	JPtrArray<GMessageTableDir>*	itsTableDirs;
	JPtrArray<GMessageEditDir>*		itsEditDirs;
	JPtrArray<GLockFileTask>*		itsLockTasks;

	GPOPRetriever*					itsPOPRetriever;

private:

	void		SaveState();
	JBoolean	FileLocked(const JCharacter* filename, const JBoolean iconify);
	
	// not allowed

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

};


#endif
