ginebra2/ChromeWidget.h
changeset 16 3c88a81ff781
parent 9 b39122337a00
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
    32 class QWebPage;
    32 class QWebPage;
    33 class QPixmap;
    33 class QPixmap;
    34 
    34 
    35 class MostVisitedPageStore;
    35 class MostVisitedPageStore;
    36 class ControllableViewBase;
    36 class ControllableViewBase;
       
    37 class GinebraBrowser;
    37 
    38 
    38 using namespace WRT;
    39 using namespace WRT;
    39 
    40 
    40 namespace GVA {
    41 namespace GVA {
    41 
    42 
    74     ChromeLayout * layout() { return m_layout; }
    75     ChromeLayout * layout() { return m_layout; }
    75     void setLayout(ChromeLayout * layout) { m_layout = layout; }
    76     void setLayout(ChromeLayout * layout) { m_layout = layout; }
    76     ChromeRenderer * renderer() { return m_renderer; }
    77     ChromeRenderer * renderer() { return m_renderer; }
    77     ChromeDOM * dom() { return m_dom; }
    78     ChromeDOM * dom() { return m_dom; }
    78     QRect getSnippetRect(const QString &docElementId);
    79     QRect getSnippetRect(const QString &docElementId);
    79     ChromeSnippet * getSnippet(const QString & docElementId, QGraphicsItem * parent = 0);
    80     ChromeSnippet * getSnippet(const QString & docElementId);
    80     //  QScriptValue evalWithEngineContext(const QString& program);
    81     //  QScriptValue evalWithEngineContext(const QString& program);
    81     ControllableViewBase * getView(const QString& name);
    82     ControllableViewBase * getView(const QString& name);
    82     void showView(const QString &name);
    83     void showView(const QString &name);
    83     QWebPage * page() { return m_page; }
    84     QWebPage * page() { return m_page; }
    84     //NB: get rid of this (see comment in .cpp)!!!
    85     //NB: get rid of this (see comment in .cpp)!!!
    91     QString currentView() {return m_viewController->currentView()->type() ;}
    92     QString currentView() {return m_viewController->currentView()->type() ;}
    92     void updateChromeLayout();
    93     void updateChromeLayout();
    93     void sizeChange(QSize sz){ emit prepareForSizeChange(sz) ;}
    94     void sizeChange(QSize sz){ emit prepareForSizeChange(sz) ;}
    94     void emitPopupShown(const QString &popupId);
    95     void emitPopupShown(const QString &popupId);
    95     void emitPopupHidden(const QString &popupId);
    96     void emitPopupHidden(const QString &popupId);
       
    97     void setApp(QObject *app) { m_app = app; }
       
    98     #ifdef Q_WS_MAEMO_5
       
    99     void activate();
       
   100     #endif
       
   101 
       
   102     void emitRequestShowFullScreen() { emit requestShowFullScreen(); }
       
   103     void emitRequestShowNormal() { emit requestShowNormal(); }
       
   104     void emitRequestToggleNormalFullsreen() { emit requestToggleNormalFullScreen(); }
       
   105 
       
   106     /// windowStateChange() should be called by the owner of the ChromeWidget when the state of the
       
   107     /// top-level window changes.
       
   108     void windowStateChange(Qt::WindowStates state);
       
   109 
       
   110     // Returns the viewport size without the top widget (title-url bar)
       
   111     QSize viewSize(); 
    96 
   112 
    97   public slots:
   113   public slots:
    98     void loadStarted();
   114     void loadStarted();
    99     void loadFinished(bool ok);
   115     void loadFinished(bool ok);
   100     void exportJSObjects();
   116     void exportJSObjects();
   101     void exportJSObjectsToPage(QWebPage *page);
   117     void exportJSObjectsToPage(QWebPage *page);
   102     void alert(const QString & msg);
   118     void alert(const QString & msg);
   103     void onViewInstantiated(ControllableViewBase *view);
   119     void onViewInstantiated(ControllableViewBase *view);
   104     void onCurrentViewChanged();
   120     void onCurrentViewChanged(ControllableViewBase *newView);    
   105     void chromeInitialized();
   121     void chromeInitialized();
   106     void reloadChrome();
   122     void reloadChrome();
   107     void loadUrlToCurrentPage(const QUrl & url);
   123     void loadUrlToCurrentPage(const QUrl & url);
   108     void pageCreated(WRT::WrtBrowserContainer * page);
   124     void pageCreated(WRT::WrtBrowserContainer * page);
   109     void onResize(QSizeF size);
   125     void onResize(QSizeF size);
   118     //NB: This should be symbian ifdef'd but that would require symbian-specific chrome
   134     //NB: This should be symbian ifdef'd but that would require symbian-specific chrome
   119     void symbianCarriageReturn();
   135     void symbianCarriageReturn();
   120     void popupShown(const QString &id);
   136     void popupShown(const QString &id);
   121     void popupHidden(const QString &id);
   137     void popupHidden(const QString &id);
   122     void goToBackground();
   138     void goToBackground();
       
   139     #ifdef Q_WS_MAEMO_5
       
   140     void chromeActivated();
       
   141     #endif
       
   142 
       
   143     /// Sent when the current window should be shown fullscreen.
       
   144     void requestShowFullScreen();
       
   145 
       
   146     /// Sent when the current window should be shown in normal mode.
       
   147     void requestShowNormal();
       
   148 
       
   149     /// Sent when the current window should be toggled between normal and fullscreen modes.
       
   150     void requestToggleNormalFullScreen();
       
   151 
       
   152     /// Sent when the top-level window has changed states.
       
   153     void windowStateChanged(Qt::WindowStates state);
   123 
   154 
   124   public:
   155   public:
   125     Q_PROPERTY(QObjectList snippets READ getSnippets)
   156     Q_PROPERTY(QObjectList snippets READ getSnippets)
   126     QObjectList getSnippets();
   157     QObjectList getSnippets();
   127 
   158 
   144     ChromeDOM * m_dom;
   175     ChromeDOM * m_dom;
   145     Snippets * m_snippets;
   176     Snippets * m_snippets;
   146     ViewController *m_viewController;
   177     ViewController *m_viewController;
   147     //QList<QObject*> m_jsObjects;
   178     //QList<QObject*> m_jsObjects;
   148     //QScriptEngine m_engine;
   179     //QScriptEngine m_engine;
   149     GinebraApplication *m_app;
   180     QObject *m_app;  // Application object, exposed to javascript.  Not owned. 
   150     ChromeWidgetJSObject *m_jsObject;
   181     ChromeWidgetJSObject *m_jsObject;
   151     LocaleDelegate *m_localeDelegate; // Owned
   182     LocaleDelegate *m_localeDelegate; // Owned
   152     DeviceDelegate *m_deviceDelegate;
   183     DeviceDelegate *m_deviceDelegate;
   153     NetworkDelegate *m_networkDelegate;
   184     NetworkDelegate *m_networkDelegate;
   154     Downloads * m_downloads; // Owned
   185     Downloads * m_downloads; // Owned