1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
4 * |
9 * Initial Contributors: |
5 * This program is free software: you can redistribute it and/or modify |
10 * Nokia Corporation - initial contribution. |
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
11 * |
8 * |
12 * Contributors: |
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
13 * |
13 * |
14 * Description: |
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
15 * |
19 * |
16 */ |
20 */ |
17 |
|
18 |
21 |
19 #ifndef __GINEBRA_CHROMESNIPPET_H__ |
22 #ifndef __GINEBRA_CHROMESNIPPET_H__ |
20 #define __GINEBRA_CHROMESNIPPET_H__ |
23 #define __GINEBRA_CHROMESNIPPET_H__ |
21 |
24 |
22 #include <QString> |
25 #include <QString> |
47 int anchorOffset() {return m_anchorOffset;} |
65 int anchorOffset() {return m_anchorOffset;} |
48 bool initiallyVisible() { return m_initiallyVisible; } //NB: needed? |
66 bool initiallyVisible() { return m_initiallyVisible; } //NB: needed? |
49 bool hidesContent() { return m_hidesContent; } |
67 bool hidesContent() { return m_hidesContent; } |
50 QString elementId() { return m_elementId; } |
68 QString elementId() { return m_elementId; } |
51 QGraphicsWidget* widget() { return m_widget; } |
69 QGraphicsWidget* widget() { return m_widget; } |
|
70 QGraphicsWidget const * constWidget() const { return m_widget; } |
52 virtual void setWidget(QGraphicsWidget * widget) { m_widget = widget; } |
71 virtual void setWidget(QGraphicsWidget * widget) { m_widget = widget; } |
53 QString parentId() { return m_parentId; } |
72 QString parentId() { return m_parentId; } |
54 void setParentId(const QString& parent) { m_parentId = parent; } |
73 void setParentId(const QString& parent) { m_parentId = parent; } |
55 void setTransform(QTransform transform); |
74 void setTransform(QTransform transform); |
56 QTransform transform(); |
75 QTransform transform(); |
57 QPointF position() const; |
76 QPointF position() const; |
58 virtual void addChild(ChromeSnippet * child); |
77 virtual void addChild(ChromeSnippet * child); |
59 QWebElement element() {return m_element;} |
78 QWebElement element() {return m_element;} |
60 void dump(); |
79 void dump(); |
61 void addLink(ChromeSnippet*); |
80 void addLink(ChromeSnippet*); |
62 QList<ChromeSnippet *> links() {return m_links;} |
81 ChromeSnippet * linkedSnippet() {return m_link;} |
63 public slots: |
82 public slots: |
64 void setAnchor(const QString& anchor, bool update = true); |
83 void setAnchor(const QString& anchor, bool update = true); |
65 void setAnchorOffset(int offset, bool update = true); |
84 void setAnchorOffset(int offset, bool update = true); |
66 virtual void toggleVisibility(bool animate = true); |
85 virtual void toggleVisibility(bool animate = true); |
67 void setVisible(bool visiblity, bool animate = true); |
86 virtual void setVisible(bool visiblity, bool animate = true); |
68 void show(bool animate = true) { setVisible(true, animate);} |
87 void show(bool animate = true) { setVisible(true, animate);} |
69 virtual void hide(bool animate = true) { setVisible(false, animate);} |
88 virtual void hide(bool animate = true) { setVisible(false, animate);} |
70 void setOpacity(qreal opacity); |
89 void setOpacity(qreal opacity); |
71 qreal opacity(); |
90 qreal opacity(); |
72 void setEffect(const QString & effect); |
91 void setEffect(const QString & effect); |
73 void enableEffect(bool enable); |
92 void enableEffect(bool enable); |
74 void toggleEffect(); |
93 void toggleEffect(); |
75 void grabFocus(); |
94 void grabFocus(); |
76 void setVisibilityAnimator(const QString& animator); |
95 QObject *setVisibilityAnimator(const QString& animator); |
77 void visibilityFinished(bool visiblity); |
96 void visibilityFinished(bool visiblity); |
78 void moveBy(int dx, int dy); |
97 void moveBy(int dx, int dy); |
79 void anchorTo(const QString & id, int x = 0, int y = 0); |
98 void anchorTo(const QString & id, int x = 0, int y = 0); |
80 void unAnchor(); |
99 void unAnchor(); |
81 void anchorToView(const QString& view, const QString& where="top"); |
100 void anchorToView(const QString& view, const QString& where="top"); |
89 bool isHiding() { return m_hiding; } |
108 bool isHiding() { return m_hiding; } |
90 int zValue(); |
109 int zValue(); |
91 void setZValue(int z); |
110 void setZValue(int z); |
92 //NB: deprecate repaint: if this is needed, then there are bugs that are preventing updates |
111 //NB: deprecate repaint: if this is needed, then there are bugs that are preventing updates |
93 void repaint() { m_widget->update(); } |
112 void repaint() { m_widget->update(); } |
94 void onContextMenuEvent(QGraphicsSceneContextMenuEvent * ev); |
113 void onContextMenuEvent(QGraphicsSceneContextMenuEvent * ev); |
|
114 void disableDontShowFlag() {m_dontshowFlag = false ;} |
95 signals: |
115 signals: |
96 void hidden(); |
116 void hidden(); |
97 void shown(); |
117 void shown(); |
98 void externalMouseEvent( |
118 void externalMouseEvent( |
99 int type, |
119 int type, |
116 QString getAnchorString(); |
136 QString getAnchorString(); |
117 Q_PROPERTY(int anchorOffset READ anchorOffset WRITE setAnchorOffset) |
137 Q_PROPERTY(int anchorOffset READ anchorOffset WRITE setAnchorOffset) |
118 Q_PROPERTY(int zValue READ zValue WRITE setZValue) |
138 Q_PROPERTY(int zValue READ zValue WRITE setZValue) |
119 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) |
139 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) |
120 Q_PROPERTY(bool dontShow READ getDontShowFlag WRITE setDontShowFlag) |
140 Q_PROPERTY(bool dontShow READ getDontShowFlag WRITE setDontShowFlag) |
121 protected: |
141 Q_PROPERTY(QObject* position READ getPosition) |
|
142 Q_PROPERTY(QObject* geometry READ getGeometry) |
|
143 Q_PROPERTY(bool enabled WRITE setEnabled READ enabled) |
122 bool getDontShowFlag() {return m_dontshowFlag;} |
144 bool getDontShowFlag() {return m_dontshowFlag;} |
123 void setDontShowFlag(bool flag){ m_dontshowFlag = flag;} |
145 void setDontShowFlag(bool flag){ m_dontshowFlag = flag;} |
|
146 bool enabled() const; |
|
147 void setEnabled(bool value); |
124 protected: |
148 protected: |
125 QString m_elementId; |
149 QString m_elementId; |
126 QWebElement m_element; |
150 QWebElement m_element; |
127 QString m_parentId; |
151 QString m_parentId; |
128 ChromeWidget * m_chrome; |
152 ChromeWidget * m_chrome; |