20 * windows view toolbar buttons |
20 * windows view toolbar buttons |
21 * |
21 * |
22 */ |
22 */ |
23 |
23 |
24 #include "WindowToolbarSnippet.h" |
24 #include "WindowToolbarSnippet.h" |
|
25 #include "ToolbarChromeItem.h" |
25 #include "ViewStack.h" |
26 #include "ViewStack.h" |
26 #include <QDebug> |
27 #include <QDebug> |
27 |
28 |
28 namespace GVA { |
29 namespace GVA { |
29 |
30 |
30 WindowToolbarSnippet::WindowToolbarSnippet(const QString& elementId, ChromeWidget * chrome, |
31 WindowToolbarSnippet::WindowToolbarSnippet(const QString& elementId, ChromeWidget * chrome, |
31 const QRectF& ownerArea, const QWebElement & element, QGraphicsWidget * widget) |
32 const QWebElement & element) |
32 : DualButtonToolbarSnippet(elementId, chrome, ownerArea, element, widget) |
33 : DualButtonToolbarSnippet(elementId, chrome, element) |
33 { |
34 { |
34 m_type = TOOLBAR_WINDOWS_VIEW; |
35 m_type = TOOLBAR_WINDOWS_VIEW; |
35 } |
36 } |
36 |
37 |
37 WindowToolbarSnippet::~WindowToolbarSnippet() |
38 WindowToolbarSnippet::~WindowToolbarSnippet() |
38 { |
39 { |
39 } |
40 } |
40 |
41 |
|
42 WindowToolbarSnippet * WindowToolbarSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element) |
|
43 { |
|
44 WindowToolbarSnippet * that = new WindowToolbarSnippet(elementId, chrome, element); |
|
45 that->setChromeWidget(new ToolbarChromeItem(that)); |
|
46 return that; |
|
47 } |
|
48 |
41 void WindowToolbarSnippet::addChild(ChromeSnippet * child) { |
49 void WindowToolbarSnippet::addChild(ChromeSnippet * child) { |
42 |
50 |
43 WebChromeContainerSnippet * s = dynamic_cast<WebChromeContainerSnippet* >(child); |
51 WebChromeContainerSnippet * s = dynamic_cast<WebChromeContainerSnippet* >(child); |
44 if (!s) { |
52 if (!s) { |
45 ToolbarActions_t* t = new ToolbarActions_t(); |
53 ToolbarActions_t* t = new ToolbarActions_t(); |
46 if (child->elementId() == "WinBackButton" ) { |
54 if (child->elementId() == "WinBackButton" ) { |
47 t->actionId = WINDOW_VIEW_ACTION_BACK; |
55 t->actionId = WINDOW_VIEW_ACTION_BACK; |
48 t->actionName = WINDOW_TOOLBAR_BACK; |
56 t->actionName = WINDOW_TOOLBAR_BACK; |
49 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png"; |
57 t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back.png"; |
50 t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_disabled.png"; |
58 t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_disabled.png"; |
51 t->selectedImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png"; |
59 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_back_pressed.png"; |
52 |
60 |
53 } |
61 } |
54 else if (child->elementId() == "WinAddWindow" ) { |
62 else if (child->elementId() == "WinAddWindow" ) { |
55 t->actionId = WINDOW_VIEW_ACTION_ADD; |
63 t->actionId = WINDOW_VIEW_ACTION_ADD; |
56 t->actionName = WINDOW_TOOLBAR_ADD; |
64 t->actionName = WINDOW_TOOLBAR_ADD; |
57 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png"; |
65 t->normalImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add.png"; |
58 t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_disabled.png"; |
66 t->disabledImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_disabled.png"; |
59 t->selectedImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png"; |
67 t->activeImg = ":/chrome/bedrockchrome/toolbar.snippet/icons/icon_add_pressed.png"; |
60 } |
68 } |
61 t->id = child->elementId(); |
69 t->id = child->elementId(); |
62 m_actionInfo.append(t); |
70 m_actionInfo.append(t); |
63 } |
71 } |
64 |
72 |