using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DWSIM.UI.Shared;
using Eto.Forms;
using Eto.Drawing;
namespace DWSIM.ExtensionMethods.Eto
{
///
/// Eto.Forms extension methods
///
public static class Extensions2
{
///
/// Gets a standard form window to display
///
/// Title of the form
/// Width in pixels
/// Height in pixels
/// Form contents (DynamicLayout)
///
public static Form GetStandardForm(string title, int width, int height, DynamicLayout content)
{
return Common.GetDefaultEditorForm(title, width, height, content);
}
///
/// Gets a standard form window to display with scrollable contents
///
/// Title of the form
/// Width in pixels
/// Height in pixels
/// Form contents (DynamicLayout)
/// Contents are scrollable
///
public static Form GetStandardForm(string title, int width, int height, TableLayout content, bool scrollable)
{
return Common.GetDefaultEditorForm(title, width, height, content, scrollable);
}
///
/// Gets a Form window for multiple tabbed contents
///
/// Title of the form
/// Width in pixels
/// Height in pixels
/// List of controls to display in the tabs. Set the Tag property of the control to display as the tab text.
///
public static Form GetTabbedForm(string title, int width, int height, Control[] contents)
{
return Common.GetDefaultTabbedForm(title, width, height, contents);
}
///
/// Gets the standard control container (DynamicLayout)
///
///
public static DynamicLayout GetStandardContainer()
{
return Common.GetDefaultContainer();
}
///
/// Creates and returns a Dialog window.
///
/// Control to display in the dialog.
/// Title of the dialog.
/// Width in pixels
/// Height in pixels
///
public static Dialog CreateDialog(Control content, String title, int width = 0, int height = 0)
{
return Common.CreateDialog(content, title, width, height);
}
///
/// Adds a header text to the container.
///
/// Layout container
/// Label text
///
public static Label AddHeader(DynamicLayout container, string text)
{
return Common.CreateAndAddLabelRow(container, text);
}
///
/// Adds a description row to the container.
///
/// Layout container
/// Description text
///
public static Label AddDescription(DynamicLayout container, string text)
{
return Common.CreateAndAddDescriptionRow(container, text);
}
///
/// Adds a textbox for editing a double (numeric) value.
///
/// Layout container
/// Text (description)
/// Current value to display on the textbox
/// Number format (i.e. 'N2')
/// Handler for the TextChanged event.
///
public static TextBox AddEditTextBox(DynamicLayout container, string text, double currentvalue,
string numberformat = "", Action textchangedhandler = null)
{
if (numberformat == "") numberformat = "N2";
return Common.CreateAndAddTextBoxRow(container, numberformat, text, currentvalue, textchangedhandler);
}
///
/// Adds a DropDown with selectable items
///
/// Layout container
/// Text (description)
/// Selectable items
/// Index of the currently selected item (zero-based)
/// Handler for the SelectedIndexChanged event.
///
public static DropDown AddDropDown(DynamicLayout container, string text, List options, int selected,
Action selectedindexchangedhandler = null)
{
return Common.CreateAndAddDropDownRow(container, text, options, selected, selectedindexchangedhandler);
}
///
/// Adds a CheckBox
///
/// Layout container
/// Text (description)
///
/// Handler for the CheckedChanged event.
///
public static CheckBox AddCheckBox(DynamicLayout container, string text, bool ischecked,
Action checkedchangedhandler = null)
{
return Common.CreateAndAddCheckBoxRow(container, text, ischecked, checkedchangedhandler);
}
///
/// Adds a numeric stepper (selector)
///
/// Layout container
/// Text (description)
/// The current value of the stepper
/// Maximum selectable value
/// Minimum selectable value
/// Decimal places
/// Handler for the ValueChanged event
///
public static TextBox AddNumericStepper(DynamicLayout container, string text, double value,
double minvalue, double maxvalue, int decimalplaces, Action valuechangedhandler = null)
{
return Common.CreateAndAddNumericEditorRow2(container, text, value, minvalue, maxvalue, decimalplaces, valuechangedhandler);
}
///
/// Adds a button with a label.
///
/// Layout container
/// Text (description)
/// Text to be displayed in the button
/// Handler for the Click event.
///
public static Button AddButtonWithLabel(DynamicLayout container, string text, string buttontext, Action