|
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: Implementation of mutli-page virtual keyboard control. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE |
|
19 #include <e32std.h> |
|
20 |
|
21 #include "peninputlayoutbubblectrl.h" |
|
22 #include "peninputlayoutvkb.h" |
|
23 #include "peninputpluginutils.h" |
|
24 #include "peninputmultipagevkb.h" |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // Symbian Constructor |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CMultiPageVirtualKeyboard* CMultiPageVirtualKeyboard::NewL( |
|
31 const TRect& aRect, CFepUiLayout* aUiLayout,TInt aControlId, |
|
32 const TFontSpec& aFontSpec, TBool aIrregular ) |
|
33 { |
|
34 CMultiPageVirtualKeyboard* vkb = new(ELeave) CMultiPageVirtualKeyboard( |
|
35 aRect, aUiLayout, aControlId, aFontSpec, aIrregular ); |
|
36 |
|
37 CleanupStack::PushL( vkb ); |
|
38 vkb->ConstructL(); |
|
39 vkb->SetRect( aRect ); |
|
40 CleanupStack::Pop( vkb ); |
|
41 return vkb; |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // c++ destructor |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CMultiPageVirtualKeyboard::~CMultiPageVirtualKeyboard() |
|
49 { |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // get current page index. |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 TInt CMultiPageVirtualKeyboard::CurPageIndex() |
|
57 { |
|
58 return iCurPageIndex; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // get current page count. |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 TInt CMultiPageVirtualKeyboard::PageCount() |
|
66 { |
|
67 return iPageCount; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // get current page size. |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 TInt CMultiPageVirtualKeyboard::PageSize() |
|
75 { |
|
76 return iPageSize; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // move to specified page. |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CMultiPageVirtualKeyboard::NavToPage( TInt aPageIndex ) |
|
84 { |
|
85 if ( aPageIndex >= iPageCount || aPageIndex <0 ) |
|
86 { |
|
87 _LIT(KErrorPageIndex,"invalid index"); |
|
88 User::Panic( KErrorPageIndex, 0 ); |
|
89 return; |
|
90 } |
|
91 |
|
92 iCurPageIndex = aPageIndex; |
|
93 |
|
94 const RPointerArray<CVirtualKey>& keys = KeyArray(); |
|
95 TInt count = keys.Count(); |
|
96 for ( TInt i = 0; i < count; i++ ) |
|
97 { |
|
98 TInt page = i / iPageSize; |
|
99 CVirtualKey* vk = keys[i]; |
|
100 |
|
101 vk->HideKeyCtrl( page != aPageIndex ); |
|
102 } |
|
103 |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // update paging. |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void CMultiPageVirtualKeyboard::UpdatePaging( TInt aRows, TInt aCols ) |
|
111 { |
|
112 TInt count = KeyArray().Count(); |
|
113 |
|
114 iPageSize = aRows * aCols; |
|
115 iPageCount = ( count + iPageSize - 1) / iPageSize; |
|
116 iCurPageIndex = 0; |
|
117 NavToPage( iCurPageIndex ); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // c++ constructor |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 CMultiPageVirtualKeyboard::CMultiPageVirtualKeyboard(const TRect& aRect, |
|
125 CFepUiLayout* aUiLayout, TInt aControlId, const TFontSpec& aFontSpec, |
|
126 TBool aIrregular ) |
|
127 : CVirtualKeyboard( aRect, aUiLayout, aControlId, aFontSpec, aIrregular ) |
|
128 { |
|
129 // No implementation required |
|
130 } |
|
131 |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // Symbian second-phase constructor |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CMultiPageVirtualKeyboard::ConstructL() |
|
138 { |
|
139 CVirtualKeyboard::ConstructL(); |
|
140 } |
|
141 |
|
142 // End Of File |