1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 // (c) 2008-2011 Moz (@syo68k)
4 // (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 // (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 // (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 // (c) 2011 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
10 // This file is part of OpenTween.
12 // This program is free software; you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 3 of the License, or (at your option)
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 // Boston, MA 02110-1301, USA.
28 using System.Collections.Generic;
29 using System.ComponentModel;
34 using System.Windows.Forms;
35 using System.Collections.Specialized;
39 public partial class TabsDialog : Form
41 private bool _multiSelect = false;
42 private string _newtabItem = Properties.Resources.AddNewTabText1;
46 InitializeComponent();
49 public TabsDialog(bool multiselect)
52 InitializeComponent();
54 // InitializeComponent() 呼び出しの後で初期化を追加します。
56 this.MultiSelect = true;
60 private void TabsDialog_Load(object sender, EventArgs e)
64 TabList.SelectedIndex = -1;
68 if (TabList.SelectedIndex == -1) TabList.SelectedIndex = 0;
72 public void AddTab(string tabName)
74 foreach (string obj in TabList.Items)
76 if (obj == tabName) return;
78 TabList.Items.Add(tabName);
81 public void RemoveTab(string tabName)
83 for (int i = 0; i < TabList.Items.Count; i++)
85 if (((string)TabList.Items[i]) == tabName)
87 TabList.Items.RemoveAt(i);
93 public void ClearTab()
101 for (int i = startidx; i < TabList.Items.Count; i++)
103 TabList.Items.RemoveAt(0);
107 public string SelectedTabName
111 if (TabList.SelectedIndex == -1)
114 return (string)TabList.SelectedItem;
118 public StringCollection SelectedTabNames
122 if (TabList.SelectedIndex == -1)
128 StringCollection ret = new StringCollection();
129 foreach (object selitem in TabList.SelectedItems)
131 ret.Add((string)selitem);
138 public bool MultiSelect
140 get { return _multiSelect; }
143 _multiSelect = value;
146 this.TabList.SelectionMode = SelectionMode.MultiExtended;
147 if (this.TabList.Items[0].ToString() == Properties.Resources.AddNewTabText1)
149 this.TabList.Items.RemoveAt(0);
154 this.TabList.SelectionMode = SelectionMode.One;
155 if (this.TabList.Items[0].ToString() != Properties.Resources.AddNewTabText1)
157 this.TabList.Items.Insert(0, Properties.Resources.AddNewTabText1);
163 private void TabList_SelectedIndexChanged(object sender, EventArgs e)
167 private void TabList_DoubleClick(object sender, EventArgs e)
169 if (TabList.SelectedItem == null)
174 if (TabList.IndexFromPoint(TabList.PointToClient(Control.MousePosition)) == ListBox.NoMatches)
179 this.DialogResult = DialogResult.OK;
183 private void TabsDialog_Shown(object sender, EventArgs e)