1 // OpenTween - Client of Twitter
2 // Copyright (c) 2012 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3 // All rights reserved.
5 // This file is part of OpenTween.
7 // This program is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by the Free
9 // Software Foundation; either version 3 of the License, or (at your option)
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 // You should have received a copy of the GNU General Public License along
18 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20 // Boston, MA 02110-1301, USA.
23 using System.Collections.Generic;
24 using System.ComponentModel;
29 using System.Windows.Forms;
33 public partial class TabsDialog : OTBaseForm
35 private readonly TabInformations TabInfo;
37 private bool _MultiSelect = false;
38 public bool MultiSelect
40 get { return this._MultiSelect; }
41 set { this._MultiSelect = value; this.UpdateTabList(); }
44 protected internal class TabListItem
46 public TabClass Tab { get; set; }
47 public string Label { get; set; }
49 public override string ToString()
55 public TabsDialog(TabInformations tabinformation)
57 InitializeComponent();
59 this.TabInfo = tabinformation;
63 protected void UpdateTabList()
65 this.TabList.Items.Clear();
69 this.TabList.SelectionMode = SelectionMode.MultiExtended;
73 this.TabList.SelectionMode = SelectionMode.One;
75 this.TabList.Items.Add(new TabListItem
77 Label = Properties.Resources.AddNewTabText1,
82 foreach (var tab in this.TabInfo.Tabs)
84 if (!this.TabInfo.IsDistributableTab(tab.Key)) continue;
86 this.TabList.Items.Add(new TabListItem
94 private void TabList_DoubleClick(object sender, EventArgs e)
96 if (this.TabList.SelectedIndex == -1) return;
98 this.DialogResult = DialogResult.OK;
102 private void TabList_SelectedValueChanged(object sender, EventArgs e)
104 if (this.TabList.SelectedIndex == -1)
105 this.OK_Button.Enabled = false;
107 this.OK_Button.Enabled = true;
110 public TabClass SelectedTab
114 var item = this.TabList.SelectedItem as TabListItem;
115 if (item == null) return null;
121 public TabClass[] SelectedTabs
125 return this.TabList.SelectedItems