/*
    Copyright (c) 2008 Louai Al-Khanji

    This file is part of Safra.

    Safra is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 2 as published
    by the Free Software Foundation.

    Safra 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.

    You should have received a copy of the GNU General Public License
    along with Safra; see the file COPYING. If not, see
    <http://www.gnu.org/licenses/>.
*/

#ifndef SAFRA_MAINWIDGET_H
#define SAFRA_MAINWIDGET_H

#include <QWidget>
#include <QPointer>

class QTabBar;
class QGraphicsView;
class QGraphicsScene;
class WebView;
class QGraphicsProxyWidget;
class QStyleOptionTabWidgetFrame;

class MainWidget : public QWidget
{
    Q_OBJECT
    public:
        MainWidget(QWidget* parent = 0);

        WebView* currentView() const;
        int newView();

    public slots:
        void activateView(int index);

    protected:
        void resizeEvent(QResizeEvent* event);
        void paintEvent(QPaintEvent* event);
        void initStyleOption(QStyleOptionTabWidgetFrame* option);

    private slots:
        void doLayouts();

    private:
        QTabBar* m_tabbar;
        QGraphicsView* m_view;
        QGraphicsScene* m_scene;
        QPointer<QGraphicsProxyWidget> m_current;
        QRect m_panelRect;
};

#endif // SAFRA_MAINWIDGET_H
