using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace MetaEditor.Controls
{
    public partial class Enum : UserControl
    {
        public Type type;

        public Enum(byte value, string[] options, string name)
        {
            InitializeComponent();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = value;
            label2.Text = name;
            type = typeof(byte);
        }
        public Enum(short value, string[] options, string name)
        {
            InitializeComponent();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = value;
            label2.Text = name;
            type = typeof(short);
        }
        public Enum(int value, string[] options, string name)
        {
            InitializeComponent();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = value;
            label2.Text = name;
            type = typeof(int);
        }
        public Enum(long value, string[] options, string name)
        {            
            InitializeComponent();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = (int)value;
            label2.Text = name;
            type = typeof(long);
        }

        public void Reload(byte value, string[] options)
        {
            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = value;
        }

        public void Reload(short value, string[] options)
        {
            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = value;
        }

        public void Reload(int value, string[] options)
        {
            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = value;
        }

        public void Reload(long value, string[] options)
        {
            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(options);
            comboBox1.SelectedIndex = (int)value;
        }

        public string ReturnName()
        {
            return label2.Text.Replace(' ', '_');
        }

        public byte ReturnByteValue()
        {
            return (byte)comboBox1.SelectedIndex;
        }

        public short ReturnShortValue()
        {
            return (short)comboBox1.SelectedIndex;
        }

        public int ReturnIntValue()
        {
            return comboBox1.SelectedIndex;
        }

        public long ReturnLongValue()
        {
            return (long)comboBox1.SelectedIndex;
        }
    }
}
