ginebra2/ContentViews/BrowserWindow.h
changeset 16 3c88a81ff781
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
       
     1 /*
       
     2  * BrowserWindow.h
       
     3  *
       
     4  */
       
     5 
       
     6 #ifndef BROWSERWINDOW_H
       
     7 #define BROWSERWINDOW_H_
       
     8 
       
     9 #include <QMainWindow>
       
    10 #include "wrtbrowsercontainer.h"
       
    11 
       
    12 class QGraphicsWidget;
       
    13 class QGraphicsScene;
       
    14 class QGraphicsItem;
       
    15 
       
    16 class ControllableViewBase;
       
    17 
       
    18 namespace GVA {
       
    19 
       
    20 class ChromeLayout;
       
    21 class ChromeWidget;
       
    22 class ChromeView;
       
    23 class WindowsView;
       
    24 class ViewController;
       
    25 
       
    26 class BrowserWindow : public QMainWindow
       
    27 {      
       
    28 
       
    29  Q_OBJECT
       
    30 
       
    31  enum {
       
    32    blocked = 1,
       
    33    active = 2,
       
    34    menuEnabled = 4
       
    35  };
       
    36 
       
    37  public:
       
    38   BrowserWindow(ChromeWidget * chrome, WindowsView * windows, QWidget * parent = 0, Qt::WindowFlags flags = 0 );
       
    39   virtual ~BrowserWindow() { ; }
       
    40   void setPage(WRT::WrtBrowserContainer * page);
       
    41   void closeWindow();
       
    42   void toggleDecoration(); 
       
    43   void showDecoration();
       
    44   void hideDecoration();
       
    45   const QString & view() { return m_viewName; }
       
    46   void setView(const QString & view) { m_viewName = view; }
       
    47   void setMenuEnabled(bool enabled);
       
    48   void setTitle(const QString &title);
       
    49  protected slots:
       
    50   void onViewChanged(ControllableViewBase *newView);
       
    51   void onPageTitleChanged(const QString &title);
       
    52   void toggleNormalFullScreen();
       
    53  protected:
       
    54   ViewController *viewController();
       
    55   virtual bool event(QEvent * event);
       
    56   virtual void changeEvent(QEvent * event);
       
    57   void connectPageTitleChanged();
       
    58   void disconnectPageTitleChanged();
       
    59   void fixupWindowTitle();
       
    60   void slideViewIfRequired(int value); // hide or show UrlSearchBar if required
       
    61   void handleWindowActivate();
       
    62   void handleWindowDeactivate();
       
    63   
       
    64   #ifdef Q_WS_MAEMO_5
       
    65   void grabZoomKeys(bool grab);
       
    66   virtual void keyPressEvent(QKeyEvent* event);
       
    67 	#endif
       
    68 	
       
    69  private:
       
    70   WRT::WrtBrowserContainer * m_page; //Not owned
       
    71   WRT::WrtBrowserContainer * m_specialPage;
       
    72   bool m_decorated;
       
    73   ChromeWidget * m_chrome; //Shared, not owned
       
    74   ChromeView * m_view;
       
    75   QGraphicsScene * m_scene;
       
    76   QGraphicsItem * m_snapshot;
       
    77   WindowsView * m_windows;
       
    78   int m_state;
       
    79   QString m_viewName;  
       
    80   static bool m_preventDisconnectPageTitleChanged;
       
    81   static bool m_preventConnectPageTitleChanged;
       
    82   bool m_slidedUp;
       
    83   bool m_changingMode;
       
    84 };
       
    85 }
       
    86 #endif /* BROWSERWINDOW_H_ */