Changeset 2891 for trunk/sources/HeuristicLab.Parameters.Views
- Timestamp:
- 03/01/10 04:46:06 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Parameters.Views/3.3
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Parameters.Views/3.3/HeuristicLab.Parameters.Views-3.3.csproj
r2852 r2891 74 74 <Compile Include="ConstrainedValueParameterView.Designer.cs"> 75 75 <DependentUpon>ConstrainedValueParameterView.cs</DependentUpon> 76 </Compile> 77 <Compile Include="OptionalValueParameterView.cs"> 78 <SubType>UserControl</SubType> 79 </Compile> 80 <Compile Include="OptionalValueParameterView.Designer.cs"> 81 <DependentUpon>OptionalValueParameterView.cs</DependentUpon> 76 82 </Compile> 77 83 <Compile Include="ValueLookupParameterView.cs"> -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.Designer.cs
r2796 r2891 33 33 protected override void Dispose(bool disposing) { 34 34 if (disposing) { 35 if (typeSelectorDialog != null) typeSelectorDialog.Dispose();36 35 if (components != null) components.Dispose(); 37 36 } … … 46 45 /// </summary> 47 46 private void InitializeComponent() { 48 this.components = new System.ComponentModel.Container();49 47 this.valueGroupBox = new System.Windows.Forms.GroupBox(); 50 48 this.valuePanel = new System.Windows.Forms.Panel(); 51 49 this.viewHost = new HeuristicLab.Core.Views.ViewHost(); 52 this.clearValueButton = new System.Windows.Forms.Button();53 this.setValueButton = new System.Windows.Forms.Button();54 this.toolTip = new System.Windows.Forms.ToolTip(this.components);55 50 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 56 51 this.valueGroupBox.SuspendLayout(); … … 81 76 | System.Windows.Forms.AnchorStyles.Right))); 82 77 this.valueGroupBox.Controls.Add(this.valuePanel); 83 this.valueGroupBox.Controls.Add(this.clearValueButton);84 this.valueGroupBox.Controls.Add(this.setValueButton);85 78 this.valueGroupBox.Location = new System.Drawing.Point(0, 120); 86 79 this.valueGroupBox.Name = "valueGroupBox"; … … 97 90 | System.Windows.Forms.AnchorStyles.Right))); 98 91 this.valuePanel.Controls.Add(this.viewHost); 99 this.valuePanel.Location = new System.Drawing.Point(6, 49);92 this.valuePanel.Location = new System.Drawing.Point(6, 19); 100 93 this.valuePanel.Name = "valuePanel"; 101 this.valuePanel.Size = new System.Drawing.Size(374, 1 40);94 this.valuePanel.Size = new System.Drawing.Size(374, 170); 102 95 this.valuePanel.TabIndex = 0; 103 96 this.valuePanel.DragOver += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver); … … 111 104 this.viewHost.Location = new System.Drawing.Point(0, 0); 112 105 this.viewHost.Name = "viewHost"; 113 this.viewHost.Size = new System.Drawing.Size(374, 1 40);106 this.viewHost.Size = new System.Drawing.Size(374, 170); 114 107 this.viewHost.TabIndex = 0; 115 // 116 // clearValueButton 117 // 118 this.clearValueButton.Enabled = false; 119 this.clearValueButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Remove; 120 this.clearValueButton.Location = new System.Drawing.Point(36, 19); 121 this.clearValueButton.Name = "clearValueButton"; 122 this.clearValueButton.Size = new System.Drawing.Size(24, 24); 123 this.clearValueButton.TabIndex = 1; 124 this.toolTip.SetToolTip(this.clearValueButton, "Clear Value"); 125 this.clearValueButton.UseVisualStyleBackColor = true; 126 this.clearValueButton.Click += new System.EventHandler(this.clearValueButton_Click); 127 // 128 // setValueButton 129 // 130 this.setValueButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Add; 131 this.setValueButton.Location = new System.Drawing.Point(6, 19); 132 this.setValueButton.Name = "setValueButton"; 133 this.setValueButton.Size = new System.Drawing.Size(24, 24); 134 this.setValueButton.TabIndex = 0; 135 this.toolTip.SetToolTip(this.setValueButton, "Set Value"); 136 this.setValueButton.UseVisualStyleBackColor = true; 137 this.setValueButton.Click += new System.EventHandler(this.setValueButton_Click); 108 this.viewHost.ViewType = null; 138 109 // 139 110 // ValueParameterView … … 164 135 protected System.Windows.Forms.Panel valuePanel; 165 136 protected HeuristicLab.Core.Views.ViewHost viewHost; 166 protected System.Windows.Forms.Button setValueButton;167 protected System.Windows.Forms.ToolTip toolTip;168 protected System.Windows.Forms.Button clearValueButton;169 137 } 170 138 } -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs
r2890 r2891 30 30 /// The visual representation of a <see cref="Parameter"/>. 31 31 /// </summary> 32 [Content(typeof(OptionalValueParameter<>), true)] 33 [Content(typeof(IValueParameter<>), false)] 32 [Content(typeof(ValueParameter<>), true)] 34 33 public partial class ValueParameterView<T> : ParameterView where T : class, IItem { 35 protected TypeSelectorDialog typeSelectorDialog;36 37 34 /// <summary> 38 35 /// Gets or sets the variable to represent visually. … … 40 37 /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>. 41 38 /// No own data storage present.</remarks> 42 public new IValueParameter<T> Content {43 get { return ( IValueParameter<T>)base.Content; }39 public new ValueParameter<T> Content { 40 get { return (ValueParameter<T>)base.Content; } 44 41 set { base.Content = value; } 45 42 } … … 57 54 /// <remarks>Calls <see cref="VariableView()"/>.</remarks> 58 55 /// <param name="variable">The variable to represent visually.</param> 59 public ValueParameterView( IValueParameter<T> content)56 public ValueParameterView(ValueParameter<T> content) 60 57 : this() { 61 58 Content = content; … … 84 81 if (Content == null) { 85 82 Caption = "ValueParameter"; 86 setValueButton.Enabled = false;87 clearValueButton.Enabled = false;88 83 viewHost.Content = null; 89 84 valueGroupBox.Enabled = false; 90 85 } else { 91 86 Caption = Content.Name + " (" + Content.GetType().Name + ")"; 92 setValueButton.Enabled = Content.Value == null;93 clearValueButton.Enabled = Content.Value != null;94 87 valueGroupBox.Enabled = true; 95 88 viewHost.Content = Content.Value; … … 101 94 Invoke(new EventHandler(Content_ValueChanged), sender, e); 102 95 else { 103 setValueButton.Enabled = Content.Value == null;104 clearValueButton.Enabled = Content.Value != null;105 96 viewHost.Content = Content.Value; 106 97 } 107 98 } 108 99 109 protected virtual void setValueButton_Click(object sender, EventArgs e) {110 if (typeSelectorDialog == null) {111 typeSelectorDialog = new TypeSelectorDialog();112 typeSelectorDialog.Caption = "Select Value";113 typeSelectorDialog.TypeSelector.Configure(Content.DataType, false, false);114 }115 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK)116 Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();117 }118 protected virtual void clearValueButton_Click(object sender, EventArgs e) {119 Content.Value = null;120 }121 100 protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) { 122 101 e.Effect = DragDropEffects.None;
Note: See TracChangeset
for help on using the changeset viewer.