|
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 #include "cxefakezoomcontrol.h" |
|
18 #include "cxestate.h" |
|
19 |
|
20 CxeFakeZoomControl::CxeFakeZoomControl() |
|
21 : CxeStateMachine("CxeFakeZoomControl") |
|
22 { |
|
23 initializeStates(); |
|
24 } |
|
25 |
|
26 CxeFakeZoomControl::~CxeFakeZoomControl() |
|
27 { |
|
28 } |
|
29 |
|
30 CxeZoomControl::State CxeFakeZoomControl::state() const |
|
31 { |
|
32 return static_cast<State>(stateId()); |
|
33 } |
|
34 |
|
35 int CxeFakeZoomControl::min() const |
|
36 { |
|
37 return 0; |
|
38 } |
|
39 |
|
40 int CxeFakeZoomControl::max() const |
|
41 { |
|
42 return 5; |
|
43 } |
|
44 |
|
45 void CxeFakeZoomControl::zoomInOneStep() |
|
46 { |
|
47 } |
|
48 |
|
49 void CxeFakeZoomControl::zoomOutOneStep() |
|
50 { |
|
51 } |
|
52 |
|
53 void CxeFakeZoomControl::zoomTo(int /*value*/) |
|
54 { |
|
55 } |
|
56 |
|
57 void CxeFakeZoomControl::initializeStates() |
|
58 { |
|
59 // addState(id, name, allowed next states) |
|
60 addState(new CxeState(Idle , "Idle", Ready)); |
|
61 addState(new CxeState(ZoomingIn, "ZoomingIn", Ready | ZoomingOut)); |
|
62 addState(new CxeState(ZoomingOut, "ZoomingOut", Ready | ZoomingIn)); |
|
63 addState(new CxeState(Ready, "Ready", Idle | ZoomingOut | ZoomingIn)); |
|
64 |
|
65 setInitialState(Idle); |
|
66 } |
|
67 |
|
68 void CxeFakeZoomControl::handleStateChanged(int newStateId, CxeError::Id error) |
|
69 { |
|
70 emit stateChanged(static_cast<State>(newStateId), error); |
|
71 } |