S60 3rd Edition API Reference: aknquerydata.h Source File

aknquerydata.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name     : AknQueryData.h
00004 *  Part of  : Avkon
00005 *
00006 *  Description:
00007 *   Implementation of Query data classes for query dialogs
00008 *  Version:
00009 *
00010 *  Copyright © 2002 Nokia Corporation.
00011 *  This material, including documentation and any related 
00012 *  computer programs, is protected by copyright controlled by 
00013 *  Nokia Corporation. All rights are reserved. Copying, 
00014 *  including reproducing, storing,  adapting or translating, any 
00015 *  or all of this material requires the prior written consent of 
00016 *  Nokia Corporation. This material also contains confidential 
00017 *  information which may not be disclosed to others without the 
00018 *  prior written consent of Nokia Corporation.
00019 * ============================================================================
00020 */
00021 
00022 #ifndef AKNQUERYDATA_H
00023 #define AKNQUERYDATA_H
00024 
00025 #include <e32std.h>
00026 #include <aknquerycontrol.h>
00027 #include <in_sock.h>
00028 #start_since SINCE_3_1_SDK
00029 #include <lbsposition.h>
00030 #end_since SINCE_3_1_SDK
00031 
00032 class CAknQueryDialog;
00033 class TInetAddr;
00034 
00035 
00036 IMPORT_C TInt GetMaxTextLength(const CAknQueryControl* aControl, const TDes& aDataText, TInt aApiValue);
00037 
00038 class MAknQueryData
00039     {
00040     public:
00041         virtual void SetL(CAknQueryControl* aControl, TInt aMaxLength) = 0;
00042         virtual void Get(CAknQueryControl* aControl) = 0;
00043     };
00044 
00045 template<class T>
00046 class TAknQueryData : public MAknQueryData
00047     {
00048     public:
00049         TAknQueryData(T& aData) : iData(aData) {}
00050 
00051         void SetL(CAknQueryControl* aControl, TInt aMaxLength);
00052         void Get(CAknQueryControl* aControl);
00053 
00054     public:
00055         T& iData;
00056     };
00057 
00058 template<>
00059 class TAknQueryData<TDes> : public MAknQueryData
00060     {
00061     public:
00062         TAknQueryData(TDes& aData) : iData(aData) {}
00063 
00064         void SetL(CAknQueryControl* aControl,TInt aMaxLength)
00065             { aControl->SetTextL(iData); 
00066               aControl->SetTextEntryLength(
00067                   GetMaxTextLength(aControl,iData,aMaxLength)); }
00068         void Get(CAknQueryControl* aControl) 
00069             { aControl->GetText(iData); }
00070     public:
00071         TDes& iData;
00072     };
00073 
00074 template<>
00075 class TAknQueryData<TInt> : public MAknQueryData
00076     {
00077     public:
00078         TAknQueryData(TInt& aData) : iData(aData) {}
00079 
00080         void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
00081             { aControl->SetNumberL(iData); }
00082         void Get(CAknQueryControl* aControl) 
00083             { iData=aControl->GetNumber(); }
00084     public:
00085         TInt& iData;
00086     };
00087 
00088 template<>
00089 class TAknQueryData<TTime> : public MAknQueryData
00090     {
00091     public:
00092         TAknQueryData(TTime& aData) : iData(aData) {}
00093 
00094         void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
00095             { aControl->SetTime(iData); }
00096         void Get(CAknQueryControl* aControl) 
00097             { iData=aControl->GetTime(); }
00098     public:
00099         TTime& iData;
00100     };
00101 
00102 template<>
00103 class TAknQueryData<TTimeIntervalSeconds> : public MAknQueryData
00104     {
00105     public:
00106         TAknQueryData(TTimeIntervalSeconds& aData) : iData(aData) {}
00107 
00108         void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
00109             { aControl->SetDuration(iData); }
00110         void Get(CAknQueryControl* aControl) 
00111             { iData=aControl->GetDuration(); }
00112     public:
00113         TTimeIntervalSeconds& iData;
00114     };
00115 
00116 template<>
00117 class TAknQueryData<TReal> : public MAknQueryData
00118     {
00119     public:
00120         TAknQueryData(TReal& aData) : iData(aData) {}
00121 
00122         void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
00123             { aControl->SetFloatingPointNumberL(&iData); }
00124         void Get(CAknQueryControl* aControl) 
00125             { iData=aControl->GetFloatingPointNumberL(); }
00126     public:
00127         TReal& iData;
00128     };
00129 
00130 
00131 template<>  
00132 class TAknQueryData<TInetAddr> : public MAknQueryData
00133     {
00134     public:
00135         TAknQueryData(TInetAddr& aData) : iData(aData) {}
00136         void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
00137             {
00138                 CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,aControl);
00139                 control->SetInetAddress(iData);
00140             }
00141         void Get(CAknQueryControl* aControl) 
00142             {
00143                 CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,aControl);
00144                 iData=control->GetInetAddress();
00145             }
00146 
00147     public:
00148         TInetAddr& iData;
00149     };
00150 #start_since SINCE_3_1_SDK
00151 
00154 template<>    
00155 class TAknQueryData<TPosition> : public MAknQueryData
00156         {
00157 public:
00158         TAknQueryData(TPosition &aData) : iData(aData) {}
00159         void SetL(CAknQueryControl* aControl, TInt /*aMaxLength*/)
00160                 {
00161                 aControl->SetLocation(iData);
00162                 }
00163         void Get(CAknQueryControl* aControl)
00164                 {
00165                 aControl->GetLocation(iData);
00166                 }
00167 private:
00168         TPosition& iData;
00169         };
00170 #end_since SINCE_3_1_SDK
00171 #endif

Copyright © Nokia Corporation 2001-2007
Back to top