examples/SFExamples/OandXViewArch/S60/inc/oandxhistview.h

00001 /*
00002 Copyright (c) 2002-2011 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */ 
00029 
00030 #ifndef OANDXHISTVIEW_H
00031 #define OANDXHISTVIEW_H
00032 
00033 #include <coecntrl.h>
00034 #include <coedef.h>
00035 #include <aknview.h>
00036 #include "oandxdefs.h"
00037 
00038 const TBool EOandXSetHistory = ETrue;
00039 const TBool EOandXSetStats   = EFalse;
00040 
00041 class COandXHistViewContainer;
00042 
00048 class COandXHistoryView : public CAknView
00049         {
00050 public:
00051         static COandXHistoryView* NewLC();
00052         ~COandXHistoryView();
00053         
00054     // Functions from base classes
00055     TUid Id() const;
00056     void HandleCommandL(TInt aCommand);
00057     void HandleViewRectChange();
00058     void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); 
00059     COandXHistViewContainer* Container();
00060     
00061         // new functions
00062         void ChangeDisplayL(TBool aDisplayHistory);     
00063 
00064         inline TBool IsDisplayingHistory() const;
00065         inline TBool IsActivated() const;
00066         
00067 private:
00068         COandXHistoryView();
00069         void ConstructL();
00070 
00071     void DoActivateL( const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
00072         const TDesC8& aCustomMessage );
00073     void DoDeactivate();
00074 
00075 private:
00076     COandXHistViewContainer* iContainer;
00077 
00078         TBool iHistViewStacked;
00079                         
00080         TBool iDisplayingHistory ; // current status
00081         TBool iActivated;
00082         
00083         };
00084 
00085 // state inlines
00086 inline TBool COandXHistoryView::IsDisplayingHistory() const { return iDisplayingHistory; }
00087 inline TBool COandXHistoryView::IsActivated() const { return iActivated; }
00088 
00089 
00090 
00091 // Container
00092 
00093 const TInt KNumDataLines = KNumHistoryRecords+1;
00094 
00095 class COandXHistViewContainer : public CCoeControl
00096         {
00097 public:
00098         static COandXHistViewContainer* NewL(const TRect& aRect);
00099         virtual ~COandXHistViewContainer();
00100         void SetContentL(TBool aDisplayHistory);
00101 
00102 private:
00103         COandXHistViewContainer();
00104         void ConstructL(const TRect& aRect);
00105         
00106         void Draw(const TRect& aRect) const;
00107         void SizeChanged();
00108         TInt CountComponentControls() const;
00109         CCoeControl* ComponentControl(TInt aIndex) const;
00110         // new functions
00111     void CreateNewItemsL(TBool aDisplayHistory);
00112 
00113 private:
00114         CEikLabel* iTitle;
00115         TFixedArray<CEikLabel*, KNumDataLines> iDataLines;
00116         
00117         TBuf<KStatsBufSize> iNumGamesText;
00118         TBuf<KStatsBufSize> iNumOWinsText;
00119         TBuf<KStatsBufSize> iNumXWinsText;
00120         TBuf<KStatsBufSize> iNumDrawsText;
00121         TBuf<KStatsBufSize> iStatOWonText;
00122         TBuf<KStatsBufSize> iStatXWonText;
00123         TBuf<KStatsBufSize> iStatDrawText;
00124         TBuf<KStatsBufSize> iHistoryTitle;
00125         TBuf<KStatsBufSize> iStatsTitle;
00126         };
00127 
00128 #endif // OANDXHISTVIEW_H

Generated by  doxygen 1.6.2