12#include <tqpopupmenu.h>
16#include <kicontheme.h>
17#include <kiconloader.h>
19#include "kdevtabwidget.h"
21KDevTabWidget::KDevTabWidget(TQWidget *parent,
const char *name) : TQTabWidget(parent,name)
23 m_pTabBar =
new KTabBar(
this,
"tabbar");
25 connect(m_pTabBar, TQ_SIGNAL(closeWindow(
const TQWidget*)),
this, TQ_SIGNAL(closeWindow(
const TQWidget*)));
26 connect(m_pTabBar, TQ_SIGNAL(closeOthers(TQWidget*)),
this, TQ_SIGNAL(closeOthers(TQWidget*)));
29KTabBar::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, TQ_SLOT(closeWindowSlot()));
38 m_pPopupMenu->insertItem(i18n(
"Close &Others"),
this, TQ_SLOT(closeOthersSlot()));
41void KTabBar::closeWindowSlot()
43 emit closeWindow(m_pPage);
46void KTabBar::closeOthersSlot()
48 emit closeOthers(m_pPage);
51void KTabBar::mousePressEvent(TQMouseEvent *e)
53 if(e->button() == TQt::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"