|
1 // pointer.cpp |
|
2 // |
|
3 // Copyright (c) 2009 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #include <fshell/ioutils.h> |
|
14 #include <fshell/common.mmh> |
|
15 |
|
16 using namespace IoUtils; |
|
17 |
|
18 class CCmdPointer : public CCommandBase |
|
19 { |
|
20 public: |
|
21 static CCommandBase* NewLC(); |
|
22 ~CCmdPointer(); |
|
23 private: |
|
24 CCmdPointer(); |
|
25 private: // From CCommandBase. |
|
26 virtual const TDesC& Name() const; |
|
27 virtual void DoRunL(); |
|
28 virtual void ArgumentsL(RCommandArgumentList& aArguments); |
|
29 private: |
|
30 TPoint iStart; |
|
31 }; |
|
32 |
|
33 EXE_BOILER_PLATE(CCmdPointer) |
|
34 |
|
35 CCommandBase* CCmdPointer::NewLC() |
|
36 { |
|
37 CCmdPointer* self = new(ELeave) CCmdPointer(); |
|
38 CleanupStack::PushL(self); |
|
39 self->BaseConstructL(); |
|
40 return self; |
|
41 } |
|
42 |
|
43 CCmdPointer::~CCmdPointer() |
|
44 { |
|
45 } |
|
46 |
|
47 CCmdPointer::CCmdPointer() |
|
48 { |
|
49 } |
|
50 |
|
51 const TDesC& CCmdPointer::Name() const |
|
52 { |
|
53 _LIT(KName, "pointer"); |
|
54 return KName; |
|
55 } |
|
56 |
|
57 void CCmdPointer::ArgumentsL(RCommandArgumentList& aArguments) |
|
58 { |
|
59 _LIT(KArgXPos, "x-pos"); |
|
60 aArguments.AppendIntL(iStart.iX, KArgXPos); |
|
61 |
|
62 _LIT(KArgYPos, "y-pos"); |
|
63 aArguments.AppendIntL(iStart.iY, KArgYPos); |
|
64 } |
|
65 |
|
66 void CCmdPointer::DoRunL() |
|
67 { |
|
68 TRawEvent rawEvent; |
|
69 rawEvent.Set(TRawEvent::EButton1Down, iStart.iX, iStart.iY); |
|
70 LeaveIfErr(UserSvr::AddEvent(rawEvent), _L("Failed to add TRawEvent::EButton1Down event at %d, %d"), iStart.iX, iStart.iY); |
|
71 rawEvent.Set(TRawEvent::EButton1Up, iStart.iX, iStart.iY); |
|
72 LeaveIfErr(UserSvr::AddEvent(rawEvent), _L("Failed to add TRawEvent::EButton1Up event at %d, %d"), iStart.iX, iStart.iY); |
|
73 } |