1.1 --- a/epoc32/include/mw/aknquerydata.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/aknquerydata.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,163 @@
1.4 -aknquerydata.h
1.5 +/*
1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Implementation of Query data classes for query dialogs
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +#ifndef AKNQUERYDATA_H
1.25 +#define AKNQUERYDATA_H
1.26 +
1.27 +#include <e32std.h>
1.28 +#include <aknquerycontrol.h>
1.29 +#include <in_sock.h>
1.30 +#include <lbsposition.h>
1.31 +
1.32 +class CAknQueryDialog;
1.33 +class TInetAddr;
1.34 +
1.35 +
1.36 +IMPORT_C TInt GetMaxTextLength(const CAknQueryControl* aControl, const TDes& aDataText, TInt aApiValue);
1.37 +
1.38 +class MAknQueryData
1.39 + {
1.40 + public:
1.41 + virtual void SetL(CAknQueryControl* aControl, TInt aMaxLength) = 0;
1.42 + virtual void Get(CAknQueryControl* aControl) = 0;
1.43 + };
1.44 +
1.45 +template<class T>
1.46 +class TAknQueryData : public MAknQueryData
1.47 + {
1.48 + public:
1.49 + TAknQueryData(T& aData) : iData(aData) {}
1.50 +
1.51 + void SetL(CAknQueryControl* aControl, TInt aMaxLength);
1.52 + void Get(CAknQueryControl* aControl);
1.53 +
1.54 + public:
1.55 + T& iData;
1.56 + };
1.57 +
1.58 +template<>
1.59 +class TAknQueryData<TDes> : public MAknQueryData
1.60 + {
1.61 + public:
1.62 + TAknQueryData(TDes& aData) : iData(aData) {}
1.63 +
1.64 + void SetL(CAknQueryControl* aControl,TInt aMaxLength)
1.65 + { aControl->SetTextL(iData);
1.66 + aControl->SetTextEntryLength(
1.67 + GetMaxTextLength(aControl,iData,aMaxLength)); }
1.68 + void Get(CAknQueryControl* aControl)
1.69 + { aControl->GetText(iData); }
1.70 + public:
1.71 + TDes& iData;
1.72 + };
1.73 +
1.74 +template<>
1.75 +class TAknQueryData<TInt> : public MAknQueryData
1.76 + {
1.77 + public:
1.78 + TAknQueryData(TInt& aData) : iData(aData) {}
1.79 +
1.80 + void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
1.81 + { aControl->SetNumberL(iData); }
1.82 + void Get(CAknQueryControl* aControl)
1.83 + { iData=aControl->GetNumber(); }
1.84 + public:
1.85 + TInt& iData;
1.86 + };
1.87 +
1.88 +template<>
1.89 +class TAknQueryData<TTime> : public MAknQueryData
1.90 + {
1.91 + public:
1.92 + TAknQueryData(TTime& aData) : iData(aData) {}
1.93 +
1.94 + void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
1.95 + { aControl->SetTime(iData); }
1.96 + void Get(CAknQueryControl* aControl)
1.97 + { iData=aControl->GetTime(); }
1.98 + public:
1.99 + TTime& iData;
1.100 + };
1.101 +
1.102 +template<>
1.103 +class TAknQueryData<TTimeIntervalSeconds> : public MAknQueryData
1.104 + {
1.105 + public:
1.106 + TAknQueryData(TTimeIntervalSeconds& aData) : iData(aData) {}
1.107 +
1.108 + void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
1.109 + { aControl->SetDuration(iData); }
1.110 + void Get(CAknQueryControl* aControl)
1.111 + { iData=aControl->GetDuration(); }
1.112 + public:
1.113 + TTimeIntervalSeconds& iData;
1.114 + };
1.115 +
1.116 +template<>
1.117 +class TAknQueryData<TReal> : public MAknQueryData
1.118 + {
1.119 + public:
1.120 + TAknQueryData(TReal& aData) : iData(aData) {}
1.121 +
1.122 + void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
1.123 + { aControl->SetFloatingPointNumberL(&iData); }
1.124 + void Get(CAknQueryControl* aControl)
1.125 + { iData=aControl->GetFloatingPointNumberL(); }
1.126 + public:
1.127 + TReal& iData;
1.128 + };
1.129 +
1.130 +
1.131 +template<>
1.132 +class TAknQueryData<TInetAddr> : public MAknQueryData
1.133 + {
1.134 + public:
1.135 + TAknQueryData(TInetAddr& aData) : iData(aData) {}
1.136 + void SetL(CAknQueryControl* aControl,TInt /*aMaxLength*/)
1.137 + {
1.138 + CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,aControl);
1.139 + control->SetInetAddress(iData);
1.140 + }
1.141 + void Get(CAknQueryControl* aControl)
1.142 + {
1.143 + CAknExtQueryControl* control = STATIC_CAST(CAknExtQueryControl*,aControl);
1.144 + iData=control->GetInetAddress();
1.145 + }
1.146 +
1.147 + public:
1.148 + TInetAddr& iData;
1.149 + };
1.150 +template<>
1.151 +class TAknQueryData<TPosition> : public MAknQueryData
1.152 + {
1.153 +public:
1.154 + TAknQueryData(TPosition &aData) : iData(aData) {}
1.155 + void SetL(CAknQueryControl* aControl, TInt /*aMaxLength*/)
1.156 + {
1.157 + aControl->SetLocation(iData);
1.158 + }
1.159 + void Get(CAknQueryControl* aControl)
1.160 + {
1.161 + aControl->GetLocation(iData);
1.162 + }
1.163 +private:
1.164 + TPosition& iData;
1.165 + };
1.166 +
1.167 +#endif