lafagnosticuifoundation/cone/tef/TMenu0Step.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent - Internal Symbian test code 
       
    19 */
       
    20 
       
    21 #if !defined(__TMENU0STEP_H__)
       
    22 #define __TMENU0STEP_H__
       
    23 
       
    24 #include <e32keys.h>
       
    25 #include <basched.h>
       
    26 
       
    27 #include <coeaui.h>
       
    28 #include <coemain.h>
       
    29 #include <coecntrl.h>
       
    30 #include <test/testexecutestepbase.h>
       
    31 #include "TMenuTestServer.h"
       
    32 #include "appfwk_test_AppUi.h"
       
    33 #include "TMENUASI.H"
       
    34 
       
    35 
       
    36 
       
    37 class MTestMenuObserver
       
    38 	{
       
    39 public:
       
    40 	virtual void MenuSelectionMadeL(TInt aSelection)=0;
       
    41 	};
       
    42 
       
    43 
       
    44 
       
    45 class CTestMenu : public CCoeControl
       
    46 	{
       
    47 public:
       
    48     inline CTestMenu(MTestMenuObserver* aObserver) { iObserver=aObserver; }
       
    49 private: // framework
       
    50     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
    51 private:
       
    52     MTestMenuObserver* iObserver;
       
    53     };
       
    54 
       
    55 
       
    56 
       
    57 class CMessageControl : public CCoeControl
       
    58     {
       
    59 public:
       
    60     ~CMessageControl();
       
    61     void ConstructL();
       
    62     void ToggleFontStyleL(TMessageControlFontStyle aStyleElement);
       
    63     void SetMessage(const TDesC& aMessage);
       
    64 private: // framework
       
    65     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
    66     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    67     void Draw(const TRect& aRect) const;
       
    68 	void FocusChanged(TDrawNow aDrawNow);
       
    69 private: // new functions
       
    70     void DrawBorder() const;
       
    71     void SetFontL(const TFontSpec& aFontSpec);
       
    72     void DrawMessage() const;
       
    73     void DrawMessageNow() const;
       
    74 private:
       
    75     TBuf<40> iMessage;
       
    76     TFontSpec iFontSpec;
       
    77     TFontUnderline iFontUnderline;
       
    78     TFontStrikethrough iFontStrikethrough;
       
    79     CFbsFont* iFont;
       
    80     };
       
    81 
       
    82 
       
    83 
       
    84 class CTestMenu0AppUi : public CTestCoeAppUi, public MTestMenuObserver
       
    85     {
       
    86 public:
       
    87 	CTestMenu0AppUi(CTmsTestStep* aStep);
       
    88     ~CTestMenu0AppUi();
       
    89     void ConstructL();
       
    90 private: // from MTestMenuObserver
       
    91     void MenuSelectionMadeL(TInt aSelection);
       
    92 private: // from CCoeAppUi
       
    93 	void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent);
       
    94 private: // new functions
       
    95     void ToggleBoldL();
       
    96     void ToggleUnderlineL();
       
    97     void ToggleItalicL();
       
    98     void ToggleStrikethroughL();
       
    99 	void SendAsiMessageL(TMenuAsiEventSend aEvent);
       
   100 	void SendMessageL(const TDesC8& aTextMsg);
       
   101 	void RunTestStepL(TInt aNextStep);
       
   102 private:
       
   103     CMessageControl* iMessageControl;
       
   104     CTestMenu* iMenu;
       
   105     };
       
   106     
       
   107     
       
   108 
       
   109 class CTMenu0Step : public CTmsTestStep
       
   110 	{
       
   111 public:
       
   112 	CTMenu0Step();
       
   113 	~CTMenu0Step();
       
   114 	virtual TVerdict doTestStepL();
       
   115 	void ConstructAppL(CCoeEnv* aCoe);
       
   116 private:
       
   117 	};
       
   118 
       
   119 _LIT(KTMenu0Step,"TMenu0");
       
   120 
       
   121 #endif
       
   122 
       
   123