|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
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. |
|
8 * |
|
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 * |
|
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: |
|
19 * |
|
20 */ |
|
21 #ifndef __GINEBRA_CONTENTTOOLBARSNIPPET_H |
|
22 #define __GINEBRA_CONTENTTOOLBARSNIPPET_H |
|
23 |
|
24 #include <QtGui> |
|
25 #include "ActionButtonSnippet.h" |
|
26 #include "Toolbar.h" |
|
27 #include "ToolbarSnippet.h" |
|
28 #include "WebChromeContainerSnippet.h" |
|
29 |
|
30 class QTimer; |
|
31 class ChromeSnippet; |
|
32 |
|
33 namespace GVA { |
|
34 |
|
35 class ContentToolbarSnippet : public ToolbarSnippet |
|
36 { |
|
37 Q_OBJECT |
|
38 public: |
|
39 ContentToolbarSnippet(const QString& elementId, ChromeWidget * chrome, const QWebElement & element); |
|
40 virtual ~ContentToolbarSnippet(); |
|
41 |
|
42 static ContentToolbarSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element); |
|
43 WebChromeContainerSnippet * middleSnippet() { return m_middleSnippet;} |
|
44 void handleToolbarStateChange(ContentToolbarState); |
|
45 |
|
46 Q_SIGNALS: |
|
47 void menuButtonSelected(); |
|
48 void menuButtonCanceled(); |
|
49 |
|
50 private Q_SLOTS: |
|
51 void onChromeComplete(); |
|
52 void handleZoomButton(); |
|
53 void handleMenuButton(); |
|
54 void handleMVButton(); |
|
55 void handleToggleTBButton(); |
|
56 void childAdded(ChromeSnippet* child); |
|
57 void updateOwnerArea(); |
|
58 void updateSize(QSize ); |
|
59 |
|
60 /// Slot that sets the state of the action button to active. Handles mouseEvent signal of toolbar |
|
61 /// action buttons and any sub-chrome children action buttons |
|
62 void onMouseEvent( QEvent::Type type); |
|
63 |
|
64 /// Slot that resets the timer that controls the sub-chrome. Handles mouseEvent signal of the sub-chrome |
|
65 /// as well as those of the sub-chrome chidlren's |
|
66 void onSnippetMouseEvent( QEvent::Type type); |
|
67 void onHidden(); |
|
68 void onShown(); |
|
69 void onInactivityTimer(); |
|
70 void onExternalMouse(QEvent * ev, const QString & name, const QString & description); |
|
71 void onAspectChanged( ); |
|
72 |
|
73 |
|
74 private: |
|
75 void addChild(ChromeSnippet * child) ; |
|
76 void manageChildren(ChromeItem * it); |
|
77 |
|
78 void addZoomButton(QAction * action, ActionButtonSnippet* button); |
|
79 void addMenuButton(QAction * action, ActionButtonSnippet* button); |
|
80 void addMostVisitedButton(QAction * action, ActionButtonSnippet* button); |
|
81 void addToggleTBButton(QAction * action, ActionButtonSnippet* button); |
|
82 void setAction(ChromeSnippet * s); |
|
83 void connectHideShowSignals(ActionButtonSnippet * button) ; |
|
84 void addActionInfo(QString id); |
|
85 |
|
86 void setWidth(int); |
|
87 void resetTimer(bool start=true); |
|
88 void hideOtherPopups(QString); |
|
89 void manageLink(ChromeItem * item) ; |
|
90 ChromeSnippet* getLinkedButton(ChromeSnippet * snippet ); |
|
91 |
|
92 |
|
93 WebChromeContainerSnippet* m_middleSnippet; |
|
94 QTimer* m_subChromeInactiveTimer; |
|
95 ChromeSnippet * m_subChromeSnippet; |
|
96 |
|
97 }; |
|
98 |
|
99 } // end of namespace GVA |
|
100 |
|
101 #endif // __GINEBRA_CONTENTTOOLBARSNIPPET_H |