AeAssetEditor.h 1.87 KB
// AeAssetEditor.h
//
// This class contains the abstract and concrete definitions
// for editor clients of the database.  Editors have both read
// and write access into the database.
//
// The AeBinEditor abstract class represents an editor for assets
// according to their type or bin.  It could also be called a list
// editor since the assets are viewed in a list.  This editor has
// lots of routines to support the list widget callbacks and must
// handle all the user input for each cell in the list.
//
// The AeAssetEditor, which edits all assets, and the AeBankEditor,
// which edits only bank assets, are implemented as AeBinEditors.
//

#ifndef __AeAssetEditor__
#define __AeAssetEditor__

#include "AeTypes.h"
#include "AeAsset.h"
#include "AeBinEditor.h"


class AeAssetBase;
class AeAssetBin;
class AeAsset;
class AeAssetWindow;
class AeAssetFile;


class AeAssetEditor : public AeBinEditor
{
public:
                        AeAssetEditor (void);
    virtual	       	~AeAssetEditor (void);

    enum AeDialogReply { YES, NO, CANCEL };

    virtual void       	SetAssetBase (AeAssetBase *);
    virtual void	CreateAsset (AeAsset *, Boolean);
    virtual void       	UpdateAsset (AeAsset *, Boolean);
    virtual void	DeleteAsset (AeAsset *, Boolean);

    Boolean		HasFile (void) { return fFile != NULL; }
    
    virtual void	OpenEditor (AeAsset *);
    void		OpenFile (const char * name);
    void		SaveFile (void);
    void		SaveAsFile (const char * name);
    void		CloseFile (void);
    void		ImportAsset (const char * name);

protected:
    virtual Boolean	binHasUI (AeAssetBin *);

private:
    void		createAssetUIs (void);

    AeAssetFile *	getAndReadFile (const char * name, Boolean);
    void		removeBankAsset (GList<AeAsset *> *);
    AeDialogReply	postSaveQuestion (void);

    AeAssetWindow *	fWindow;
    AeAssetFile *	fFile;
    Boolean		fSaveNeeded;
};	


#endif __AeAssetEditor__