/usr/include/ktabwidget.h is in kdelibs5-dev 4:4.14.38-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | /* This file is part of the KDE libraries
Copyright (C) 2003 Stephan Binner <binner@kde.org>
Copyright (C) 2003 Zack Rusin <zack@kde.org>
Copyright (C) 2009 Urs Wolfer <uwolfer @ kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KTABWIDGET_H
#define KTABWIDGET_H
#include <kdeui_export.h>
#include <QtGui/QTabWidget>
class QTab;
/**
* \brief A widget containing multiple tabs
*
* It extends the Qt QTabWidget, providing extra optionally features such as close buttons when you hover
* over the icon in the tab, and also adds functionality such as responding to mouse wheel scroll events to switch
* the active tab.
*
* It is recommended to use KTabWidget instead of QTabWidget unless you have a good reason not to.
*
* See also the QTabWidget documentation.
*
* \image html ktabwidget.png "KDE Tab Widget"
*/
class KDEUI_EXPORT KTabWidget : public QTabWidget //krazy:exclude=qclasses
{
Q_OBJECT
#ifndef KDE_NO_DEPRECATED
Q_PROPERTY( bool tabReorderingEnabled READ isTabReorderingEnabled WRITE setTabReorderingEnabled )
Q_PROPERTY( bool hoverCloseButton READ hoverCloseButton WRITE setHoverCloseButton )
Q_PROPERTY( bool hoverCloseButtonDelayed READ hoverCloseButtonDelayed WRITE setHoverCloseButtonDelayed )
Q_PROPERTY( bool closeButtonEnabled READ isCloseButtonEnabled WRITE setCloseButtonEnabled )
Q_PROPERTY( bool tabCloseActivatePrevious READ tabCloseActivatePrevious WRITE setTabCloseActivatePrevious )
#endif
Q_PROPERTY( bool automaticResizeTabs READ automaticResizeTabs WRITE setAutomaticResizeTabs )
public:
/**
* Creates a new tab widget.
*
* @param parent The parent widgets.
* @param flags The Qt window flags @see QWidget.
*/
explicit KTabWidget( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
/**
* Destroys the tab widget.
*/
virtual ~KTabWidget();
/**
* Set the tab of the given widget to \a color.
* This is simply a convenience method for QTabBar::setTabTextColor.
*/
void setTabTextColor( int index, const QColor& color );
/**
* Returns the tab color for the given widget.
* This is simply a convenience method for QTabBar::tabTextColor.
*/
QColor tabTextColor( int index ) const;
/**
* Returns true if tab ordering with the middle mouse button
* has been enabled.
*
* @deprecated Use QTabWidget::isMovable() instead.
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED bool isTabReorderingEnabled() const;
#endif
/**
* Returns true if the close button is shown on tabs
* when mouse is hovering over them.
*
* @deprecated Use QTabWidget::tabsClosable() instead.
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED bool hoverCloseButton() const;
#endif
/**
* Returns true if the close button is shown on tabs
* after a delay.
*
* @deprecated Use QTabWidget::setTabsClosable() instead.
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED bool hoverCloseButtonDelayed() const;
#endif
/**
* Returns true if the close button is shown on tabs.
*
* @since 4.1
*
* @deprecated Use QTabWidget::tabsClosable() instead.
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED bool isCloseButtonEnabled() const;
#endif
/**
* Returns true if closing the current tab activates the previous
* actice tab instead of the one to the right.
*
* @deprecated Use tabBar()->selectionBehaviorOnRemove() instead.
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED bool tabCloseActivatePrevious() const;
#endif
/**
* Returns true if calling setTitle() will resize tabs
* to the width of the tab bar.
*/
bool automaticResizeTabs() const;
/**
* If \a hide is true, the tabbar is hidden along with any corner
* widgets.
*/
void setTabBarHidden( bool hide );
/**
* Returns true if the tabbar was hidden by a call to setTabBarHidden( true ).
* Returns false if the widget itself is hidden, but no call to setTabBarHidden( true )
* has been made.
*/
bool isTabBarHidden() const;
/**
Reimplemented for internal reasons.
*
virtual void insertTab( QWidget *, const QString &, int index = -1 );
*!
Reimplemented for internal reasons.
*
virtual void insertTab( QWidget *child, const QIcon& iconset,
const QString &label, int index = -1 );
*!
Reimplemented for internal reasons.
*
virtual void insertTab( QWidget *, QTab *, int index = -1 );*/
/**
* Reimplemented for internal reasons.
*/
QString tabText( int ) const; // but it's not virtual...
#ifdef KDE3_SUPPORT
/**
* @deprecated use tabText
*/
#ifndef KDE_NO_DEPRECATED
inline KDE_DEPRECATED QString label( int index ) const { return tabText( index ); }
#endif
/**
* @deprecated use tabText
*/
#ifndef KDE_NO_DEPRECATED
inline KDE_DEPRECATED QString tabLabel( QWidget *w ) const { return tabText( indexOf( w ) ); }
#endif
/**
* @deprecated use setTabText
*/
#ifndef KDE_NO_DEPRECATED
inline KDE_DEPRECATED void setTabLabel( QWidget *w, const QString &l ) { setTabText( indexOf( w ),l ); }
#endif
#endif
/**
* Reimplemented for internal reasons.
*/
void setTabText( int , const QString & );
using QTabWidget::tabBar;
public Q_SLOTS:
/**
* Move a widget's tab from first to second specified index and emit
* signal movedTab( int, int ) afterwards.
*/
virtual void moveTab( int, int );
/**
* Removes the widget, reimplemented for
* internal reasons (keeping labels in sync).
* @deprecated since 4.0
*/
virtual QT_MOC_COMPAT void removePage ( QWidget * w );
/**
* Removes the widget, reimplemented for
* internal reasons (keeping labels in sync).
*/
virtual void removeTab(int index); // but it's not virtual in QTabWidget...
/**
* If \a enable is true, tab reordering with middle button will be enabled.
*
* Note that once enabled you shouldn't rely on previously queried
* currentPageIndex() or indexOf( QWidget * ) values anymore.
*
* You can connect to signal movedTab(int, int) which will notify
* you from which index to which index a tab has been moved.
*
* @deprecated Use QTabWidget::setMovable() instead.
*
* Note, however, that QTabWidget::setMovable(true) disables
* dragging tabs out of the KTabBar (e.g., dragging the tab
* URL from Konqueror to another application)!
*/
#ifndef KDE_NO_DEPRECATED
QT_MOC_COMPAT void setTabReorderingEnabled( bool enable );
#endif
/**
* If \a enable is true, a close button will be shown on mouse hover
* over tab icons which will emit signal closeRequest( QWidget * )
* when pressed.
*
* @deprecated Use QTabWidget::setTabsClosable() instead.
*/
#ifndef KDE_NO_DEPRECATED
QT_MOC_COMPAT void setHoverCloseButton( bool enable );
#endif
/**
* If \a delayed is true, a close button will be shown on mouse hover
* over tab icons after mouse double click delay else immediately.
*
* @deprecated Use QTabWidget::setTabsClosable() instead.
*/
#ifndef KDE_NO_DEPRECATED
QT_MOC_COMPAT void setHoverCloseButtonDelayed( bool delayed );
#endif
/**
* If enabled, a close button is available for each tab. The
* signal KTabWidget::closeRequest() is emitted, if the close button
* has been clicked.
*
* @since 4.1
*
* @deprecated Use QTabWidget::setTabsClosable() instead.
*/
#ifndef KDE_NO_DEPRECATED
QT_MOC_COMPAT void setCloseButtonEnabled( bool );
#endif
/**
* If \a previous is true, closing the current tab activates the
* previous active tab instead of the one to the right.
*
* @deprecated Use tabBar()->setSelectionBehaviorOnRemove() instead.
*/
#ifndef KDE_NO_DEPRECATED
QT_MOC_COMPAT void setTabCloseActivatePrevious( bool previous );
#endif
/**
* If \a enable is true, tabs will be resized to the width of the tab bar.
*
* Does not work reliably with "QTabWidget* foo=new KTabWidget()" and if
* you change tabs via the tabbar or by accessing tabs directly.
*/
void setAutomaticResizeTabs( bool enable );
Q_SIGNALS:
/**
* Connect to this and set accept to true if you can and want to decode the event.
*/
void testCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
/**
* Received an event in the empty space beside tabbar. Usually creates a new tab.
* This signal is only possible after testCanDecode and positive accept result.
*/
void receivedDropEvent( QDropEvent * );
/**
* Received an drop event on given widget's tab.
* This signal is only possible after testCanDecode and positive accept result.
*/
void receivedDropEvent( QWidget *, QDropEvent * );
/**
* Request to start a drag operation on the given tab.
*/
void initiateDrag( QWidget * );
/**
* The right mouse button was pressed over empty space besides tabbar.
*/
void contextMenu( const QPoint & );
/**
* The right mouse button was pressed over a widget.
*/
void contextMenu( QWidget *, const QPoint & );
#ifndef KDE_NO_DEPRECATED
/**
* A tab was moved from first to second index. This signal is only
* possible after you have called setTabReorderingEnabled( true ).
*/
void movedTab( int, int );
#endif
/**
* A double left mouse button click was performed over empty space besides tabbar.
* The signal is emitted on the second press of the mouse button, before the release.
*/
void mouseDoubleClick();
/**
* A double left mouse button click was performed over the widget.
* The signal is emitted on the second press of the mouse button, before the release.
*/
void mouseDoubleClick( QWidget * );
/**
* A middle mouse button click was performed over empty space besides tabbar.
* The signal is emitted on the release of the mouse button.
*/
void mouseMiddleClick();
/**
* A middle mouse button click was performed over the widget.
* The signal is emitted on the release of the mouse button.
*/
void mouseMiddleClick( QWidget * );
/**
* The close button of a widget's tab was clicked. This signal is
* only possible after you have called setCloseButtonEnabled( true ).
*/
void closeRequest( QWidget * );
protected:
virtual void mouseDoubleClickEvent( QMouseEvent* );
virtual void mousePressEvent( QMouseEvent* );
virtual void mouseReleaseEvent( QMouseEvent* );
virtual void dragEnterEvent( QDragEnterEvent* );
virtual void dragMoveEvent( QDragMoveEvent* );
virtual void dropEvent( QDropEvent* );
int tabBarWidthForMaxChars( int );
#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent( QWheelEvent* );
#endif
virtual void resizeEvent( QResizeEvent* );
virtual void tabInserted( int );
virtual void tabRemoved ( int );
/**
* @deprecated This method has no effect and should not be called
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED void currentChanged( int );
#endif
protected Q_SLOTS:
virtual void receivedDropEvent( int, QDropEvent* );
virtual void initiateDrag( int );
virtual void contextMenu( int, const QPoint& );
virtual void mouseDoubleClick( int );
virtual void mouseMiddleClick( int );
virtual void closeRequest( int );
#ifndef QT_NO_WHEELEVENT
virtual void wheelDelta( int );
#endif
private:
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void slotTabMoved(int, int))
};
#endif
|