// Copyright (C) 1997-2004 Alias Systems Corp.
// 
// The information in this file is provided for the exclusive use of the
// licensees of Alias.  Such users have the right to use, modify,
// and incorporate this code into other products for purposes authorized
// by the Alias license agreement, without fee.
// 
// ALIAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
// EVENT SHALL ALIAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

//
//  Alias Script File
//  MODIFY THIS AT YOUR OWN RISK
//
//  Creation Date:  November 6, 1996
//
//  Description:
//      This script defines the appearance for option box dialogs
//
//  Input Arguments:
//      string $optionBoxTitle	The title of the option box dialog
//		int $numPages			The number of pages that this dialog
//								will display
//		string $options			Options for this dialog
//								Option words are specified within the
//								the string, with each option seperated
//								by a space (e.g. "noScroll otherOption")
//
//			Current options:
//				noOptions		A nice "do nothing" string to pass
//				noScroll		Make the tabLayout non-scrollable
//
//  Return Value:
//      string[] where:
//			[0]		Name of the window
//			[1]		Name of the formLayout
//			[2]		Name of the tabLayout
//			[3]		Name of the help menu item
//		Note: add new return names below here
//
global proc string[]
getStandardWindow (string $optionBoxTitle, int $numPages, string $options)
{
	//	Global variables... from getOptionBox
	//
	global string $gOptionBox;
	global string $gOptionBoxTabLayout;
	global string $gOptionBoxApplyBtn;
	global string $gOptionBoxResetBtn;
	global string $gOptionBoxCloseBtn;
	global string $gOptionBoxSaveBtn;

	global int $gStandardWindowWidthIndex;
	string $widgetList[4];

	// Get the new standard option box
	//
	string $optionBoxTab = getOptionBox();

	string $optionBoxName = $gOptionBox;
	string $topLayoutName = "BoxLayout";

	// See if the option box window already exists
	//
	if ( `window -exists $optionBoxName` ){

		// It exists.
		//
		$widgetList[0] = $optionBoxName;

		// Put the new title on it
		//
		setOptionBoxTitle ($optionBoxTitle);

		// Create the new top level layout
		//
		setParent $optionBoxName;
		setParent $optionBoxTab;
		$widgetList[1] = `formLayout $topLayoutName`;
		// Get rid of the old content; add in the new layout
		//
		setParent $widgetList[1];
	} else {
		error -showLineNumber 1 "Option Box window does not exist.";
	}

	$widgetList[2] = `tabLayout
		-scrollable (match ("noScroll", $options) == "")
		-minChildWidth 100
		-childResizable true`;
	if ($numPages < 2) {
		tabLayout -edit
			-tabsVisible false
			$widgetList[2];
	}
	formLayout -edit
		-attachForm $widgetList[2] "top"    0
		-attachForm $widgetList[2] "left"   0
		-attachForm $widgetList[2] "bottom" 0
		-attachForm $widgetList[2] "right"  0
		$widgetList[1];

	$widgetList[3] = getOptionBoxHelpItem();
	menuItem -edit
		-label "Help with "
		$widgetList[3];

	return ($widgetList);
}
