/**************
FILE          : x11Dialog.ycp
***************
PROJECT       : YaST2
              :
AUTHOR        : Marcus Schäfer <ms@suse.de>
              :
BELONGS TO    : YaST2
              : (X11 integration part using SaX2/ISaX)
              :
DESCRIPTION   : UI part of the automatic X11 configuration
              : Authors:
              : Stefan Hundhammer <sh@suse.de>
              : extended by Thomas Roelz <tom@suse.de>
              :
STATUS        : Development
**************/
/**
 * File:        clients/x11Dialog.ycp
 * Package:     X11 Configuration
 * Summary:     GUI for X11 dialog
 * Authors:     Marcus Schaefer <ms@suse.de>
 *
 * $Id: x11Dialog.ycp 14267 2004-02-16 15:52:07Z ms $
 */
{
textdomain "x11";
import "Wizard";

	//==========================================
	// Create dialog for X11 automatic setup:
	// @param enable_x11 true if GUI by default,
	// false if text mode only
	//------------------------------------------
	define term X11AutoSetupDialog (
		boolean	enable_x11, string	auto_mode_description
	) ``{
		term radio_box = nil;
		radio_box =
		`RadioButtonGroup(`id(`rb),
		`VBox(
		`Left(
			`RadioButton(`id(`text_mode_only),
			`opt(`notify),
		    // Radio button: Disable X11 alltogether
		    _("&Text mode only -- no graphical desktop"), ! enable_x11 )
		),
		`VSpacing( 1 ),
		`Left(
			`RadioButton(`id(`auto_mode),
		    `opt(`notify),
		    // RadioButton: Select X11 (reasonable defaults suggested below)
		    _("&Graphical desktop environment"), enable_x11 )
		),
		`VSpacing( 0.3 ),
		`Left(
		`HBox(
		`HSpacing( 4 ),
		`Label(
			`id(`auto_mode_description),
			`opt(`outputField), auto_mode_description
		)
		)
		),
		`VSpacing( 0.8 ),
		`HBox(
		// PushButton: Change X11 settings
		`PushButton(`id(`change), _("C&hange...") ),
		// PushButton: Reprobe X11 settings
		`PushButton(`id(`reprobe), _("Re&probe...") )
		)
		)
		);

		term x11_setup_mode_dialog =
		`HVCenter(
		`HVSquash(
		`Frame( "",
		`VBox(
		`HBox(
			`HSpacing( 1 ),
			radio_box,
			`HSpacing( 3 )
			),
			`VSpacing( 0.5 )
		)
		)
		)
		);
		return x11_setup_mode_dialog;
	};

	//==========================================
	// Get help text for Resolution dialog
	// @return multi line help text in RichText
	// (HTML like) format
	//------------------------------------------
	define string X11AutoSetupDialogHelpText() ``{
		// ...
		// Helper text for X11 dialog description
		// pointing the possibility of either using X11 or textmode
		// ---
		string HelpText = _("
<p>Review the current desktop settings for the <i>X Window System</i>.

If you do not like them, you can <b>Change</b> the settings. You also have 
the choice to select <b>Text Mode Only</b> to skip the X 
configuration entirely. 

If you do that, you can always run <i>SaX2</i> 
later. If you choose <b>Graphical Desktop Environment</b>, the current 
settings will be saved when you select <b>Next</b>.</p>
");
		return HelpText;
	};


//=========================================
// WFM defines...
//-----------------------------------------
define void SetX11Mode() ``{
	UI::ChangeWidget(`id(`auto_mode_description),  `Enabled, true );
	UI::ChangeWidget(`id(`change), `Enabled, true );
	UI::ChangeWidget(`id(`reprobe),`Enabled, true );
	UI::ChangeWidget(`id(`rb), `CurrentButton, `auto_mode );
}

define void SetTextMode() ``{
	UI::ChangeWidget(`id(`auto_mode_description),  `Enabled, false );
	UI::ChangeWidget(`id(`change), `Enabled, false );
	UI::ChangeWidget(`id(`reprobe),`Enabled, false );
	UI::ChangeWidget(`id(`rb), `CurrentButton, `text_mode_only );
}
}
