OSDN Git Service

83debac92307e6a8ef6d5d131e5cc7f52ee93e51
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / TabBrowserWidget.java
1 /*
2  * This file is part of NeighborNote
3  * Copyright 2013 Yuki Takahashi
4  * 
5  * This file may be licensed under the terms of of the
6  * GNU General Public License Version 2 (the ``GPL'').
7  *
8  * Software distributed under the License is distributed
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
10  * express or implied. See the GPL for the specific language
11  * governing rights and limitations.
12  *
13  * You should have received a copy of the GPL along with this
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html
15  * or write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18 */
19
20 // ICHANGED
21 package cx.fbn.nevernote.gui;
22
23 import com.trolltech.qt.gui.QTabWidget;
24 import com.trolltech.qt.gui.QWidget;
25
26 import cx.fbn.nevernote.NeverNote;
27
28 public class TabBrowserWidget extends QTabWidget {
29         private final TabBrowserBar bar;
30         private final NeverNote parent;
31         
32         public TabBrowserWidget(NeverNote parent) {
33                 super(parent);
34                 this.parent = parent;
35                 bar = new TabBrowserBar();
36                 this.setTabBar(bar);
37                 bar.tabMoved.connect(parent, "tabIndexChanged(int, int)");
38         }
39         
40         public int addNewTab(QWidget widget, String title){
41                 int index = this.addTab(widget, new String());
42                 bar.addNewTab(index, title);
43                 this.setTabToolTip(index, title);
44                 return index;
45         }
46
47         public void setTabTitle(int index, String title) {
48                 bar.setTabTitle(index, title);
49                 this.setTabToolTip(index, title);
50         }
51         
52 }