12 #include <tqpopupmenu.h> 14 #include <tdeglobal.h> 15 #include <tdelocale.h> 16 #include <kicontheme.h> 17 #include <kiconloader.h> 19 #include "kdevtabwidget.h" 21 KDevTabWidget::KDevTabWidget(TQWidget *parent,
const char *name) : TQTabWidget(parent,name)
23 m_pTabBar =
new KTabBar(
this,
"tabbar");
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*)));
29 KTabBar::KTabBar(TQWidget *parent,
const char *name) : TQTabBar(parent,name)
31 m_pPopupMenu =
new TQPopupMenu(
this);
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");
37 m_pPopupMenu->insertItem(closePixmap, i18n(
"&Close"),
this, TQT_SLOT(closeWindowSlot()));
38 m_pPopupMenu->insertItem(i18n(
"Close &Others"),
this, TQT_SLOT(closeOthersSlot()));
41 void KTabBar::closeWindowSlot()
43 emit closeWindow(m_pPage);
46 void KTabBar::closeOthersSlot()
48 emit closeOthers(m_pPage);
51 void KTabBar::mousePressEvent(TQMouseEvent *e)
53 if(e->button() == Qt::RightButton) {
55 TQTab *tab = selectTab(e->pos() );
56 if( tab == 0L )
return;
58 m_pPage = ((KDevTabWidget*)parent())->page(indexOf(tab->identifier() ) );
59 if(m_pPage == 0L)
return;
61 m_pPopupMenu->exec(mapToGlobal(e->pos()));
63 TQTabBar::mousePressEvent(e);
66 #include "kdevtabwidget.moc"