25 #include "listtabwidget.h"
26 #include "feedlistview.h"
30 #include <tdemultitabbar.h>
32 #include <tqiconset.h>
35 #include <tqptrlist.h>
37 #include <tqvaluelist.h>
38 #include <tqwidgetstack.h>
44 class ListTabWidget::ListTabWidgetPrivate
51 NodeListView* current;
53 TQValueList<NodeListView*> views;
54 TQMap<int, NodeListView*> idToView;
57 TQMap<TQWidget*, TQString> captions;
64 d->current->slotItemUp();
70 d->current->slotItemDown();
76 d->current->slotItemBegin();
82 d->current->slotItemEnd();
88 d->current->slotItemLeft();
94 d->current->slotItemRight();
97 void ListTabWidget::slotPrevFeed()
100 d->current->slotPrevFeed();
103 void ListTabWidget::slotNextFeed()
106 d->current->slotNextFeed();
109 void ListTabWidget::slotPrevUnreadFeed()
112 d->current->slotPrevUnreadFeed();
115 void ListTabWidget::slotNextUnreadFeed()
118 d->current->slotNextUnreadFeed();
121 void ListTabWidget::slotRootNodeChanged(NodeListView* view, TreeNode* node)
138 void ListTabWidget::slotTabClicked(
int id)
140 NodeListView* view = d->idToView[id];
143 d->stack->raiseWidget(view);
146 if (d->currentID >= 0)
147 d->tabBar->setTab(d->currentID,
false);
149 d->tabBar->setTab(d->currentID,
true);
151 emit signalNodeSelected(d->current->selectedNode());
155 ListTabWidget::ListTabWidget(TQWidget* parent,
const char* name) : TQWidget(parent, name), d(new ListTabWidgetPrivate)
160 d->viewMode = verticalTabs;
161 d->layout =
new TQHBoxLayout(
this);
163 d->tabBar =
new KMultiTabBar(KMultiTabBar::Vertical,
this);
164 d->tabBar->setStyle(KMultiTabBar::KDEV3ICON);
166 d->tabBar->showActiveTabTexts(
true);
167 d->tabBar->setPosition(KMultiTabBar::Left);
168 d->layout->addWidget(d->tabBar);
170 d->stack =
new TQWidgetStack(
this);
171 d->layout->addWidget(d->stack);
176 ListTabWidget::~ListTabWidget()
183 void ListTabWidget::setViewMode(ViewMode mode)
185 if (mode == d->viewMode)
191 d->tabBar->setHidden(mode == single);
194 ListTabWidget::ViewMode ListTabWidget::viewMode()
const
199 void ListTabWidget::addView(NodeListView* view,
const TQString& caption,
const TQPixmap& icon)
201 d->captions[view] = caption;
203 view->reparent(d->stack, TQPoint(0,0));
204 d->stack->addWidget(view);
206 int tabId = d->idCounter++;
207 d->tabBar->appendTab(icon, tabId, caption);
208 d->idToView[tabId] = view;
209 connect(d->tabBar->tab(tabId), TQ_SIGNAL(clicked(
int)),
this, TQ_SLOT(slotTabClicked(
int)));
212 connect(view, TQ_SIGNAL(signalNodeSelected(TreeNode*)),
this, TQ_SIGNAL(signalNodeSelected(TreeNode*)));
213 connect(view, TQ_SIGNAL(signalRootNodeChanged(NodeListView*, TreeNode*)),
this, TQ_SLOT(slotRootNodeChanged(NodeListView*, TreeNode*)));
219 d->currentID = tabId;
220 d->tabBar->setTab(d->currentID,
true);
221 d->stack->raiseWidget(view);
225 NodeListView* ListTabWidget::activeView()
const
232 #include "listtabwidget.h"
234 #include "listtabwidget.moc"