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

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

// --------------------------------------------------------------------------
// ----- ZafSplitter --------------------------------------------------------
// --------------------------------------------------------------------------

enum ZafSplitterType
{
	ZAF_HORIZONTAL_SPLITTER = 0,
	ZAF_VERTICAL_SPLITTER
};

class ZAF_EXPORT ZafSplitter : public ZafWindowObject
{
public:
	// --- General Members ---
	ZafSplitter(int left, int top, int width, int height,
		ZafSplitterType splitType, int position = 50, bool percent = true);
	ZafSplitter(ZafSplitterType splitType, int position = 50,
		bool percent = true);
	ZafSplitter(const ZafSplitter &copy);
	virtual ~ZafSplitter(void);

	// --- Attributes and Data access ---
	// get
	bool Live(void) const;
	ZafWindowObject *NextPaneObject(void) const;
	ZafWindowObject *PreviousPaneObject(void) const;
	int Position(bool percent = true) const;
	ZafSplitterType SplitterType(void) const;
	int Thickness(void) const;
	// set
	virtual bool SetLive(bool live);
	virtual void SetNextPaneObject(ZafWindowObject *object);
	virtual void SetPreviousPaneObject(ZafWindowObject *object);
	virtual void SetPosition(int position, bool percent = true);
	virtual void SetSplitterType(ZafSplitterType splitterType);
	virtual void SetThickness(int thickness);

	// --- Window object members ---
	virtual void ConvertCoordinates(ZafCoordinateType coordinateType);
	virtual ZafEventType Draw(const ZafEventStruct &event, ZafEventType ccode);
	virtual ZafEventType Event(const ZafEventStruct &event);
	virtual ZafRegionStruct Region(void) const;
	virtual bool SetAcceptDrop(bool acceptDrop);
	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 bool SetParentDrawBorder(bool parentDrawBorder);
	virtual bool SetParentDrawFocus(bool parentDrawFocus);
	virtual void SetRegion(const ZafRegionStruct &region);
	virtual bool SetSelected(bool selected);
	virtual bool SetSupportObject(bool supportObject);
	virtual ZafLogicalColor SetTextColor(ZafLogicalColor color, ZafLogicalColor mono = ZAF_MONO_NULL);

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

	// --- 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:
	bool live;
	bool percent;
	int position;
	int thickness;
	ZafRegionStruct splitRegion;
	ZafSplitterType splitterType;
	ZafWindowObject *nextPaneObject;
	ZafWindowObject *previousPaneObject;

	virtual ZafEventType Modify(const ZafEventStruct &event);
	void XOR(int position);

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

	ZafNumberID nextPaneObjectID;
	ZafNumberID previousPaneObjectID;
};

inline bool ZafSplitter::Live(void) const { return (live); }
inline ZafWindowObject *ZafSplitter::NextPaneObject(void) const { return (nextPaneObject); }
inline ZafWindowObject *ZafSplitter::PreviousPaneObject(void) const { return (previousPaneObject); }
inline ZafSplitterType ZafSplitter::SplitterType(void) const { return (splitterType); }
inline int ZafSplitter::Thickness(void) const { return (thickness); }

#endif // Z_SPLIT_HPP
