ginebra2/ChromeSnippet.h
changeset 6 1c3b8676e58c
parent 5 0f2326c2a325
equal deleted inserted replaced
5:0f2326c2a325 6:1c3b8676e58c
    25 #include <QString>
    25 #include <QString>
    26 #include <QObject>
    26 #include <QObject>
    27 #include <QTransform>
    27 #include <QTransform>
    28 #include <QWebElement>
    28 #include <QWebElement>
    29 #include "ChromeWidget.h"
    29 #include "ChromeWidget.h"
       
    30 #include "ChromeLayout.h"
    30 
    31 
    31 class QGraphicsWidget;
    32 class QGraphicsWidget;
    32 
    33 
    33 namespace GVA {
    34 namespace GVA {
    34 
    35 
    55   {
    56   {
    56     Q_OBJECT
    57     Q_OBJECT
    57   public:
    58   public:
    58     ChromeSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
    59     ChromeSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
    59     virtual ~ChromeSnippet();
    60     virtual ~ChromeSnippet();
    60     ChromeWidget* chrome() { return m_chrome; }
    61     ChromeWidget * chrome() { return m_chrome; }
    61     void setInitiallyVisible(bool initiallyVisible) { m_initiallyVisible = initiallyVisible; } //NB: needed?
    62     void setInitiallyVisible(bool initiallyVisible) { m_initiallyVisible = initiallyVisible; } //NB: needed?
    62     void setHidesContent(bool hidesContent) { m_hidesContent = hidesContent; }
    63     void setHidesContent(bool hidesContent) { m_hidesContent = hidesContent; }
    63     void setAnchor(ChromeAnchor anchor) {m_anchor = anchor;}
    64     void setAnchor(ChromeAnchor anchor) {m_anchor = anchor;}
    64     ChromeAnchor anchor() { return m_anchor; }
    65     ChromeAnchor anchor() { return m_anchor; }
    65     int anchorOffset() {return m_anchorOffset;}
    66     int anchorOffset() {return m_anchorOffset;}
    66     bool initiallyVisible() { return m_initiallyVisible; } //NB: needed?
    67     bool initiallyVisible() { return m_initiallyVisible; } //NB: needed?
    67     bool hidesContent() { return m_hidesContent; }
    68     bool hidesContent() { return m_hidesContent; }
    68     QString elementId() { return m_elementId; }
    69     QString elementId() { return m_elementId; }
    69     QGraphicsWidget* widget() { return m_widget; }
    70     QGraphicsWidget* widget() { return m_widget; }
    70     QGraphicsWidget const * constWidget() const { return m_widget; }
    71     QGraphicsWidget const * constWidget() const { return m_widget; }
    71     virtual void setWidget(QGraphicsWidget * widget) { m_widget = widget; }
    72     virtual void setChromeWidget(QGraphicsWidget * widget);
    72     QString parentId() { return m_parentId; }
    73     QString parentId() { return m_parentId; }
    73     void setParentId(const QString& parent) { m_parentId = parent; }
    74     void setParentId(const QString& parent) { m_parentId = parent; }
    74     void setTransform(QTransform transform);
    75     void setTransform(QTransform transform);
    75     QTransform transform();
    76     QTransform transform();
    76     QPointF position() const;
    77     QPointF position() const;
   109     int zValue();
   110     int zValue();
   110     void setZValue(int z);
   111     void setZValue(int z);
   111     //NB: deprecate repaint: if this is needed, then there are bugs that are preventing updates
   112     //NB: deprecate repaint: if this is needed, then there are bugs that are preventing updates
   112     void repaint() { m_widget->update(); }
   113     void repaint() { m_widget->update(); }
   113     void onContextMenuEvent(QGraphicsSceneContextMenuEvent * ev);
   114     void onContextMenuEvent(QGraphicsSceneContextMenuEvent * ev);
   114     void disableDontShowFlag() {m_dontshowFlag = false ;}
   115 
   115   signals:
   116   signals:
   116     void hidden();
   117     void hidden();
   117     void shown();
   118     void shown();
   118     void externalMouseEvent(
   119     void externalMouseEvent(
   119             int type,
   120             QEvent * ev,
   120             const QString & name,
   121             const QString & name,
   121             const QString & description);
   122             const QString & description);
   122     void contextMenuEvent(int x, int y);
   123     void contextMenuEvent(int x, int y);
   123     void snippetMouseEvent(QEvent::Type );
   124     void snippetMouseEvent(QEvent::Type );
   124 
   125 
   135     Q_PROPERTY(QString anchor READ getAnchorString)
   136     Q_PROPERTY(QString anchor READ getAnchorString)
   136     QString getAnchorString();
   137     QString getAnchorString();
   137     Q_PROPERTY(int anchorOffset READ anchorOffset WRITE setAnchorOffset)
   138     Q_PROPERTY(int anchorOffset READ anchorOffset WRITE setAnchorOffset)
   138     Q_PROPERTY(int zValue READ zValue WRITE setZValue)
   139     Q_PROPERTY(int zValue READ zValue WRITE setZValue)
   139     Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
   140     Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
   140     Q_PROPERTY(bool dontShow READ getDontShowFlag WRITE setDontShowFlag)
       
   141     Q_PROPERTY(QObject* position READ getPosition)
   141     Q_PROPERTY(QObject* position READ getPosition)
   142     Q_PROPERTY(QObject* geometry READ getGeometry)
   142     Q_PROPERTY(QObject* geometry READ getGeometry)
   143     Q_PROPERTY(bool enabled WRITE setEnabled READ enabled)
   143     Q_PROPERTY(bool enabled WRITE setEnabled READ enabled)
   144     bool getDontShowFlag() {return m_dontshowFlag;}
   144 
   145     void setDontShowFlag(bool flag){ m_dontshowFlag = flag;}
       
   146     bool enabled() const;
   145     bool enabled() const;
   147     void setEnabled(bool value);
   146     void setEnabled(bool value);
   148   protected:
   147   protected:
   149     QString m_elementId;
   148     QString m_elementId;
   150     QWebElement m_element;
   149     QWebElement m_element;