• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • app
katetabwidget.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2005 Christoph Cullmann <cullmann@kde.org>
3 Copyright (C) 2002,2003 Joseph Wenninger <jowenn@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include "katetabwidget.h"
21#include "katetabwidget.moc"
22
23#include <tqtabbar.h>
24
25//BEGIN KateTabWidget
26
27KateTabWidget::KateTabWidget(TQWidget* parent, const char* name)
28 : KTabWidget(parent,name)
29 , m_visibility (ShowWhenMoreThanOneTab)
30{
31 tabBar()->hide();
32
33 setHoverCloseButton(true);
34
35 connect(this, TQ_SIGNAL(closeRequest(TQWidget*)), this, TQ_SLOT(closeTab(TQWidget*)));
36}
37
38KateTabWidget::~KateTabWidget()
39{
40}
41
42void KateTabWidget::closeTab(TQWidget* w)
43{
44 w->close();
45}
46
47void KateTabWidget::addTab ( TQWidget * child, const TQString & label )
48{
49 KTabWidget::addTab(child,label);
50 showPage(child);
51 maybeShow();
52}
53
54void KateTabWidget::addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label )
55{
56 KTabWidget::addTab(child,iconset,label);
57 showPage(child);
58 maybeShow();
59}
60
61void KateTabWidget::addTab ( TQWidget * child, TQTab * tab )
62{
63 KTabWidget::addTab(child,tab);
64 showPage(child);
65 maybeShow();
66}
67
68void KateTabWidget::insertTab ( TQWidget * child, const TQString & label, int index)
69{
70 KTabWidget::insertTab(child,label,index);
71 showPage(child);
72 maybeShow();
73 tabBar()->repaint();
74}
75
76void KateTabWidget::insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index )
77{
78 KTabWidget::insertTab(child,iconset,label,index);
79 showPage(child);
80 maybeShow();
81 tabBar()->repaint();
82}
83
84void KateTabWidget::insertTab ( TQWidget * child, TQTab * tab, int index)
85{
86 KTabWidget::insertTab(child,tab,index);
87 showPage(child);
88 maybeShow();
89 tabBar()->repaint();
90}
91
92void KateTabWidget::removePage ( TQWidget * w )
93{
94 KTabWidget::removePage(w);
95 maybeShow();
96}
97
98void KateTabWidget::maybeShow()
99{
100 switch (m_visibility)
101 {
102 case AlwaysShowTabs:
103 tabBar()->show();
104
105 // show/hide corner widgets
106 if (count() == 0)
107 setCornerWidgetVisibility(false);
108 else
109 setCornerWidgetVisibility(true);
110
111 break;
112
113 case ShowWhenMoreThanOneTab:
114 if (count()<2) tabBar()->hide();
115 else tabBar()->show();
116
117 // show/hide corner widgets
118 if (count() < 2)
119 setCornerWidgetVisibility(false);
120 else
121 setCornerWidgetVisibility(true);
122
123 break;
124
125 case NeverShowTabs:
126 tabBar()->hide();
127 break;
128 }
129}
130
131void KateTabWidget::setCornerWidgetVisibility(bool visible)
132{
133 // there are two corner widgets: on TopLeft and on TopTight!
134
135 if (cornerWidget(TQt::TopLeft) ) {
136 if (visible)
137 cornerWidget(TQt::TopLeft)->show();
138 else
139 cornerWidget(TQt::TopLeft)->hide();
140 }
141
142 if (cornerWidget(TQt::TopRight) ) {
143 if (visible)
144 cornerWidget(TQt::TopRight)->show();
145 else
146 cornerWidget(TQt::TopRight)->hide();
147 }
148}
149
150void KateTabWidget::setTabWidgetVisibility( TabWidgetVisibility visibility )
151{
152 m_visibility = visibility;
153 maybeShow();
154}
155
156KateTabWidget::TabWidgetVisibility KateTabWidget::tabWidgetVisibility( ) const
157{
158 return m_visibility;
159}
160
161//END KateTabWidget

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kate

Skip menu "kate"
  • kate
  • libkonq
  • twin
  •   lib
Generated for kate by doxygen 1.9.4
This website is maintained by Timothy Pearson.