public void setTagType(TagType t) { }
//this method creates all the buttons and labels necessary for tag creation void InitializeComponents() { this.TypeButtonIndex = 0; this.TagButtonIndex = 1; //many controls here use these dimensions, so this just makes it quicker Size standard = new Size(130, 20); //sets the TagCreators dimensions to whatever is put in those big global variables this.Size = new Size(WIDTH, HEIGHT); //all this is boring and kinda obvious so like... Label heading = new Label(); heading.Text = "Create New Tag"; heading.Size = new Size(150, 25); heading.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); heading.Location = new Point(xValue + 5, yValue + 5); Label tagNameLabel = new Label(); tagNameLabel.Text = "Tag Name"; tagNameLabel.Size = standard; tagNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); tagNameLabel.Location = new Point(xValue + 10, yValue + 40); TextBox tagNameTextBox = new TextBox(); tagNameTextBox.Size = standard; tagNameTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); tagNameTextBox.Location = new Point(xValue + 10, yValue + 70); Label tagTypeLabel = new Label(); tagTypeLabel.Text = "Tag Type"; tagTypeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); tagTypeLabel.Size = standard; tagTypeLabel.Location = new Point(xValue + 10, yValue + 100); //keep scrolling tagTypeBox = new ComboBox(); tagTypeBox.Size = standard; tagTypeBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); tagTypeBox.Location = new Point(xValue + 10, yValue + 130); tagTypeBox.DropDownStyle = ComboBoxStyle.DropDownList; Label createTypeLabel = new Label(); createTypeLabel.Text = "Create New Type"; createTypeLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); createTypeLabel.Size = standard; createTypeLabel.Location = new Point(xValue + 10, yValue + 165); Label typeNameLabel = new Label(); typeNameLabel.Text = "Tag Type Name"; typeNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); typeNameLabel.Size = standard; typeNameLabel.Location = new Point(xValue + 15, yValue + 200); //halfway there buddy TextBox typeNameBox = new TextBox(); typeNameBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); typeNameBox.Size = standard; typeNameBox.Location = new Point(xValue + 15, yValue + 230); CheckBox typeNsfw = new CheckBox(); typeNsfw.Text = "Set Type as NSFW"; typeNsfw.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); typeNsfw.Size = new Size(155, 25); typeNsfw.Location = new Point(xValue + 15, yValue + 260); Button createTypeButton = new Button(); createTypeButton.Text = "Create Type"; createTypeButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); createTypeButton.Size = new Size(150, 30); createTypeButton.Location = new Point(xValue + 15, yValue + 290); Label tagColorLabel = new Label(); tagColorLabel.Text = "Tag Color"; tagColorLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); tagColorLabel.Size = new Size(80, 20); tagColorLabel.Location = new Point(xValue + 10, yValue + 350); //almost there - but check my fancy ColorPicker class ColorPicker tagColorPicker = new ColorPicker(); tagColorPicker.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //apparently a ComboBox's height is based on font size...not the Size property //it took me a while to find that out... tagColorPicker.Width = 40; tagColorPicker.Location = new Point(xValue + 110, yValue + 350); CheckBox tagNsfw = new CheckBox(); tagNsfw.Text = "Set Tag as NSFW"; tagNsfw.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); tagNsfw.Size = new Size(170, 25); tagNsfw.Location = new Point(xValue + 10, yValue + 380); Button createTagButton = new Button(); createTagButton.Text = "Create Tag"; createTagButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); createTagButton.Size = new Size(135, 30); createTagButton.Location = new Point(xValue + 20, yValue + 420); //and this blob just adds all the controls to the TagControl, so you can see them and stuff this.Controls.Add(heading); this.Controls.Add(tagNameLabel); this.Controls.Add(tagNameTextBox); this.Controls.Add(tagTypeLabel); this.Controls.Add(tagTypeBox); this.Controls.Add(createTypeLabel); this.Controls.Add(typeNameLabel); this.Controls.Add(typeNameBox); this.Controls.Add(typeNsfw); this.Controls.Add(createTypeButton); this.Controls.Add(tagColorLabel); this.Controls.Add(tagColorPicker); this.Controls.Add(tagNsfw); this.Controls.Add(createTagButton); //places the TagCreator to wherever the x and y are this.Location = new Point(xValue, yValue); createTagButton.BringToFront(); createTypeButton.BringToFront(); createTypeButton.Click += new EventHandler(createTypeButton_Click); void createTypeButton_Click(object sender, EventArgs e) { //actual input validation needed if (typeNameBox.Text != null) //make sure name is valid { createdType = new TagType(typeNameBox.Text, typeNsfw.Checked); } else { MessageBox.Show("u messed up homeslice"); } } createTagButton.Click += new EventHandler(createTagButton_Click); void createTagButton_Click(object sender, EventArgs e) { //actual input validation needed if (tagNameTextBox.Text != null) //make sure name is valid { if (tagTypeBox.SelectedIndex != -1) //if theres a tagtype { int index = -1; for (int i = 0; i < types.Count; i++) { if (types[i].getName() == (string)tagTypeBox.SelectedItem) { index = i; } } createdTag = new Tag(tagNameTextBox.Text, tagColorPicker.getColor(), types[index], tagNsfw.Checked); } else // if there aint no tagtype { createdTag = new Tag(tagNameTextBox.Text, tagColorPicker.getColor(), tagNsfw.Checked); } } else { MessageBox.Show("u messed up homeslice"); } } }
public void setTagType(TagType t) { type = t; }
void InitializeComponents() { DeleteTypeButtonIndex = 1; ApplyChangesButtonIndex = 0; this.Size = new Size(WIDTH, HEIGHT); Size standard = new Size(150, 20); Label manageTypeLabel = new Label(); manageTypeLabel.Text = "Manage Tag Type"; manageTypeLabel.Font = new Font("Microsoft Sans Serif", 14F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); manageTypeLabel.Size = new Size(180, 25); manageTypeLabel.Location = new Point(xValue + 5, yValue + 5); Label typesLabel = new Label(); typesLabel.Text = "Tag Types"; typesLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); typesLabel.Size = standard; typesLabel.Location = new Point(xValue + 10, yValue + 35); typesList = new TTTDisplayer <TagType>(); typesList.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); typesList.Size = new Size(280, 200); typesList.Location = new Point(xValue + 10, yValue + 65); Label typeNameLabel = new Label(); typeNameLabel.Text = "Edit Type Name"; typeNameLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); typeNameLabel.Size = standard; typeNameLabel.Location = new Point(xValue + 10, yValue + 255); TextBox newTypeName = new TextBox(); newTypeName.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); newTypeName.Size = standard; newTypeName.Location = new Point(xValue + 10, yValue + 285); Label newNsfwLabel = new Label(); newNsfwLabel.Text = "Edit NSFW"; newNsfwLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); newNsfwLabel.Size = new Size(100, 20); newNsfwLabel.Location = new Point(xValue + 185, yValue + 255); CheckBox newNsfwCheck = new CheckBox(); newNsfwCheck.Size = new Size(50, 20); newNsfwCheck.Location = new Point(xValue + 220, yValue + 290); Button deleteTypeButton = new Button(); deleteTypeButton.Text = "Delete Tag"; deleteTypeButton.ForeColor = Color.Red; deleteTypeButton.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); deleteTypeButton.Size = new Size(120, 40); deleteTypeButton.Location = new Point(xValue + 25, yValue + 325); Button applyChangesButton = new Button(); applyChangesButton.Text = "Apply Changes"; applyChangesButton.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); applyChangesButton.Size = new Size(120, 40); applyChangesButton.Location = new Point(xValue + 160, yValue + 325); this.Controls.Add(manageTypeLabel); this.Controls.Add(typesLabel); this.Controls.Add(typesList); this.Controls.Add(typeNameLabel); this.Controls.Add(newTypeName); this.Controls.Add(newNsfwLabel); this.Controls.Add(newNsfwCheck); this.Controls.Add(deleteTypeButton); this.Controls.Add(applyChangesButton); this.Location = new Point(xValue, yValue); deleteTypeButton.BringToFront(); applyChangesButton.BringToFront(); typesList.SelectedIndexChanged += new EventHandler(typesList_Changed); void typesList_Changed(object sender, EventArgs e) { if (typesList.SelectedIndex != -1) { newTypeName.Text = types[typesList.SelectedIndex].getName(); newNsfwCheck.Checked = types[typesList.SelectedIndex].getNsfw(); } } deleteTypeButton.Click += new EventHandler(deleteTypeButton_Click); void deleteTypeButton_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure you want to delete this type", "Confirmation", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { if (typesList.SelectedIndex != -1) { types.RemoveAt(typesList.SelectedIndex); typesList.ClearSelected(); newTypeName.Text = ""; newNsfwCheck.Checked = false; } } } applyChangesButton.Click += new EventHandler(applyChangesButton_Click); void applyChangesButton_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure you want to edit this type", "Confirmation", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { if (typesList.SelectedIndex != -1) { TagType tt = new TagType(newTypeName.Text, newNsfwCheck.Checked); types[typesList.SelectedIndex] = tt; typesList.ClearSelected(); newTypeName.Text = ""; newNsfwCheck.Checked = false; } } } }