summaryrefslogtreecommitdiffstats
path: root/src/libs/imageproperties/navigatebartab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/imageproperties/navigatebartab.cpp')
-rw-r--r--src/libs/imageproperties/navigatebartab.cpp146
1 files changed, 146 insertions, 0 deletions
diff --git a/src/libs/imageproperties/navigatebartab.cpp b/src/libs/imageproperties/navigatebartab.cpp
new file mode 100644
index 00000000..d40ae134
--- /dev/null
+++ b/src/libs/imageproperties/navigatebartab.cpp
@@ -0,0 +1,146 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2007-01-04
+ * Description : A parent tab class with a navigation bar
+ *
+ * Copyright (C) 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+// TQt includes.
+
+#include <tqlayout.h>
+#include <tqwidgetstack.h>
+#include <tqlabel.h>
+
+// Local includes.
+
+#include "statusnavigatebar.h"
+#include "navigatebarwidget.h"
+#include "navigatebartab.h"
+#include "navigatebartab.moc"
+
+namespace Digikam
+{
+
+class NavigateBarTabPriv
+{
+public:
+
+ NavigateBarTabPriv()
+ {
+ stack = 0;
+ navigateBar = 0;
+ label = 0;
+ }
+
+ TQWidgetStack *stack;
+
+ TQLabel *label;
+
+ NavigateBarWidget *navigateBar;
+};
+
+NavigateBarTab::NavigateBarTab(TQWidget* parent)
+ : TQWidget(parent, 0, TQt::WDestructiveClose)
+{
+ d = new NavigateBarTabPriv;
+ m_navigateBarLayout = 0;
+}
+
+NavigateBarTab::~NavigateBarTab()
+{
+ delete d;
+}
+
+void NavigateBarTab::setupNavigateBar(bool withBar)
+{
+ m_navigateBarLayout = new TQVBoxLayout(this);
+
+ if (withBar)
+ {
+ d->stack = new TQWidgetStack(this);
+ m_navigateBarLayout->addWidget(d->stack);
+
+ d->navigateBar = new NavigateBarWidget(d->stack, withBar);
+ d->stack->addWidget(d->navigateBar);
+
+ connect(d->navigateBar, TQ_SIGNAL(signalFirstItem()),
+ this, TQ_SIGNAL(signalFirstItem()));
+
+ connect(d->navigateBar, TQ_SIGNAL(signalPrevItem()),
+ this, TQ_SIGNAL(signalPrevItem()));
+
+ connect(d->navigateBar, TQ_SIGNAL(signalNextItem()),
+ this, TQ_SIGNAL(signalNextItem()));
+
+ connect(d->navigateBar, TQ_SIGNAL(signalLastItem()),
+ this, TQ_SIGNAL(signalLastItem()));
+
+ d->label = new TQLabel(d->stack);
+ d->label->setAlignment(TQt::AlignCenter);
+ d->stack->addWidget(d->label);
+ }
+}
+
+void NavigateBarTab::setNavigateBarState(bool hasPrevious, bool hasNext)
+{
+ if (!d->navigateBar)
+ return;
+
+ d->stack->raiseWidget(d->navigateBar);
+
+ if (hasPrevious && hasNext)
+ d->navigateBar->setButtonsState(StatusNavigateBar::ItemCurrent);
+ else if (!hasPrevious && hasNext)
+ d->navigateBar->setButtonsState(StatusNavigateBar::ItemFirst);
+ else if (hasPrevious && !hasNext)
+ d->navigateBar->setButtonsState(StatusNavigateBar::ItemLast);
+ else
+ d->navigateBar->setButtonsState(StatusNavigateBar::NoNavigation);
+}
+
+void NavigateBarTab::setNavigateBarState(int itemType)
+{
+ if (!d->navigateBar)
+ return;
+
+ d->stack->raiseWidget(d->navigateBar);
+ d->navigateBar->setButtonsState(itemType);
+}
+
+void NavigateBarTab::setNavigateBarFileName(const TQString &name)
+{
+ if (!d->navigateBar)
+ return;
+
+ d->stack->raiseWidget(d->navigateBar);
+ d->navigateBar->setFileName(name);
+}
+
+void NavigateBarTab::setLabelText(const TQString &text)
+{
+ if (!d->label)
+ return;
+
+ d->stack->raiseWidget(d->label);
+ d->label->setText(text);
+}
+
+} // NameSpace Digikam
+