ginebra2/ContentViews/GWebContentViewJSObject.h
changeset 6 1c3b8676e58c
parent 5 0f2326c2a325
child 10 232fbd5a2dcb
equal deleted inserted replaced
5:0f2326c2a325 6:1c3b8676e58c
    22 #define GWebContentViewJSObject_H_
    22 #define GWebContentViewJSObject_H_
    23 
    23 
    24 #include <QObject>
    24 #include <QObject>
    25 #include "controllableviewimpl.h"
    25 #include "controllableviewimpl.h"
    26 #include "GWebContentView.h"
    26 #include "GWebContentView.h"
       
    27 #include "GSuperWebPage.h"
    27 
    28 
    28 class WebViewEventContext;
    29 class WebViewEventContext;
    29 
    30 
    30 namespace GVA {
    31 namespace GVA {
    31 
    32 
    49     QObjectList getSuperPages() { return webContentView()->getSuperPages(); }
    50     QObjectList getSuperPages() { return webContentView()->getSuperPages(); }
    50 
    51 
    51     /*! This property holds whether touch navigation is enabled.
    52     /*! This property holds whether touch navigation is enabled.
    52      */
    53      */
    53     Q_PROPERTY(bool gesturesEnabled READ getGesturesEnabled WRITE setGesturesEnabled)
    54     Q_PROPERTY(bool gesturesEnabled READ getGesturesEnabled WRITE setGesturesEnabled)
    54     bool getGesturesEnabled() const { return webContentViewConst()->gesturesEnabled(); }
    55     bool getGesturesEnabled() const
    55     void setGesturesEnabled(bool value) { webContentView()->setGesturesEnabled(value); }
    56     {
       
    57 #ifdef BEDROCK_TILED_BACKING_STORE
       
    58         return false;
       
    59 #else
       
    60         return webContentViewConst()->gesturesEnabled();
       
    61 #endif
       
    62     }
       
    63     void setGesturesEnabled(bool value)
       
    64     {
       
    65 #ifndef BEDROCK_TILED_BACKING_STORE
       
    66         webContentView()->setGesturesEnabled(value);
       
    67 #endif
       
    68     }
    56 
    69 
    57     Q_PROPERTY(bool enabled WRITE setEnabled READ enabled)
    70     Q_PROPERTY(bool enabled WRITE setEnabled READ enabled)
    58     bool enabled() const { return webContentViewConst()->enabled(); }
    71     bool enabled() const { return webContentViewConst()->enabled(); }
    59     void setEnabled(bool value) { webContentView()->setEnabled(value); }
    72     void setEnabled(bool value) { webContentView()->setEnabled(value); }
    60 
    73 
    63         { webContentView()->loadUrlToCurrentPage(url); }
    76         { webContentView()->loadUrlToCurrentPage(url); }
    64     QObject *currentPage() { return webContentView()->currentPage(); }
    77     QObject *currentPage() { return webContentView()->currentPage(); }
    65     void back() { webContentView()->back(); }
    78     void back() { webContentView()->back(); }
    66     void forward() { webContentView()->forward(); }
    79     void forward() { webContentView()->forward(); }
    67     void reload() { webContentView()->reload(); }
    80     void reload() { webContentView()->reload(); }
       
    81 #ifndef BEDROCK_TILED_BACKING_STORE
    68     void zoomIn(qreal deltaPercent = 0.1) { webContentView()->zoomIn(deltaPercent); }
    82     void zoomIn(qreal deltaPercent = 0.1) { webContentView()->zoomIn(deltaPercent); }
    69     void zoomOut(qreal deltaPercent = 0.1) { webContentView()->zoomOut(deltaPercent); }
    83     void zoomOut(qreal deltaPercent = 0.1) { webContentView()->zoomOut(deltaPercent); }
    70     void zoomBy(qreal delta) { zoomIn(delta); }
    84     void zoomBy(qreal delta) { zoomIn(delta); }
       
    85 #endif	
    71     void zoom(bool in) { webContentView()->zoom(in); }
    86     void zoom(bool in) { webContentView()->zoom(in); }
    72     void toggleZoom() { webContentView()->toggleZoom(); }
    87     void toggleZoom() { webContentView()->toggleZoom(); }
    73     void stopZoom() { webContentView()->stopZoom(); }
    88     void stopZoom() { webContentView()->stopZoom(); }
    74     void scrollBy(int deltaX, int deltaY) { webContentView()->scrollBy(deltaX, deltaY); }
    89     void scrollBy(int deltaX, int deltaY) { webContentView()->scrollBy(deltaX, deltaY); }
    75     void scrollTo(int x, int y) { webContentView()->scrollTo(x, y); }
    90     void scrollTo(int x, int y) { webContentView()->scrollTo(x, y); }
    79     int contentHeight() { return webContentView()->contentHeight(); }
    94     int contentHeight() { return webContentView()->contentHeight(); }
    80     void showNormalPage() { return webContentView()->showNormalPage(); }
    95     void showNormalPage() { return webContentView()->showNormalPage(); }
    81     bool currentPageIsSuperPage() { return webContentView()->currentPageIsSuperPage(); }
    96     bool currentPageIsSuperPage() { return webContentView()->currentPageIsSuperPage(); }
    82     void dump() { return webContentView()->dump(); }
    97     void dump() { return webContentView()->dump(); }
    83     bool frozen() const { return webContentViewConst()->frozen(); }
    98     bool frozen() const { return webContentViewConst()->frozen(); }
    84     void freeze() { qDebug() << "FREEZE"; return webContentView()->freeze(); }
    99     void freeze() { return webContentView()->freeze(); }
    85     void unfreeze() { return webContentView()->unfreeze(); }
   100     void unfreeze() { return webContentView()->unfreeze(); }
    86 
   101 
    87     // Super page slots.
   102     // Super page slots.
    88     QObject * createSuperPage(const QString &name, bool persist=false) { return webContentView()->createSuperPage(name, persist); }
   103     QObject * createSuperPage(const QString &name, bool persist=false) { return webContentView()->createSuperPage(name, persist); }
    89     void destroySuperPage(const QString &name) { webContentView()->destroySuperPage(name); }
   104     void destroySuperPage(const QString &name) { webContentView()->destroySuperPage(name); }
    91     QObject * currentSuperPage() { return webContentView()->currentSuperPage(); }
   106     QObject * currentSuperPage() { return webContentView()->currentSuperPage(); }
    92     QString currentSuperPageName() { return webContentView()->currentSuperPage()->objectName(); }
   107     QString currentSuperPageName() { return webContentView()->currentSuperPage()->objectName(); }
    93     void showSuperPage(const QString &name) { webContentView()->showSuperPage(name); }
   108     void showSuperPage(const QString &name) { webContentView()->showSuperPage(name); }
    94     QObject * superPage(const QString &name) { return webContentView()->superPage(name); }
   109     QObject * superPage(const QString &name) { return webContentView()->superPage(name); }
    95     bool isSuperPage(const QString &name) { return webContentView()->isSuperPage(name); }
   110     bool isSuperPage(const QString &name) { return webContentView()->isSuperPage(name); }
       
   111 
       
   112     bool bedrockTiledBackingStoreEnabled() 
       
   113     {
       
   114 #ifdef BEDROCK_TILED_BACKING_STORE
       
   115         return true;
       
   116 #else
       
   117         return false;
       
   118 #endif
       
   119     }
    96 
   120 
    97 signals:
   121 signals:
    98     void ContextChanged();
   122     void ContextChanged();
    99     void iconChanged();
   123     void iconChanged();
   100     void loadFinished(bool ok);
   124     void loadFinished(bool ok);
   111 
   135 
   112     // Sent when the display mode changes from landscape to protrait or vice versa.
   136     // Sent when the display mode changes from landscape to protrait or vice versa.
   113     void onDisplayModeChanged(const QString &orientation);
   137     void onDisplayModeChanged(const QString &orientation);
   114 
   138 
   115     void contextEvent(QObject *context);
   139     void contextEvent(QObject *context);
       
   140 	void superPageShown(const QString &name);
       
   141     
   116 
   142 
   117 private slots:
   143 private slots:
   118     void statusBarMessage( const QString & text );
   144     void statusBarMessage( const QString & text );
   119     void statusBarVisibilityChangeRequested(bool visible);
   145     void statusBarVisibilityChangeRequested(bool visible);
   120     void onContextEvent(::WebViewEventContext *context);
   146     void onContextEvent(::WebViewEventContext *context);