//	Zinc Application Framework - Z_FILDLG.HPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#if !defined(Z_FILDLG_HPP)
#define Z_FILDLG_HPP
#include <z_dlgwin.hpp>
#include <z_cset.hpp>

// --------------------------------------------------------------------------
// ----- ZafFileDialog ------------------------------------------------------
// --------------------------------------------------------------------------

enum ZafFileDialogRequest
{
	ZAF_FILE_DIALOG_NEW			= 0,
	ZAF_FILE_DIALOG_OPEN		 	= 1,
	ZAF_FILE_DIALOG_SAVEAS		= 2
};

class ZAF_EXPORT ZafFileDialog : public ZafDialogWindow
{
public:
	static ZafIChar ZAF_FARDATA allFilesFilter[];

	// --- General members ---
	ZafFileDialog(int left, int top, int width, int height);
	ZafFileDialog(const ZafFileDialog &copy);
	virtual ~ZafFileDialog(void);

	// File Dialog control.
	ZafDialogEvent GetFile(ZafFileDialogRequest request);

	// --- Attributes & data access ---
	// get
	const ZafIChar *Directory(void) const;
	const ZafIChar *File(void) const;
	const ZafIChar *Filter(void) const;
	void FullPath(ZafIChar *pathBuffer, int bufferSize);
	// set
	virtual void SetDirectory(const ZafIChar *directory);
	virtual void SetFile(const ZafIChar *file);
	virtual void SetFilter(const ZafIChar *filter);
								 
	// --- Window members ---
	virtual bool SetModal(bool modal);

	// --- Window object members ---
	virtual ZafEventType Event(const ZafEventStruct &event);

	// --- Class identification ---
	static ZafClassID classID;
	static ZafClassNameChar ZAF_FARDATA className[];
	virtual ZafClassID ClassID(void) const { return (classID); }
	virtual ZafClassName ClassName(void) const { return (className); }
	virtual bool IsA(ZafClassID compareID) const;
	virtual bool IsA(ZafClassName compareName) const;

protected:
	// --- Special OS members ---
	virtual void OSRegisterObject(void);
	virtual OSWindowID OSScreenID(ZafScreenIDType type = ZAF_SCREENID) const;
	virtual void OSSize(void);

	// --- Language & locale support ---
	ZafLanguageData *messages;

private:
	ZafIChar directory[ZAF_MAXPATHLEN];
	ZafIChar file[ZAF_MAXPATHLEN];
	ZafIChar filter[ZAF_MAXPATHLEN];

#if defined(ZAF_MOTIF)
	ZafFileDialogRequest request;
#elif defined(ZAF_INDEPENDENT)
	ZafFileSystem *fileSystem;
	void UpdateFiles(void);
	void UpdateTitle(void);
	void UpdateVolumes(void);
#endif
};

// --- inline functions ---
inline const ZafIChar *ZafFileDialog::Directory(void) const { return (directory); }
inline const ZafIChar *ZafFileDialog::File(void) const { return (file); }
inline const ZafIChar *ZafFileDialog::Filter(void) const { return (filter); }

#endif // Z_FILE_DIALOG_HPP

