コード例 #1
0
        public StandardAndCustomComboBox(string clearText, string chooseNewText)
            : base()
        {
            InitializeComponent();

            numOpener = 1;

            clearItem = new NiceComboBoxNormalItem(
                clearText,
                delegate(NiceComboBoxNormalItem i, EventArgs e)
            {
                clearCustomItems();
            });

            Items.Add(new NiceComboBoxNormalItem(
                          chooseNewText, null,
                          delegate(NiceComboBoxNormalItem i, EventArgs e)
            {
                object o = Getter();
                if (o != null)
                {
                    AddCustomItem(o);
                    SelectedObject = o;
                }
            }));
        }
コード例 #2
0
        void item_Click(object sender, EventArgs e)
        {
            ToolStripItem          i    = (ToolStripItem)sender;
            NiceComboBoxNormalItem item = (NiceComboBoxNormalItem)i.Tag;

            if (item.Selectable)
            {
                SelectedItem = item;
            }

            item.OnClick();
        }
コード例 #3
0
        public void SetFileSCBoxType(string chooseNewText, string chooseNewFolder, MeGUI.core.gui.FileSCBox.FileSCBoxType oType)
        {
            if (oType == FileSCBox.FileSCBoxType.OC_FILE_AND_FOLDER || oType == FileSCBox.FileSCBoxType.OC_FILE)
            {
                Items.Clear();
                clearItem = null;

                numOpener = 1;

                Items.Add(new NiceComboBoxNormalItem(
                              chooseNewText, null,
                              delegate(NiceComboBoxNormalItem i, EventArgs e)
                {
                    object o = Getter();
                    if (o != null)
                    {
                        AddCustomItem(o);
                        SelectedObject = o;
                    }
                }));
            }
            if (oType == FileSCBox.FileSCBoxType.OC_FILE_AND_FOLDER)
            {
                numOpener = 2;

                Items.Add(new NiceComboBoxNormalItem(
                              chooseNewFolder, null,
                              delegate(NiceComboBoxNormalItem i, EventArgs e)
                {
                    object o = GetterFolder();
                    if (o != null)
                    {
                        AddCustomItem(o);
                        SelectedObject = o;
                    }
                }));
            }
            numStandardItems = numCustomItems = 0;
        }
コード例 #4
0
        public void SetTargetSizeSCBoxType(string clearText, string chooseCustomSize)
        {
            Items.Clear();
            numOpener        = 1;
            numStandardItems = numCustomItems = 0;

            Items.Add(new NiceComboBoxNormalItem(
                          chooseCustomSize, null,
                          delegate(NiceComboBoxNormalItem i, EventArgs e)
            {
                object o = Getter();
                if (o != null)
                {
                    if (bSaveEveryItem)
                    {
                        AddCustomItem(o);
                        SelectedObject = o;
                    }
                    else
                    {
                        oTemporaryItem.Tag = o;
                        SelectedItem       = null;
                    }
                }
            }));

            clearItem = new NiceComboBoxNormalItem(
                clearText,
                delegate(NiceComboBoxNormalItem i, EventArgs e)
            {
                clearCustomItems();
            });

            if (!bSaveEveryItem)
            {
                clearItem = null;
            }
        }