• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Widgets Library
 

KDevelop Widgets Library

  • lib
  • widgets
kdevtabwidget.cpp
1 /***************************************************************************
2  * Copyright (C) 2001-2003 *
3  * The KDevelop Team *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  ***************************************************************************/
11 
12 #include <tqpopupmenu.h>
13 
14 #include <tdeglobal.h>
15 #include <tdelocale.h>
16 #include <kicontheme.h>
17 #include <kiconloader.h>
18 
19 #include "kdevtabwidget.h"
20 
21 KDevTabWidget::KDevTabWidget(TQWidget *parent, const char *name) : TQTabWidget(parent,name)
22 {
23  m_pTabBar = new KTabBar(this, "tabbar");
24  setTabBar(m_pTabBar);
25  connect(m_pTabBar, TQT_SIGNAL(closeWindow(const TQWidget*)), this, TQT_SIGNAL(closeWindow(const TQWidget*)));
26  connect(m_pTabBar, TQT_SIGNAL(closeOthers(TQWidget*)), this, TQT_SIGNAL(closeOthers(TQWidget*)));
27 }
28 
29 KTabBar::KTabBar(TQWidget *parent, const char *name) : TQTabBar(parent,name)
30 {
31  m_pPopupMenu = new TQPopupMenu(this);
32 
33  TQPixmap closePixmap = TDEGlobal::instance()->iconLoader()->loadIcon( "tab_remove", TDEIcon::Small, 0, TDEIcon::DefaultState, 0, true );
34  if (closePixmap.isNull())
35  closePixmap = SmallIcon("window-close");
36 
37  m_pPopupMenu->insertItem(closePixmap, i18n("&Close"), this, TQT_SLOT(closeWindowSlot()));
38  m_pPopupMenu->insertItem(i18n("Close &Others"), this, TQT_SLOT(closeOthersSlot()));
39 }
40 
41 void KTabBar::closeWindowSlot()
42 {
43  emit closeWindow(m_pPage);
44 }
45 
46 void KTabBar::closeOthersSlot()
47 {
48  emit closeOthers(m_pPage);
49 }
50 
51 void KTabBar::mousePressEvent(TQMouseEvent *e)
52 {
53  if(e->button() == Qt::RightButton) {
54 
55  TQTab *tab = selectTab(e->pos() );
56  if( tab == 0L ) return;
57 
58  m_pPage = ((KDevTabWidget*)parent())->page(indexOf(tab->identifier() ) );
59  if(m_pPage == 0L) return;
60 
61  m_pPopupMenu->exec(mapToGlobal(e->pos()));
62  }
63  TQTabBar::mousePressEvent(e);
64 }
65 
66 #include "kdevtabwidget.moc"

KDevelop Widgets Library

Skip menu "KDevelop Widgets Library"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop Widgets Library

Skip menu "KDevelop Widgets Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Widgets Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.