os/textandloc/fontservices/textshaperplugin/test/S60HindiDemo/inc/MainViewcontainer.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 * Series 60 version of Hindi Demo application
    16 *
    17 */
    18 
    19 
    20 
    21 #ifndef __MAINVIEW_CONTAINER_H__
    22 #define __MAINVIEW_CONTAINER_H__
    23 
    24 #include "HindiDemo.hrh"
    25 
    26 
    27 #include <eikappui.h>
    28 #include <coecntrl.h>
    29 #include <akncontext.h>
    30 #include <aknnavi.h>
    31 #include <aknnavide.h>
    32 #include <akntitle.h>
    33 #include <avkon.rsg>
    34 #include <barsread.h>
    35 #include <eikspane.h>
    36 
    37 const TInt KLengthOfNaviTempString = 100;
    38 
    39 // -----------------------------------------------------------------------
    40 // CMainViewContainer
    41 // -----------------------------------------------------------------------
    42 class CMainViewContainer : public CCoeControl, public MCoeControlObserver {
    43 
    44 public:
    45   // -----------------------------------------------------------------------
    46   // Creates a CMainViewContainer object
    47   // -----------------------------------------------------------------------
    48   static CMainViewContainer * NewL(const TRect& aRect);
    49 
    50   // -----------------------------------------------------------------------
    51   // Creates a CMainViewView object
    52   // -----------------------------------------------------------------------
    53   static CMainViewContainer * NewLC(const TRect& aRect);
    54 
    55   // -----------------------------------------------------------------------
    56   // Returns the number of controls contained in this compound control
    57   // -----------------------------------------------------------------------
    58   TInt CountComponentControls() const;
    59 
    60   // -----------------------------------------------------------------------
    61   // Returns the component at the specified index
    62   // @param aIndex specifies index of component
    63   // @return Pointer to component control
    64   // -----------------------------------------------------------------------
    65   CCoeControl * ComponentControl(TInt aIndex) const;
    66 
    67   // -----------------------------------------------------------------------
    68   // Draws this container
    69   // -----------------------------------------------------------------------
    70   	void Draw(const TRect& aRect) const;
    71   	void DrawHindiText(CWindowGc& aGc) const;
    72 	void DisableShaping(const TDesC* aInput, TDes& aOutput ) const;
    73 	void SetHindiFont( TFontSpec& aFontSpec );
    74 	void ChangeSample( TInt aSample);
    75 	TInt GetSample();
    76 	void SetFontSize( TInt aFontSize );
    77 	TInt GetFontSize();
    78 	void SetUnderLine( enum TFontUnderline aUnderLine );
    79 	enum TFontUnderline GetUnderLine( );
    80 	void ChangeFont();
    81 	void ChangePreviousFont();
    82 	void DisplayAvailableFonts();
    83 
    84   	// -----------------------------------------------------------------------
    85   	// Destroys container
    86   	// -----------------------------------------------------------------------
    87   	~CMainViewContainer();
    88 
    89 	//
    90 	// Handler for events sent by a control to this Observer
    91 	//
    92 	void HandleControlEventL(CCoeControl * aControl, TCoeEvent aEventType);
    93 
    94   // --------------------------------------------------------------------------------------
    95   // Overridden function used to pass key events to child controls owned by this container
    96   // --------------------------------------------------------------------------------------
    97   TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
    98 
    99   // -----------------------------------------------------------------------
   100   // Routine that dispatches Command events to individual handlers
   101   // -----------------------------------------------------------------------
   102   bool DispatchViewCommandEvents(TInt aCommand);
   103 
   104 private:
   105   // -----------------------------------------------------------------------
   106   // Constructor
   107   // -----------------------------------------------------------------------
   108   CMainViewContainer();
   109 
   110   // -----------------------------------------------------------------------
   111   // Performs second phase construction of this Container
   112   // -----------------------------------------------------------------------
   113   void ConstructL(const TRect & aRect);
   114 
   115   // -----------------------------------------------------------------------
   116   // Routine that initializes components owned by this Container
   117   // -----------------------------------------------------------------------
   118   void InitComponentsL();
   119 
   120   // -----------------------------------------------------------------------
   121   // Routine that cleans up components owned by this container
   122   // -----------------------------------------------------------------------
   123   void CleanupComponents();
   124 
   125   // -----------------------------------------------------------------------
   126   // Routine that attempts to dispatch Control Events
   127   // -----------------------------------------------------------------------
   128   void DispatchControlEvents(CCoeControl * aControl, TCoeEvent aEventType);
   129 
   130   // -----------------------------------------------------------------------
   131   // Place holder routine to handle key events
   132   // -----------------------------------------------------------------------
   133   bool HandleKeyEvents(const TKeyEvent& aKeyEvent, TEventCode aType);
   134 
   135   // -----------------------------------------------------------------------
   136   // Helper method to manage control in focus
   137   // -----------------------------------------------------------------------
   138   void ChangeFocus(CCoeControl * aNewControl);
   139 
   140 private:
   141   TRgb iBackgroundColor;
   142   RPointerArray<CCoeControl> iCtrlArray;
   143   CCoeControl* iFocusedControl;
   144 
   145 private:
   146   // -----------------------------------------------------------------------------
   147   	CAknContextPane * iContextPane;
   148   	CAknTitlePane * iTitlePane;
   149   	CAknNavigationControlContainer * iNaviPane;
   150   	CAknNavigationDecorator * iNaviDecorator;
   151 
   152     TInt 		iSample;
   153     TFontSpec 	iFontSpec;
   154     TInt 		iFontSize;
   155     TInt		iSelectedFont;
   156 	enum TFontUnderline iUnderLine;
   157 
   158 };
   159 
   160 #endif // __MAINVIEW_CONTAINER_H__