2 * This file is part of NeighborNote
3 * Copyright 2013 Yuki Takahashi
5 * This file may be licensed under the terms of of the
6 * GNU General Public License Version 2 (the ``GPL'').
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.
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.
21 package cx.fbn.nevernote.gui;
23 import com.trolltech.qt.gui.QTabWidget;
24 import com.trolltech.qt.gui.QWidget;
26 import cx.fbn.nevernote.NeverNote;
28 public class TabBrowserWidget extends QTabWidget {
29 private final TabBrowserBar bar;
30 private final NeverNote parent;
32 public TabBrowserWidget(NeverNote parent) {
35 bar = new TabBrowserBar();
37 bar.tabMoved.connect(parent, "tabIndexChanged(int, int)");
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);
47 public void setTabTitle(int index, String title) {
48 bar.setTabTitle(index, title);
49 this.setTabToolTip(index, title);
52 public int insertNewTab(int index, QWidget widget, String title) {
53 int trueIndex = this.insertTab(index, widget, new String());
54 bar.addNewTab(trueIndex, title);
55 this.setTabToolTip(trueIndex, title);