1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 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. |
|
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. |
11 * |
13 * |
12 * Contributors: |
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/". |
13 * |
17 * |
14 * Description: |
18 * Description: |
15 * |
19 * |
16 */ |
20 */ |
17 |
|
18 |
21 |
19 #ifndef __WINDOWVIEW_H__ |
22 #ifndef __WINDOWVIEW_H__ |
20 #define __WINDOWVIEW_H__ |
23 #define __WINDOWVIEW_H__ |
21 |
24 |
22 #include <QWidget> |
25 #include <QWidget> |
23 #include <QGraphicsWidget> |
26 #include <QGraphicsWidget> |
24 #include <QAction> |
27 #include <QAction> |
25 #include "controllableviewimpl.h" |
28 #include "controllableviewimpl.h" |
26 |
29 |
27 class QWebHistory; |
30 class QWebHistory; |
|
31 class WebPageController; |
28 |
32 |
29 namespace WRT { |
33 namespace WRT { |
30 |
34 |
31 class WrtBrowserContainer; |
35 class WrtBrowserContainer; |
32 class WrtPageManager; |
|
33 class WindowViewPrivate; |
36 class WindowViewPrivate; |
34 |
37 |
35 class BWF_EXPORT WindowView : public ControllableViewBase |
38 class BWF_EXPORT WindowView : public ControllableViewBase |
36 { |
39 { |
37 Q_OBJECT |
40 Q_OBJECT |
41 WindowViewActive, |
44 WindowViewActive, |
42 WindowViewAddPage, |
45 WindowViewAddPage, |
43 WindowViewDeletePage, |
46 WindowViewDeletePage, |
44 WindowViewInvalid |
47 WindowViewInvalid |
45 }; |
48 }; |
46 WindowView(WrtPageManager * mgr, QWidget* parent); |
49 |
47 WindowView(WrtPageManager * mgr, QGraphicsWidget* parent); |
50 enum Mode { |
|
51 WindowViewModeNormal, |
|
52 WindowViewModeTransition |
|
53 }; |
|
54 |
|
55 WindowView(WebPageController * mgr, QWidget* parent); |
|
56 WindowView(WebPageController * mgr, QGraphicsWidget* parent); |
48 ~WindowView(); |
57 ~WindowView(); |
49 |
58 |
50 virtual void show() { |
59 virtual void show() { |
51 widget()->show(); |
60 widget()->show(); |
52 } |
61 } |
53 |
62 |
54 virtual void hide() { |
63 virtual void hide() { |
55 widget()->hide(); |
64 widget()->hide(); |
56 } |
65 } |
57 |
66 |
58 WrtPageManager* wrtPageManager(); |
67 WebPageController* webPageController(); |
59 |
68 |
60 public: // public actions available for this view |
69 public: // public actions available for this view |
61 QAction * getActionForward(); |
70 QAction * getActionForward(); |
62 QAction * getActionBack(); |
71 QAction * getActionBack(); |
63 QAction * getActionOK(); |
72 QAction * getActionOK(); |
64 QAction * getActionCancel(); |
73 QAction * getActionCancel(); |
65 QAction * getActionAddWindow(); |
74 QAction * getActionAddWindow(); |
66 QAction * getActionDelWindow(); |
75 QAction * getActionDelWindow(); |
67 |
76 |
68 QRect centralRect(); |
|
69 QImage currentSlide(); |
|
70 void setBlankWindowImg(QImage * img); |
|
71 void hideWidget(); |
|
72 void showWidget(); |
|
73 void setSize(QSize& size); |
77 void setSize(QSize& size); |
|
78 |
|
79 void setMode(Mode mode); |
74 |
80 |
75 public: // Pure Virtual from ControllableView |
81 public: // Pure Virtual from ControllableView |
76 QString title() const; |
82 QString title() const; |
77 bool isActive(); |
83 bool isActive(); |
78 QList<QAction*> getContext(); |
84 QList<QAction*> getContext(); |
79 void displayModeChanged(QString& newMode); |
85 void displayModeChanged(QString& newMode); |
80 QGraphicsWidget* widget() const; |
86 QGraphicsWidget* widget() const; |
81 |
87 |
|
88 int pageCount(); |
|
89 int currentPageIndex(); |
|
90 |
82 signals: |
91 signals: |
83 void centerIndexChanged(int index); |
92 void centerIndexChanged(int index); |
84 void ok(WrtBrowserContainer * newPage); |
93 void ok(WrtBrowserContainer * newPage); |
85 void cancel(); |
94 void cancel(); |
86 void animateComplete(); |
95 void animateComplete(); |
87 void addPageComplete(); |
96 void addPageComplete(); |
|
97 void newWindowTransitionComplete(); |
|
98 void pageAdded(); |
88 |
99 |
89 public slots: |
100 public slots: |
90 void activate(); |
101 void activate(); |
91 void deactivate(); |
102 void deactivate(); |
92 void forward(); |
103 void forward(); |
93 void back(); |
104 void back(); |
94 void updateWindows(); |
105 void updateWindows(); |
|
106 void onPageCreated(WRT::WrtBrowserContainer*); |
95 |
107 |
96 void animate(WrtBrowserContainer *, WrtBrowserContainer*); |
108 void animate(WrtBrowserContainer *, WrtBrowserContainer*); |
97 |
109 |
98 private slots: |
110 private slots: |
99 void changedCenterIndex(int); |
111 void changedCenterIndex(int); |
100 void updateActions(); |
112 void updateActions(); |
101 void okTriggered(int index); |
113 void okTriggered(int index); |
102 void okTriggeredCplt(); |
114 void okTriggeredCplt(); |
103 void pageLoadCplt(bool ok); |
115 void addPage(WrtBrowserContainer* pg= NULL); |
104 void addPage(); |
|
105 void addPageCplt(int); |
116 void addPageCplt(int); |
106 void addPageCplt(); |
117 void addPageCplt(); |
107 void delPage(); |
118 void delPage(); |
108 void delPage(int); |
119 void delPage(int); |
109 void delPageCplt(int); |
120 void delPageCplt(int); |
|
121 void endAnimation(); |
|
122 void addNextPage(); |
110 |
123 |
111 private: |
124 private: |
112 void init(); |
125 void init(); |
113 |
126 |
114 void setCenterIndex(); |
127 void setCenterIndex(); |
123 |
136 |
124 class BWF_EXPORT WindowViewJSObject : public ControllableViewJSObject { |
137 class BWF_EXPORT WindowViewJSObject : public ControllableViewJSObject { |
125 Q_OBJECT |
138 Q_OBJECT |
126 public: |
139 public: |
127 WindowViewJSObject(WindowView* view, QWebFrame* webFrame, const QString& objectName); |
140 WindowViewJSObject(WindowView* view, QWebFrame* webFrame, const QString& objectName); |
128 ~WindowViewJSObject(); |
|
129 |
|
130 |
141 |
131 public slots: |
142 Q_SIGNALS: |
132 void ok(WrtBrowserContainer * newPage); |
143 void pageAdded(); |
133 void addPageComplete(); |
|
134 void changedCenterIndex(int); |
|
135 |
|
136 signals: |
|
137 void done(WrtBrowserContainer * newPage); |
|
138 void pageAdded(); |
|
139 void centerIndexChanged(int index); |
|
140 |
144 |
|
145 public Q_SLOTS: |
|
146 int pageCount(){ return windowView()->pageCount();} |
|
147 int currentPageIndex(){ return windowView()->currentPageIndex();} |
141 protected: |
148 protected: |
142 WindowView * windowView() { return static_cast<WindowView *>(m_contentView); } |
149 WindowView * windowView() { return static_cast<WindowView *>(m_contentView); } |
143 WindowView * windowViewConst() const { return static_cast<WindowView *>(m_contentView); } |
150 WindowView * windowViewConst() const { return static_cast<WindowView *>(m_contentView); } |
|
151 |
|
152 |
144 }; |
153 }; |
145 |
154 |
146 } |
155 } |
147 #endif // __WINDOWVIEW_H__ |
156 #endif // __WINDOWVIEW_H__ |