00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <eikedwin.h>
00018 #include <eikenv.h>
00019 #include <aknutils.h>
00020 #include <AudioPlaying.rsg>
00021
00022 #include "AudioPlayingMainView.h"
00023
00024 CAudioPlayingMainView* CAudioPlayingMainView::NewL(const TRect& aRect)
00025 {
00026 CAudioPlayingMainView* self = CAudioPlayingMainView::NewLC(aRect);
00027 CleanupStack::Pop(self);
00028 return self;
00029 }
00030
00031 CAudioPlayingMainView* CAudioPlayingMainView::NewLC(const TRect& aRect)
00032 {
00033 CAudioPlayingMainView* self = new (ELeave) CAudioPlayingMainView;
00034 CleanupStack::PushL(self);
00035 self->ConstructL(aRect);
00036 return self;
00037 }
00038
00039 CAudioPlayingMainView::~CAudioPlayingMainView()
00040 {
00041 delete iEikEdwin;
00042 }
00043
00044 void CAudioPlayingMainView::ConstructL(const TRect& aRect)
00045 {
00046 CreateWindowL();
00047
00048
00049 iEikEdwin = new (ELeave) CEikEdwin();
00050 iEikEdwin->ConstructL(CEikEdwin::EReadOnly | CEikEdwin::ENoAutoSelection);
00051 iEikEdwin->SetContainerWindowL(*this);
00052 HBufC* message = ControlEnv()->AllocReadResourceLC(
00053 R_AUDIOPLAYING_TEXT);
00054 iEikEdwin->SetTextL(message);
00055 CleanupStack::PopAndDestroy(message);
00056
00057 SetRect(aRect);
00058 ActivateL();
00059 }
00060
00061 void CAudioPlayingMainView::SetTextL(const TDesC& aText)
00062 {
00063 if (iEikEdwin)
00064 {
00065 iEikEdwin->SetTextL(&aText);
00066 DrawNow();
00067 }
00068 }
00069
00070 TInt CAudioPlayingMainView::CountComponentControls() const
00071 {
00072 if (iEikEdwin)
00073 {
00074 return 1;
00075 }
00076 return 0;
00077 }
00078
00079 CCoeControl* CAudioPlayingMainView::ComponentControl(TInt aIndex) const
00080 {
00081 switch (aIndex)
00082 {
00083 case 0:
00084 return iEikEdwin;
00085 default:
00086 break;
00087 }
00088 return 0;
00089 }
00090
00091 void CAudioPlayingMainView::Draw(const TRect& ) const
00092 {
00093 CWindowGc& gc = SystemGc();
00094 gc.Clear();
00095 }
00096
00097 void CAudioPlayingMainView::SizeChanged()
00098 {
00099 if (iEikEdwin)
00100 {
00101 TRect rect(Rect());
00102 iEikEdwin->SetExtent(
00103 TPoint(0, 0),
00104 TSize(rect.Width(), rect.Height()));
00105 }
00106 }
00107
00108