|
1 /* |
|
2 * Copyright (c) 2002 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: Slider Setting Page |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __AKNSLIDERSETTINGPAGE__ |
|
20 #define __AKNSLIDERSETTINGPAGE__ |
|
21 |
|
22 // For coecontrol |
|
23 #include <coecntrl.h> |
|
24 |
|
25 #include <eikdef.h> |
|
26 #include <eikbtgpc.h> |
|
27 #include <aknslider.h> |
|
28 #include <aknsettingpage.h> |
|
29 |
|
30 class CAknSliderSettingPage : public CAknSettingPage |
|
31 { |
|
32 public: |
|
33 /** |
|
34 * Simple constructor depending only on a single resource Id. Editor resource is given via |
|
35 * the link in the setting page resource. |
|
36 * |
|
37 * @param aSettingPageResourceId Setting Page to use (if present) |
|
38 * @param aSliderValue ref. to external slider value |
|
39 */ |
|
40 IMPORT_C CAknSliderSettingPage(TInt aResourceID, TInt& aSliderValue); |
|
41 |
|
42 /** |
|
43 * Constructor that allows separate setting page and editor resources |
|
44 * |
|
45 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible |
|
46 * |
|
47 * In all cases the number (if supplied i.e. <> 0 ) is used. |
|
48 * |
|
49 * Editor Resource Setting Page Resource |
|
50 * present present Both are used (but text & number overridden) |
|
51 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor) |
|
52 * present = 0 Default Avkon SP resource if used + this editor resource |
|
53 * = 0 = 0 uses default resource for both SP and editor. This is OK if: |
|
54 * i) control type is present, |
|
55 * ii) a default resource exists ( OK for text, integer, date, time, duration ) |
|
56 * |
|
57 * Note: THe first argument is a TDesC* (rather than TDesC&) because the other constructor |
|
58 * cannot initialize such a member without allocation or having an internal dummy buffer. |
|
59 * |
|
60 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other |
|
61 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource |
|
62 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the |
|
63 * specific API for setting them, WILL override resource. |
|
64 * It is assumed that number from resource is very rare. Special text is somewhat more likely. |
|
65 * |
|
66 * |
|
67 * @param aSettingTitleText Text at top of setting pane (not copied to object until ExecuteLD is called) |
|
68 * @param aSettingNumber Number at top left (if present) |
|
69 * @param aControlType Determines the type constructed and how its resource is read |
|
70 * @param aEditorResourceId Editor resource to use in the setting page (if present) |
|
71 * @param aSettingPageResourceId Setting Page to use (if present) |
|
72 * @param aSliderValue Reference to integer holding the slider value |
|
73 */ |
|
74 |
|
75 IMPORT_C CAknSliderSettingPage( const TDesC* aSettingTitleText, |
|
76 TInt aSettingNumber, |
|
77 TInt aControlType, |
|
78 TInt aEditorResourceId, |
|
79 TInt aSettingPageResourceId, |
|
80 TInt& aSliderValue ); |
|
81 /** |
|
82 * Access method for the contained slider control. No transfer of ownership |
|
83 * |
|
84 * @return Reference ptr to the contained CAknSlider object |
|
85 */ |
|
86 IMPORT_C CAknSlider* SliderControl(); |
|
87 |
|
88 // |
|
89 // From CAknSettingPage |
|
90 // |
|
91 |
|
92 /** |
|
93 * 2nd stage contructor |
|
94 * |
|
95 */ |
|
96 IMPORT_C virtual void ConstructL(); |
|
97 |
|
98 /** |
|
99 * From CCoeControl |
|
100 */ |
|
101 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
102 |
|
103 // |
|
104 // From CCoeControl |
|
105 // |
|
106 protected: |
|
107 IMPORT_C virtual void SizeChanged(); |
|
108 IMPORT_C virtual void Draw(const TRect &aRect) const; |
|
109 |
|
110 /** |
|
111 * Writes the internal state of the control and its components to aStream. |
|
112 * Does nothing in release mode. |
|
113 * Designed to be overidden and base called by subclasses. |
|
114 * |
|
115 * @param aWriteSteam A connected write stream |
|
116 */ |
|
117 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const; |
|
118 |
|
119 private: |
|
120 /** |
|
121 * Reserved method derived from CCoeControl |
|
122 */ |
|
123 IMPORT_C virtual void Reserved_2(); |
|
124 |
|
125 private: |
|
126 /** |
|
127 * From CAknControl |
|
128 */ |
|
129 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
130 |
|
131 // |
|
132 // Framework methods derived from CAknSettingPage |
|
133 // |
|
134 protected: |
|
135 /** |
|
136 * C++ destructor |
|
137 * |
|
138 */ |
|
139 IMPORT_C virtual ~CAknSliderSettingPage(); |
|
140 |
|
141 /** |
|
142 * Called when something has changed and the client's object needs to have its value updated |
|
143 * |
|
144 */ |
|
145 IMPORT_C virtual void UpdateSettingL(); |
|
146 |
|
147 /** |
|
148 * Called when the user accepts a setting and the setting page is about to be dismissed. The latest value of the |
|
149 * setting is written to the client's object |
|
150 */ |
|
151 IMPORT_C virtual void AcceptSettingL(); |
|
152 |
|
153 /** |
|
154 * Called when the user rejects the setting. A backup copy may need to be restored if UpdateWhenChanged flag was set |
|
155 * |
|
156 */ |
|
157 IMPORT_C virtual void RestoreOriginalSettingL(); |
|
158 |
|
159 /** |
|
160 * New reserved methods for CAknSettingPage hierarchy |
|
161 */ |
|
162 private: |
|
163 IMPORT_C virtual void CAknSettingPage_Reserved_1(); |
|
164 IMPORT_C virtual void CAknSettingPage_Reserved_2(); |
|
165 |
|
166 private: |
|
167 TInt& iSliderValue; |
|
168 TInt iBackupSliderValue; |
|
169 }; |
|
170 |
|
171 #endif |
|
172 |
|
173 |