ginebra2/ContentViews/WindowsView.h
changeset 16 3c88a81ff781
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
       
     1 /*
       
     2  * WindowsView.h
       
     3  *
       
     4  *  Created on: Jun 11, 2010
       
     5  *      Author: lewontin
       
     6  */
       
     7 
       
     8 #ifndef WINDOWSVIEW_H
       
     9 #define WINDOWSVIEW_H_
       
    10 
       
    11 #include "controllableviewimpl.h"
       
    12 #include <QMenu>
       
    13 
       
    14 namespace WRT {
       
    15   class WrtBrowserContainer;
       
    16 }
       
    17 
       
    18 namespace GVA {
       
    19 
       
    20 class BrowserWindow;
       
    21 class ChromeWidget;
       
    22 class GWebContentView;
       
    23 
       
    24 class WindowsView : public ControllableViewBase
       
    25 {
       
    26   Q_OBJECT
       
    27       
       
    28   public:
       
    29     WindowsView(ChromeWidget * chrome, QObject * parent = 0, const QString &objectName = QString::null);
       
    30     virtual ~WindowsView();
       
    31     //Reimplement ControllableViewBase methods
       
    32     static QString Type() { return "windowView"; }
       
    33     virtual QString type() const { return Type(); }
       
    34     QGraphicsWidget* widget() const { return 0; }
       
    35     virtual QList<QAction*> getContext(){ return QList<QAction*>(); }
       
    36     virtual void show(){;}
       
    37     virtual void hide(){;}
       
    38     virtual void activate(BrowserWindow * window);
       
    39     virtual void deactivate(BrowserWindow * window);
       
    40     //WindowView methods
       
    41     BrowserWindow * addWindow(WRT::WrtBrowserContainer * page);
       
    42     BrowserWindow * currentWindow(){ return m_current; }
       
    43     void addPage();
       
    44     void handlePageEvents(bool handle);
       
    45     void setMenu(QMenu * menu);
       
    46     void setMenuEnabled(bool enabled);
       
    47     bool isMenuEnabled() const;
       
    48     GWebContentView * contentView();
       
    49   public slots:
       
    50     void onPageCreated(WRT::WrtBrowserContainer * page);
       
    51     void onPageDeleted(WRT::WrtBrowserContainer * page);
       
    52     void onWindowAction(); //Handle menu add window action
       
    53   private:
       
    54     QMap<WRT::WrtBrowserContainer*, BrowserWindow*>  m_windows;
       
    55     BrowserWindow * m_current;
       
    56     ChromeWidget * m_chrome;
       
    57     QMenu * m_menu; //Shared menu, not owned
       
    58 };
       
    59 }
       
    60 #endif /* WINDOWSVIEW_H_ */