Here a first attempt for tabs, it's the JMarc approach,
because it's the simples way. It's only a additional
switch by a QTabBar, but I don't know how to get the
current name and how to emit a switch signal.

Peter
Index: LyXView.h
===================================================================
--- LyXView.h   (revision 15526)
+++ LyXView.h   (working copy)
@@ -153,6 +153,9 @@
        /// updates the title of the window
        void updateWindowTitle();
 
+    /// updates the tab view
+       virtual void updateTab() = 0;
+
        /// reset autosave timer
        void resetAutosaveTimer();
 
Index: qt4/GuiView.h
===================================================================
--- qt4/GuiView.h       (revision 15526)
+++ qt4/GuiView.h       (working copy)
@@ -26,7 +26,7 @@
 #include <QCloseEvent>
 
 class QToolBar;
-
+class TabHeader;
 //class FuncRequest;
 
 //class string;
@@ -66,6 +66,8 @@
        virtual void clearMessage();
        virtual bool hasFocus() const;
 
+    virtual void updateTab();
+
        /// show - display the top-level window
        void show();
 
@@ -75,6 +77,7 @@
        /// menu item has been selected
        void activated(FuncRequest const &);
 
+    void initTab(QWidget* workArea);
 
 Q_SIGNALS:
        void closing(int);
@@ -86,6 +89,8 @@
        /// populate a toplevel menu and all its children on demand
        void updateMenu(QAction *);
 
+    void currentTabChanged (int index); 
+
 protected:
        /// make sure we quit cleanly
        virtual void closeEvent(QCloseEvent * e);
@@ -116,6 +121,8 @@
        void updateFloatingGeometry();
        ///
        QRect floatingGeometry_;
+
+    TabHeader* t;
 };
 
 } // namespace frontend
Index: qt4/GuiImplementation.C
===================================================================
--- qt4/GuiImplementation.C     (revision 15526)
+++ qt4/GuiImplementation.C     (working copy)
@@ -104,6 +104,7 @@
        view->setWorkArea(work_areas_[id]);
 
        view->setCentralWidget(work_areas_[id]);
+    view->initTab(work_areas_[id]);
 
        return id;
 }
Index: qt4/GuiView.C
===================================================================
--- qt4/GuiView.C       (revision 15526)
+++ qt4/GuiView.C       (working copy)
@@ -45,14 +45,29 @@
 #include <QPixmap>
 #include <QStatusBar>
 #include <QToolBar>
+#include <QTabBar>
 
-
 #include <boost/bind.hpp>
 
 
 using std::string;
 using std::endl;
 
+class TabHeader : public QWidget
+{
+public:
+       QTabBar* tabbar;
+       TabHeader(QWidget* w)
+       {
+               tabbar = new QTabBar;
+           QVBoxLayout* l = new QVBoxLayout;
+               l->addWidget(tabbar);
+               l->addWidget(w);
+               l->setMargin(0);
+               setLayout(l);
+       }
+};
+
 namespace lyx {
 
 using support::subst;
@@ -67,6 +82,7 @@
 } // namespace anon
 
 
+
 GuiView::GuiView(int id)
        : QMainWindow(), LyXView(id), commandbuffer_(0)
 {
@@ -222,7 +238,25 @@
        statusbar_timer_.stop();
 }
 
+void GuiView::initTab(QWidget* workarea)
+{
+    t = new TabHeader(workarea);
+    setCentralWidget(t);
+    QObject::connect(t->tabbar, SIGNAL(currentChanged(int)),
+               this, SLOT(currentTabChanged(int)));
+}
 
+void GuiView::currentTabChanged (int index)
+{
+    
+}
+
+void GuiView::updateTab()
+{
+    QString getName("todo");
+    t->tabbar->addTab(getName);
+}
+
 void GuiView::updateStatusBar()
 {
        // let the user see the explicit message
Index: LyXView.C
===================================================================
--- LyXView.C   (revision 15526)
+++ LyXView.C   (working copy)
@@ -144,6 +144,7 @@
        updateToolbars();
        updateLayoutChoice();
        updateWindowTitle();
+    updateTab();
        if (loaded) {
                connectBuffer(*work_area_->bufferView().buffer());
                showErrorList("Parse");

PNG image

Reply via email to