/// <summary> /// Initializes a new instance of the <see cref="DialogEntry"/> class. /// </summary> /// <param name="dialogEntry">The dialog entry.</param> public DialogEntry(DialogEntry dialogEntry) { this._id = dialogEntry.ID; this._title = dialogEntry.Title; this._help = dialogEntry.Help; this._type = dialogEntry.Type; this.ParentEntry = dialogEntry.ParentEntry; this.ParentDialog = dialogEntry.ParentDialog; this.Status = dialogEntry.Status; if (Type == DialogEntryType.Group) { childEntries = dialogEntry.GetChildEntryList(); } }
/// <summary> /// Initializes a new instance of the <see cref="DialogEntry" /> class. /// </summary> /// <param name="ID">The unique identifier.</param> /// <param name="text">The text that is displayed.</param> /// <param name="help">The help text explaining the functionality behind this entry.</param> /// <param name="type">The type defining its behavior.</param> /// <param name="status">The initial status.</param> /// <param name="parentEntry">The parent entry (must be some kind of group type).</param> /// <param name="parentDialog">The parent dialog this entry is related to. Can be <c>null</c> - when added to a Dialog this Field will be set automatically.</param> public SelfRenderingDialogEntry( string ID, string text, string help = "...", DialogEntryType type = DialogEntryType.Activation, DialogEntryStatus status = DialogEntryStatus.Normal, DialogEntry parentEntry = null, Dialog parentDialog = null) : base(ID, text, help, type, status, parentEntry, parentDialog) { Renderer.Entry = this; if (type == DialogEntryType.EditField) { Renderer = new EditFieldRenderer(); } }
/// <summary> /// Initializes a new instance of the <see cref="DialogEntry" /> class. /// </summary> /// <param name="ID">The unique identifier.</param> /// <param name="text">The text that is displayed.</param> /// <param name="help">The help text explaining the functionality behind this entry.</param> /// <param name="type">The type defining its behavior.</param> /// <param name="status">The initial status.</param> /// <param name="parentEntry">The parent entry (must be some kind of group type).</param> /// <param name="parentDialog">The parent dialog this entry is related to. Can be <c>null</c> - when added to a Dialog this Field will be set automatically.</param> public DialogEntry( string ID, string text, string help = "...", DialogEntryType type = DialogEntryType.Activation, DialogEntryStatus status = DialogEntryStatus.Normal, DialogEntry parentEntry = null, Dialog parentDialog = null) { this._id = ID; this._title = text; this._help = help; this.ParentEntry = parentEntry; this.ParentDialog = parentDialog; this.Type = type; this.Status = status; }
/// <summary> /// Builds a specialized dialog entry, based on the given <see cref="DialogEntryType"/>. /// </summary> /// <param name="type">The type of the entry.</param> /// <param name="id">The unique identifier. /// If an <see cref="Dialog"/> was set, the id is checked and adapted /// to be unique. So check after returning the element if you are /// not 100% sure that the id is unique.</param> /// <param name="title">The title of the entry (text that is displayed).</param> /// <param name="help">The help text for the entry. Giving details about the function or the behavior of the entry.</param> /// <param name="status">The initial status of the entry.</param> /// <param name="parent">The parent group if exist.</param> /// <param name="dialog">The dialog this entry should bee added.</param> /// <param name="callback">The callback function to call after activation.</param> /// <returns>An specialized <see cref="DialogEntryType"/>.</returns> public static DialogEntry BuildDialogEntry( DialogEntryType type, String id, String title, String help = "...", DialogEntryStatus status = DialogEntryStatus.Normal, DialogEntry parent = null, Dialog dialog = null, EntryActivation callback = null ) { DialogEntry entry = null; if (dialog == null && parent != null && parent.ParentDialog != null) { dialog = parent.ParentDialog; } id = check4uniqueID(id, parent, dialog); switch (type) { //case DialogEntryType.Unknown: // break; //case DialogEntryType.Activation: // break; //case DialogEntryType.Submenu: // break; case DialogEntryType.Group: entry = new Group_DialogEntry(id, title, help, parent, dialog); break; //case DialogEntryType.Checkbox: // break; case DialogEntryType.RadioButton: entry = new RadioButton_DialogEntry(id, title, help, status, parent, dialog); break; //case DialogEntryType.Button: // break; //case DialogEntryType.EditField: // break; default: entry = new SelfRenderingDialogEntry(id, title, help, type, status, parent, dialog); break; } if (entry == null) { return(null); } RegisterActivationCallbackToEntry(entry, callback); // parent handling if (parent != null) { parent.AddChild(entry); } return(entry); }
/// <summary> /// Initializes a new instance of the <see cref="DialogEntry_ToolStripMenuItem"/> class. /// </summary> /// <param name="dlgEntry">The dialog entry.</param> public DialogEntry_ToolStripMenuItem(DialogEntry dlgEntry) : base(dlgEntry) { Type = dlgEntry.Type; this.CheckOnClick = true; //Check for Types & Status, some coloring to differentiate between types for now switch (Type) { case DialogEntryType.Activation: break; case DialogEntryType.Button: this.Text = "btn:: " + this.Text; this.CheckOnClick = false; break; case DialogEntryType.Checkbox: this.Text = "[] " + this.Text; break; case DialogEntryType.EditField: EditField_DialogEntry efield = (EditField_DialogEntry)dlgEntry; if (efield.HasLabel) { if (efield.InputBox != null && !efield.InputBox.IsGraphical) { this.Text = efield.Label + this.Text; } else { this.Text = "ef:: " + efield.Label + this.Text; } } else { this.Text = "ef:: " + this.Text; } this.CheckOnClick = false; this.Enabled = false; break; case DialogEntryType.Group: this.CheckOnClick = false; this.Font = new System.Drawing.Font(this.Font, System.Drawing.FontStyle.Bold); break; case DialogEntryType.EditField_Label: this.CheckOnClick = false; this.Enabled = false; this.Font = new System.Drawing.Font(this.Font, System.Drawing.FontStyle.Italic); break; case DialogEntryType.Label: this.CheckOnClick = false; this.Enabled = false; break; case DialogEntryType.RadioButton: this.Text = "() " + this.Text; break; case DialogEntryType.Unknown: break; default: break; } DialogEntryStatus itemStatus = dlgEntry.Status; if (itemStatus.HasFlag(DialogEntryStatus.Checked)) { this.Checked = true; } if (itemStatus.HasFlag(DialogEntryStatus.Disabled)) { this.Enabled = false; this.Text = "xx" + this.Text; } dlgEntry.DialogEntryChanged += d_EntryChanged; }