/******************************************************************************
 JXTextLink.h

	Interface for the JXTextLink class

	Copyright © 1998 by John Lindal. All rights reserved.

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

#ifndef _H_JXTextLink
#define _H_JXTextLink

#include <jTypes.h>
#include <JIndexRange.h>
#include <JXKeyModifiers.h>
#include <JXButtonStates.h>
#include <JXCursor.h>

class JXDisplay;

class JXTextLink 
{
public:

	JXTextLink(JXDisplay* display);

	virtual ~JXTextLink();

	JBoolean	LTAdjustCursor(const JIndex charIndex, 
								const JXKeyModifiers& modifiers,
								const JIndexRange selRange, 
								JCursorIndex* cursor);

	void		LTHandleMouseDown(const JIndex charIndex, 
									const JXMouseButton button,
									const JSize clickCount,
									const JXButtonStates& buttonStates,
									const JXKeyModifiers& modifiers);
	void		LTHandleMouseUp(const JIndex charIndex, 
								const JXMouseButton button,
								const JXButtonStates& buttonStates,
								const JXKeyModifiers& modifiers);

protected:

	virtual JSize		GetLinkCount() const = 0;
	virtual JIndexRange	GetLinkRange(const JIndex index) const = 0;
	virtual void		LinkClicked(const JIndex index) = 0;

private:

	JCursorIndex	itsLinkCursor;
	JIndex			itsMouseDownIndex;		// used while dragging

private:

	// not allowed

	JXTextLink(const JXTextLink& source);
	const JXTextLink& operator=(const JXTextLink& source);
};

#endif
