equal
deleted
inserted
replaced
22 #define __GINEBRA_TITLEURLCONTAINERSNIPPET_H |
22 #define __GINEBRA_TITLEURLCONTAINERSNIPPET_H |
23 |
23 |
24 #include <QtGui> |
24 #include <QtGui> |
25 #include "ChromeSnippet.h" |
25 #include "ChromeSnippet.h" |
26 #include "NativeChromeItem.h" |
26 #include "NativeChromeItem.h" |
|
27 #include "UrlSearchSnippet.h" |
27 |
28 |
28 namespace GVA { |
29 namespace GVA { |
29 |
30 |
30 |
31 |
31 class ChromeWidget; |
32 class ChromeWidget; |
43 TitleUrlContainerItem(ChromeSnippet * snippet, ChromeWidget * chrome, QGraphicsItem * parent = 0); |
44 TitleUrlContainerItem(ChromeSnippet * snippet, ChromeWidget * chrome, QGraphicsItem * parent = 0); |
44 virtual ~TitleUrlContainerItem(); |
45 virtual ~TitleUrlContainerItem(); |
45 |
46 |
46 /// The URL of the web page. |
47 /// The URL of the web page. |
47 QString url() const; |
48 QString url() const; |
|
49 void cut(); |
|
50 void copy(); |
|
51 void paste(); |
|
52 void setContextMenuStatus(bool on); |
|
53 void setFocusForEditor() { m_urlTileWidget->setFocusForEditor(); } |
48 |
54 |
49 protected: |
55 protected: |
50 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); |
56 virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); |
51 virtual void resizeEvent(QGraphicsSceneResizeEvent * event); |
57 virtual void resizeEvent(QGraphicsSceneResizeEvent * event); |
52 |
58 |
53 private Q_SLOTS: |
59 private Q_SLOTS: |
54 void onChromeResize(); |
60 void onChromeResize(); |
55 void changeLayout(bool editMode); |
61 void changeLayout(bool editMode); |
|
62 |
|
63 Q_SIGNALS: |
|
64 void contextEvent(bool); |
56 |
65 |
57 private: |
66 private: |
58 void setProperties(); |
67 void setProperties(); |
59 |
68 |
60 private: |
69 private: |
62 QGraphicsWidget * m_viewPort; |
71 QGraphicsWidget * m_viewPort; |
63 ActionButton * m_backStepButton; |
72 ActionButton * m_backStepButton; |
64 GUrlSearchItem * m_urlTileWidget; |
73 GUrlSearchItem * m_urlTileWidget; |
65 QGraphicsPixmapItem * m_dividerImage; |
74 QGraphicsPixmapItem * m_dividerImage; |
66 // painting support |
75 // painting support |
67 QPen m_pen; |
|
68 QLinearGradient m_grad; |
76 QLinearGradient m_grad; |
69 }; |
77 }; |
70 |
78 |
71 |
79 |
72 /* \brief This is the container snippet for title-url combo |
80 /* \brief This is the container snippet for title-url combo |
84 static TitleUrlContainerSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element); |
92 static TitleUrlContainerSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element); |
85 |
93 |
86 /// The URL of the web page. |
94 /// The URL of the web page. |
87 QString url() const; |
95 QString url() const; |
88 Q_PROPERTY(QString url READ url) |
96 Q_PROPERTY(QString url READ url) |
|
97 |
|
98 Q_SIGNALS: |
|
99 void contextEvent(bool isContentSelected, QString snippetId); |
|
100 |
|
101 public slots: |
|
102 void cut() { titleUrlContainerItem()->cut(); } |
|
103 void copy() { titleUrlContainerItem()->copy(); } |
|
104 void paste(){ titleUrlContainerItem()->paste(); } |
|
105 bool editable() { return true; } |
|
106 bool useNativeCopyPasteMenu() { return true; } |
|
107 void sendContextMenuEvent(bool isContentSelected); |
|
108 void setContextMenuStatus(bool on) { titleUrlContainerItem()->setContextMenuStatus(on); } |
|
109 void grabFocus() { titleUrlContainerItem()->setFocusForEditor(); } |
|
110 |
|
111 private: |
|
112 TitleUrlContainerItem * titleUrlContainerItem() { return qobject_cast<TitleUrlContainerItem*> (widget());} |
89 }; |
113 }; |
90 |
114 |
91 } // end of namespace GVA |
115 } // end of namespace GVA |
92 |
116 |
93 #endif // __GINEBRA_TITLEURLCONTAINERSNIPPET_H |
117 #endif // __GINEBRA_TITLEURLCONTAINERSNIPPET_H |