﻿package com.adobe.captivate.widgets
{
	public class CPMovieHandle
	{
		private var _widgetParams:Function;
		private var _replaceVariables:Function;
		private var _getContainerProps:Function;
		private var _getSlideProps:Function;
		private var _getMovieProps:Function;
		private var _isWidgetVisible:Function;
		private var _isWidgetEnabled:Function;
		
		public function CPMovieHandle(aWidgetParams:Function=null,aReplaceVariables:Function=null,aGetContainerProps:Function=null,
			aGetSlideProps:Function=null,aGetMovieProps:Function=null,aIsWidgetVisible:Function=null,aIsWidgetEnabled:Function=null)
		{
			_widgetParams = aWidgetParams;
			_replaceVariables = aReplaceVariables;
			_getContainerProps = aGetContainerProps;
			_getSlideProps = aGetSlideProps;
			_getMovieProps = aGetMovieProps;
			_isWidgetVisible = aIsWidgetVisible;
			_isWidgetEnabled = aIsWidgetEnabled;
		}
		
		public function widgetParams() :String
		{
			var lWidgetParams:String = "";
			if(_widgetParams!= null)
			{
				lWidgetParams = _widgetParams();
			}
			return lWidgetParams;
		}
		
		public function replaceVariables( varString:String ) :String
		{
			var replacedString = "";
			if(_replaceVariables != null)
			{
				replacedString  = _replaceVariables(varString);
			}
			return replacedString;
		}
		
		public function getContainerProps() :CPContainerProperties
		{
			var lProps:CPContainerProperties = null;
			if(_getContainerProps != null)
			{
				lProps = _getContainerProps();
			}
			return lProps;
		}
		
		public function getSlideProps() :CPSlideProperties
		{
			var lSlideProps:CPSlideProperties = null;
			if(_getSlideProps != null)
			{
				lSlideProps = _getSlideProps();
			}
			return lSlideProps;
		}
		
		public function getMovieProps() :CPMovieProperties
		{
			var lMovieProps:CPMovieProperties  = null;
			if(_getMovieProps != null)
			{
				lMovieProps = _getMovieProps();
			}
			return lMovieProps;
		}
		
		public function isWidgetVisible() :Boolean
		{
			var lVisibilty:Boolean = false;
			if( _isWidgetVisible != null )
			{ 
				lVisibilty = _isWidgetVisible();
			}
			return lVisibilty;
		}
		
		
		public function isWidgetEnabled():Boolean
		{
			var lEnabled:Boolean = false;
			if( _isWidgetEnabled != null )
			{
				lEnabled = _isWidgetEnabled();
			}
			return lEnabled;
		}
		
	}
}

