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 |
21 |
18 |
|
19 #ifndef VIEWSTACK_H |
22 #ifndef VIEWSTACK_H |
20 #define VIEWSTACK_H |
23 #define VIEWSTACK_H |
|
24 |
21 #include <QObject> |
25 #include <QObject> |
|
26 #include "wrtbrowsercontainer.h" |
22 |
27 |
23 #include "ViewController.h" |
28 namespace GVA { |
24 |
29 |
25 class ViewController; |
30 class ViewController; |
26 class ChromeView; |
31 class ChromeView; |
|
32 class ChromeWidget; |
27 |
33 |
28 namespace GVA { |
34 /*! \ingroup JavascriptAPI |
29 |
35 * \brief This class is responsible for switching the main content window from one view to another. |
|
36 * |
|
37 * Javascript object name: "ViewStack". |
|
38 * |
|
39 * Example javascript code to switch the current content view from the Web view to the Bookmarks view: |
|
40 * \code |
|
41 * ViewStack.switchView("BookmarkHistoryView", "WebView"); |
|
42 * \endcode |
|
43 */ |
30 class ViewStack : public QObject |
44 class ViewStack : public QObject |
31 { |
45 { |
32 Q_OBJECT |
46 Q_OBJECT |
33 |
47 |
34 public: |
48 public: |
35 static ViewStack* getSingleton(); |
49 static ViewStack* getSingleton(); |
36 ViewController *getViewController() { return m_viewController;} |
50 ViewController *getViewController() { return m_viewController;} |
37 void setViewController(ViewController *value) { m_viewController = value; } |
51 void setViewController(ViewController *value) { m_viewController = value; } |
38 |
52 void setChromeWidget(ChromeWidget *value) { m_chrome = value; } |
|
53 |
39 public slots: |
54 public slots: |
40 void switchView(const QString &to, const QString &from); |
55 void switchView(const QString &to, const QString &from); |
|
56 void creatingPage(WRT::WrtBrowserContainer*); |
41 |
57 |
42 private: |
58 private: |
43 void fromWindowView(const QString &to); |
59 void fromWindowView(const QString &to); |
44 void fromGoAnywhereView(const QString &to); |
|
45 void fromWebView(const QString &to); |
60 void fromWebView(const QString &to); |
46 void fromBookmarkHistoryView(const QString &to); |
61 void fromBookmarkHistoryView(const QString &to); |
47 void fromBookmarkTreeView(const QString &to); |
62 void fromBookmarkTreeView(const QString &to); |
48 void fromSettingsView(const QString &to); |
63 void fromSettingsView(const QString &to); |
49 void toWindowView(); |
64 void toWindowView(); |
50 void toGoAnywhereView(); |
|
51 void toWebView(); |
65 void toWebView(); |
52 void toBookmarkHistoryView(); |
66 void toBookmarkHistoryView(); |
53 void toBookmarkView(); |
67 void toBookmarkView(); |
54 void initWindowView(); |
|
55 void initSettingsView(); |
|
56 void toSettingsView(); |
68 void toSettingsView(); |
57 |
69 |
58 private slots: |
70 private slots: |
59 void loadHistoryItem(int item); |
71 void loadHistoryItem(int item); |
60 void goBackFromGoAnywhereView(); |
|
61 void goBackFromWindowView(); |
72 void goBackFromWindowView(); |
62 void goBackFromRecentUrlView(); |
73 void goBackFromRecentUrlView(); |
63 void goBackFromBookmarkView(); |
74 void goBackFromBookmarkView(); |
64 void showContentView(int progress); |
75 void showContentView(int progress); |
65 void goBackFromSettingsView(); |
76 void goBackFromSettingsView(); |
66 |
77 |
67 |
78 |
68 signals: |
79 signals: |
69 void activateBookmark(); |
80 void activateBookmark(); |
70 void deActivateBookmark(); |
|
71 void activateHistory(); |
|
72 void deActivateHistory(); |
|
73 void activateBookMarkHistory(); |
|
74 void deActivateBookMarkHistory(); |
|
75 void activateWindowView(); |
81 void activateWindowView(); |
76 void deActivateWindowView(); |
82 void deActivateWindowView(); |
77 void activateWebView(); |
|
78 void deActivateWebView(); |
|
79 void activateSettingsView(); |
|
80 void deActivateSettingsView(); |
|
81 void currentViewChanged(); |
83 void currentViewChanged(); |
82 |
84 |
83 void pageChanged(int); |
85 void pageChanged(int); |
84 |
86 |
85 private: |
87 private: |
86 ViewController *m_viewController; // Not owned |
88 ViewController *m_viewController; // Not owned |
|
89 ChromeWidget *m_chrome; // Not owned |
87 }; |
90 }; |
88 |
91 |
89 } // end of namespace |
92 } // end of namespace |
90 |
93 |
91 #endif // VIEWSTACK_H |
94 #endif // VIEWSTACK_H |