public AssetTypeDesc(AssetTypeEnum typeEnum, AssetTypeFileDesc[] fileTypes)
 {
     this.typeEnum = typeEnum;
     this.fileTypes = fileTypes;
 }
Exemplo n.º 2
0
        private int createAssetTypeFileControls(int index, int y, AssetTypeFileDesc desc, out FileDescControls c)
        {
            Control parentControl = this;
            c = new FileDescControls();
            c.desc = desc;
            c.tabIndex = assetTypeComboBox.TabIndex + 1 + index * 2;
            c.index = index;
            c.yCoord = y;
            int labelHeight = 36;
            if (desc.MaxCount == 1) {
                c.labelText = (desc.MinCount == 0 ? "Optional " : "") +
                    (desc.AdditionalText != "" ? desc.AdditionalText + " " : "") +
                    AssetFile.AssetFileEnumName(desc.FileTypeEnum);
                c.height = 40;
                c.useTextBox = true;
            }
            else {
                c.labelText = "Optional " + (desc.AdditionalText != "" ? desc.AdditionalText + " " : "") +
                               AssetFile.AssetFileEnumName(desc.FileTypeEnum) + "s";
                labelHeight = 72;
                c.height = 100;
                c.useTextBox = false;
            }
            int boxWidth = this.Width - genOffset - 94 - 67 - 18;
            int buttonLeft = genOffset + 101 + boxWidth;
            c.labelText += ":";
            Label label = new System.Windows.Forms.Label();
            label.AutoSize = false;
            label.TextAlign = ContentAlignment.MiddleRight;
            label.Location = new System.Drawing.Point(genOffset + 5, y - 6);
            label.Name = "AddLabel" + index;
            label.Size = new System.Drawing.Size(85, labelHeight);
            label.TabStop = false;
            label.Text = c.labelText;
            label.Parent = parentControl;
            c.label = label;

            Button button = new System.Windows.Forms.Button();
            button.Location = new System.Drawing.Point(buttonLeft, y);
            button.Name = "AddButton" + index;
            button.Size = new System.Drawing.Size(63, 24);
            button.TabIndex = c.tabIndex;
            button.Text = "Browse...";
            button.UseVisualStyleBackColor = true;
            button.Tag = c;
            button.Click += buttonSelect_Click;
            button.Parent = parentControl;
            c.button = button;

            if (c.useTextBox) {
                TextBox textBox = new System.Windows.Forms.TextBox();
                textBox.Location = new System.Drawing.Point(genOffset + 94, y);
                textBox.Name = "textBox1";
                textBox.Size = new System.Drawing.Size(boxWidth, 20);
                textBox.TabIndex = c.tabIndex + 1;
                textBox.Tag = c;
                textBox.Parent = parentControl;
                textBox.AllowDrop = true;
                textBox.DragDrop += new System.Windows.Forms.DragEventHandler(anyTextBox_DragDrop);
                textBox.DragOver += new System.Windows.Forms.DragEventHandler(anyTextBox_DragOver);
                textBox.TextChanged += new System.EventHandler(someTextBoxChanged);
                c.textBox = textBox;
            }
            else {
                ListBox listBox = new System.Windows.Forms.ListBox();
                listBox.FormattingEnabled = true;
                listBox.Location = new System.Drawing.Point(genOffset + 94, y);
                listBox.Name = "AddListBox" + index;
                listBox.Size = new System.Drawing.Size(boxWidth, 82);
                listBox.TabIndex = c.tabIndex + 1;
                listBox.Tag = c;
                listBox.Parent = parentControl;
                listBox.AllowDrop = true;
                listBox.DragDrop += new System.Windows.Forms.DragEventHandler(anyListBox_DragDrop);
                listBox.DragOver += new System.Windows.Forms.DragEventHandler(anyListBox_DragOver);
                listBox.MouseUp += new System.Windows.Forms.MouseEventHandler(anyListBox_MouseUp);
                listBox.MouseMove += new System.Windows.Forms.MouseEventHandler(anyListBox_MouseMove);
                listBox.MouseDown += new System.Windows.Forms.MouseEventHandler(anyListBox_MouseDown);

                c.listBox = listBox;
            }
            return y + c.height;
        }