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

#if !defined(Z_BMAP1_HPP)
#define Z_BMAP1_HPP
#include <z_bmap.hpp>
#include <z_win.hpp>

// --------------------------------------------------------------------------
// ----- ZafBitmap ----------------------------------------------------------
// --------------------------------------------------------------------------

class ZAF_EXPORT ZafBitmap : public ZafWindowObject
{
public:
	// --- General members ---
	ZafBitmap(int left, int top, int width, int height,
		ZafBitmapData *bitmapData = ZAF_NULLP(ZafBitmapData));
	ZafBitmap(const ZafBitmap &copy);
	virtual ~ZafBitmap(void);

	// --- Persistence ---
	virtual ZafWindowObject *Duplicate(void);
#if defined(USE_ZAF_PERSISTENCE)
	ZafBitmap(const ZafIChar *name, ZafObjectPersistence &persist);
	static ZafElement *Read(const ZafIChar *name, ZafObjectPersistence &persist);
	virtual void Write(ZafObjectPersistence &persist);
#endif

	// --- Attributes & data access ---
	// get
	bool AutoSize(void) const;
	ZafBitmapData *BitmapData(void) const;
	// set
	virtual bool SetAutoSize(bool autoSize);
	virtual ZafError SetBitmapData(ZafBitmapData *bitmapData);

	// --- Window object members ---
	virtual ZafEventType Event(const ZafEventStruct &event);
	virtual bool SetAcceptDrop(bool acceptDrop);
	virtual bool SetChanged(bool changed);
	virtual bool SetCopyDraggable(bool copyDraggable);
	virtual bool SetFocus(bool currentFocus);
	virtual ZafLogicalFont SetFont(ZafLogicalFont font);
	virtual const ZafIChar *SetHelpContext(const ZafIChar *helpContext);
	virtual bool SetLinkDraggable(bool linkDraggable);
	virtual bool SetMoveDraggable(bool moveDraggable);
	virtual bool SetNoncurrent(bool noncurrent);
	virtual bool SetOSDraw(bool osDraw);
	virtual ZafLogicalColor SetTextColor(ZafLogicalColor color, ZafLogicalColor mono);
	virtual ZafUserFunction SetUserFunction(ZafUserFunction userFunction);

	// --- 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:
	friend class ZAF_EXPORT OSBitmap;

	// --- General members ---
	ZafBitmapData *bitmapData;
	bool autoSize;

	virtual ZafEventType Draw(const ZafEventStruct &event, ZafEventType ccode);

	// --- Data access ---
	static ZafError Update(ZafBitmap *bitmap, ZafUpdateType type);

	// --- Special OS members ---
	virtual ZafError OSSetImage(void);

#if defined(USE_ZAF_PERSISTENCE)
	// --- Persistence ---
	void ReadData(ZafObjectPersistence &persist);
	virtual ZafObjectConstructor ReadFunction(void) { return (ZafBitmap::Read); }
	void WriteData(ZafObjectPersistence &persist);
#endif
};

// --- inline functions ---
inline bool ZafBitmap::AutoSize(void) const { return (autoSize); }
inline ZafBitmapData *ZafBitmap::BitmapData(void) const { return (bitmapData); }

#endif // Z_BMAP1_HPP

