operator==( documentAdress1 : SDocumentAdress, documentAdress2 : SDocumentAdress ) : Bool
{
	if( ( documentAdress1.folderID == documentAdress2.folderID ) && ( documentAdress1.documentID == documentAdress2.documentID ) )
	{
		return true;
	}
	return false;
}

class ComputerDocumentThumbnailWidgetController extends DeviceButtonLogicControllerBase
{
	default selectable = true;
	[ category = "Widget Refs" ]
	protected editable var m_documentIconWidget : inkImageRef;
	protected var m_documentAdress : SDocumentAdress;
	protected var m_documentType : EDocumentType;
	protected var m_questInfo : QuestInfo;

	protected event OnInitialize()
	{
		super.OnInitialize();
		SetSelectable( true );
	}

	public virtual function Initialize( gameController : ComputerInkGameController, const widgetData : ref< SDocumentThumbnailWidgetPackage > )
	{
		RegisterThumbnailCallback( gameController );
		inkTextRef.SetText( m_displayNameWidget, widgetData.displayName );
		m_documentAdress = widgetData.documentAdress;
		m_documentType = widgetData.documentType;
		m_questInfo = widgetData.questInfo;
		if( widgetData.wasRead )
		{
			OpenDocument();
		}
		else
		{
			CloseDocument();
		}
		m_isInitialized = true;
		if( m_documentType == gameController.GetForceOpenDocumentType() && ( m_documentAdress == gameController.GetForceOpenDocumentAdress() ) )
		{
			gameController.OpenDocument( this );
			gameController.ResetForceOpenDocumentData();
		}
	}

	protected function RegisterThumbnailCallback( gameController : ComputerInkGameController )
	{
		if( !( m_isInitialized ) )
		{
			m_targetWidget.RegisterToCallback( 'OnRelease', gameController, 'OnDocumentThumbnailCallback' );
			RegisterAudioCallbacks( gameController );
		}
	}

	public override function ResolveSelection()
	{
		super.ResolveSelection();
		if( GetSelected() )
		{
		}
		else
		{
		}
	}

	public function OpenDocument()
	{
		if( m_documentType == EDocumentType.MAIL )
		{
			inkImageRef.SetTexturePart( m_documentIconWidget, 'iconMailRead' );
		}
		else if( m_documentType == EDocumentType.FILE )
		{
			inkImageRef.SetTexturePart( m_documentIconWidget, 'iconMailRead' );
		}
	}

	public function CloseDocument()
	{
		if( m_documentType == EDocumentType.MAIL )
		{
			inkImageRef.SetTexturePart( m_documentIconWidget, 'iconMailUnread' );
		}
		else if( m_documentType == EDocumentType.FILE )
		{
			inkImageRef.SetTexturePart( m_documentIconWidget, 'iconMailUnread' );
		}
	}

	public function GetDocumentAdress() : SDocumentAdress
	{
		return m_documentAdress;
	}

	public function GetDocumentType() : EDocumentType
	{
		return m_documentType;
	}

	public function GetQuestInfo() : QuestInfo
	{
		return m_questInfo;
	}

}

