|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
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 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "nmuiheaders.h" |
|
20 |
|
21 /*! |
|
22 \class NmBaseView |
|
23 \brief Base class for views, contains general data about view |
|
24 */ |
|
25 |
|
26 /*! |
|
27 Constructor |
|
28 */ |
|
29 NmBaseView::NmBaseView(NmUiStartParam *startParam, |
|
30 NmApplication &application, |
|
31 QGraphicsItem *parent) |
|
32 : HbView(parent), |
|
33 mStartParam(startParam), |
|
34 mApplication(application) |
|
35 { |
|
36 NM_FUNCTION; |
|
37 } |
|
38 |
|
39 /*! |
|
40 Destructor |
|
41 */ |
|
42 NmBaseView::~NmBaseView() |
|
43 { |
|
44 NM_FUNCTION; |
|
45 |
|
46 delete mStartParam; |
|
47 } |
|
48 |
|
49 /*! |
|
50 Is it ok to exit current view. Function is called when exiting the view. |
|
51 Views can override this function and deside are they going to signal popView |
|
52 or not. For example based on the user query. |
|
53 */ |
|
54 void NmBaseView::okToExitView() |
|
55 { |
|
56 NM_FUNCTION; |
|
57 |
|
58 mApplication.popView(); |
|
59 } |
|
60 |
|
61 /*! |
|
62 About to exit view. Function is called before view is removed from |
|
63 view stack and deleted. Views can override this function and do pre-exit |
|
64 functions. For example editor can store message to drafts at this stage. |
|
65 */ |
|
66 void NmBaseView::aboutToExitView() |
|
67 { |
|
68 NM_FUNCTION; |
|
69 } |
|
70 |
|
71 /*! |
|
72 view ready. Function is called after mainwindow has received viewReady |
|
73 lazy loading signal. Views can choose to implement this function |
|
74 if it makes sense to construct items after main view is shown. |
|
75 */ |
|
76 void NmBaseView::viewReady() |
|
77 { |
|
78 NM_FUNCTION; |
|
79 } |
|
80 |
|
81 /*! |
|
82 About to change orientation. View can override this function if special |
|
83 handling is needed for the view when orientation is about to change. |
|
84 */ |
|
85 void NmBaseView::aboutToChangeOrientation() |
|
86 { |
|
87 NM_FUNCTION; |
|
88 } |
|
89 |
|
90 /*! |
|
91 Orientation changed. View can override this function if special |
|
92 handling is needed for the view when orientation is changed. |
|
93 */ |
|
94 void NmBaseView::orientationChanged(Qt::Orientation orientation) |
|
95 { |
|
96 NM_FUNCTION; |
|
97 |
|
98 Q_UNUSED(orientation); |
|
99 } |
|
100 |
|
101 /*! |
|
102 Mouse release event. View can override this function if special |
|
103 handling is required because of overlaying scroll area (viewer and editor) |
|
104 */ |
|
105 void NmBaseView::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
106 { |
|
107 NM_FUNCTION; |
|
108 |
|
109 Q_UNUSED(event); |
|
110 } |
|
111 |
|
112 /*! |
|
113 Mouse press event. View can override this function if special |
|
114 handling is required because of overlaying scroll area (viewer and editor) |
|
115 */ |
|
116 void NmBaseView::handleMousePressEvent(QGraphicsSceneMouseEvent *event) |
|
117 { |
|
118 NM_FUNCTION; |
|
119 |
|
120 Q_UNUSED(event); |
|
121 } |
|
122 |
|
123 |
|
124 /*! |
|
125 Mouse move event. View can override this function if special |
|
126 handling is required because of overlaying scroll area (viewer and editor) |
|
127 */ |
|
128 void NmBaseView::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
129 { |
|
130 NM_FUNCTION; |
|
131 |
|
132 Q_UNUSED(event); |
|
133 } |
|
134 |
|
135 |