34
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2004 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: Edit mode for widget drag and drop.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef XNEDITMODE_H
|
|
19 |
#define XNEDITMODE_H
|
|
20 |
|
|
21 |
// System includes
|
|
22 |
#include <coecntrl.h>
|
|
23 |
|
|
24 |
// Forward declarations
|
|
25 |
class CXnUiEngine;
|
|
26 |
class CXnViewManager;
|
|
27 |
class CXnPluginData;
|
|
28 |
class CXnNode;
|
|
29 |
class CFbsBitGc;
|
|
30 |
class CFbsBitmap;
|
|
31 |
class CFbsBitmapDevice;
|
|
32 |
class CWindowToBitmapMappingGc;
|
|
33 |
|
|
34 |
// Class declaration
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Edit mode. Enables widget drag and drop.
|
|
38 |
*
|
|
39 |
* @ingroup group_xnlayoutengine
|
|
40 |
* @lib xnlayoutengine.lib
|
|
41 |
* @since Series 60 5.1
|
|
42 |
*/
|
|
43 |
NONSHARABLE_CLASS( CXnEditMode ) : public CCoeControl
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
// Data types
|
|
47 |
enum TEditState
|
|
48 |
{
|
|
49 |
ENone = 0x00,
|
|
50 |
EWaitDrag = 0x01,
|
|
51 |
EShootContent = 0x02,
|
|
52 |
EDragging = 0x04,
|
|
53 |
EDragAndDrop = 0x08,
|
|
54 |
EKeyMove = 0x10
|
|
55 |
};
|
|
56 |
|
|
57 |
public:
|
|
58 |
/**
|
|
59 |
* Two-phased constructor.
|
|
60 |
*/
|
|
61 |
static CXnEditMode* NewL( CXnUiEngine& aUiEngine );
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Destructor.
|
|
65 |
*/
|
|
66 |
~CXnEditMode();
|
|
67 |
|
|
68 |
private:
|
|
69 |
// from CCoeControl
|
|
70 |
|
|
71 |
/**
|
|
72 |
* @see CCoeControl
|
|
73 |
*/
|
|
74 |
void Draw( const TRect& aRect ) const;
|
|
75 |
|
|
76 |
/**
|
|
77 |
* @see CCoeControl
|
|
78 |
*/
|
|
79 |
void MakeVisible( TBool aVisible );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* @see CCoeControl
|
|
83 |
*/
|
|
84 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
85 |
|
|
86 |
/**
|
|
87 |
* @see CCoeControl
|
|
88 |
*/
|
|
89 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
90 |
TEventCode aType );
|
|
91 |
|
|
92 |
/**
|
|
93 |
* @see CCoeControl
|
|
94 |
*/
|
|
95 |
void SizeChanged();
|
|
96 |
|
|
97 |
public:
|
|
98 |
// New functions
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Changes the state of edit mode.
|
|
102 |
*
|
|
103 |
* @since Series 60 5.0
|
|
104 |
* @param aSet The state of edit mode.
|
|
105 |
*/
|
|
106 |
void SetEditModeL( CXnEditMode::TEditState aSet );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Gets the status of the edit mode.
|
|
110 |
*
|
|
111 |
* @since Series 60 5.0
|
|
112 |
* @return Edit mode state.
|
|
113 |
*/
|
|
114 |
CXnEditMode::TEditState EditState() const;
|
|
115 |
|
|
116 |
/**
|
|
117 |
* This is for to re-initializing the double buffer when the orientations
|
|
118 |
* is changed
|
|
119 |
*
|
|
120 |
* @since Series 60 5.0
|
|
121 |
*/
|
|
122 |
void HandleScreenDeviceChangedL();
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Sets control rect.
|
|
126 |
*
|
|
127 |
* @since Series 60 5.0
|
|
128 |
*/
|
|
129 |
void SetClientRect( TRect aRect );
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Reset the dragging state and update screen
|
|
133 |
*
|
|
134 |
* @since Series 60 5.0
|
|
135 |
*/
|
|
136 |
void StopDraggingL();
|
|
137 |
|
|
138 |
private:
|
|
139 |
// new functions
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Organizing starts using drag and drop.
|
|
143 |
*
|
|
144 |
* @since Series 60 5.0
|
|
145 |
* @param aPlugin Plugin to drag.
|
|
146 |
*/
|
|
147 |
void StartDragL( const CXnPluginData& aPlugin );
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Reset the dragging state and deletes screenshot bitmaps.
|
|
151 |
*
|
|
152 |
* @since Series 60 5.0
|
|
153 |
*/
|
|
154 |
void StopDragL();
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Updates invalid parts of the screen. Calls internally DrawNow
|
|
158 |
*
|
|
159 |
* @since Series 60 5.0
|
|
160 |
*/
|
|
161 |
void UpdateScreen();
|
|
162 |
|
|
163 |
private:
|
|
164 |
// Constructors
|
|
165 |
|
|
166 |
/**
|
|
167 |
* C++ default constructor.
|
|
168 |
*/
|
|
169 |
CXnEditMode( CXnUiEngine& aEngine );
|
|
170 |
|
|
171 |
/**
|
|
172 |
* 2nd phase constructor.
|
|
173 |
*/
|
|
174 |
void ConstructL();
|
|
175 |
|
|
176 |
private:
|
|
177 |
// Data
|
|
178 |
|
|
179 |
/**
|
|
180 |
* UI engine
|
|
181 |
* Not own.
|
|
182 |
*/
|
|
183 |
CXnUiEngine& iUiEngine;
|
|
184 |
|
|
185 |
/**
|
|
186 |
* View manager
|
|
187 |
* Not own.
|
|
188 |
*/
|
|
189 |
CXnViewManager& iViewManager;
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Screenshot of part of mainpane
|
|
193 |
* Owned
|
|
194 |
*/
|
|
195 |
CFbsBitmap* iMainpane;
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Screenshot of widget
|
|
199 |
* Owned
|
|
200 |
*/
|
|
201 |
CFbsBitmap* iWidget;
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Mapping Gc
|
|
205 |
* Owned
|
|
206 |
*/
|
|
207 |
CWindowToBitmapMappingGc* iMapGc;
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Bmp device
|
|
211 |
* Owned
|
|
212 |
*/
|
|
213 |
CFbsBitmapDevice* iBmpDevice;
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Bmp Gc
|
|
217 |
* Owned
|
|
218 |
*/
|
|
219 |
CFbsBitGc* iBmpGc;
|
|
220 |
|
|
221 |
/**
|
|
222 |
* A pointer to the node that is being dragged.
|
|
223 |
* Not own.
|
|
224 |
*/
|
|
225 |
CXnNode* iDraggingNode;
|
|
226 |
|
|
227 |
/**
|
|
228 |
* A pointer to the node that is underneath of the dragging node.
|
|
229 |
* Not own.
|
|
230 |
*/
|
|
231 |
CXnNode* iTargetNode;
|
|
232 |
|
|
233 |
/**
|
|
234 |
* State of edit mode
|
|
235 |
*/
|
|
236 |
CXnEditMode::TEditState iState;
|
|
237 |
|
|
238 |
/**
|
|
239 |
* A point where dragging started from.
|
|
240 |
*/
|
|
241 |
TPoint iStylusDownPos;
|
|
242 |
|
|
243 |
/**
|
|
244 |
* A point where drawing was done last time.
|
|
245 |
*/
|
|
246 |
TPoint iPreviousPos;
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Screenshot draw position
|
|
250 |
*/
|
|
251 |
TPoint iDrawPos;
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Last redraw rect
|
|
255 |
*/
|
|
256 |
TRect iLastDrawRect;
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Flag determine whether drag is occured
|
|
260 |
*/
|
|
261 |
TBool iDragged;
|
|
262 |
};
|
|
263 |
|
|
264 |
#endif
|