src/ext/amaretto/appui/inc/Container.h
changeset 0 ca70ae20a155
equal deleted inserted replaced
-1:000000000000 0:ca70ae20a155
       
     1 /*
       
     2  * Copyright (c) 2005-2009 Nokia Corporation
       
     3  *
       
     4  * Licensed under the Apache License, Version 2.0 (the "License");
       
     5  * you may not use this file except in compliance with the License.
       
     6  * You may obtain a copy of the License at
       
     7  *
       
     8  *     http://www.apache.org/licenses/LICENSE-2.0
       
     9  *
       
    10  * Unless required by applicable law or agreed to in writing, software
       
    11  * distributed under the License is distributed on an "AS IS" BASIS,
       
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    13  * See the License for the specific language governing permissions and
       
    14  * limitations under the License.
       
    15  * ====================================================================
       
    16  */
       
    17 
       
    18 #ifndef __CONTAINER_H
       
    19 #define __CONTAINER_H
       
    20 
       
    21 #include <coecntrl.h>
       
    22 #include <eikdef.h>
       
    23 #include <eiklbx.h>
       
    24 #include <eiklbo.h>
       
    25 #include <aknnavi.h>
       
    26 #include <aknnavide.h>
       
    27 #include <akntabgrp.h>
       
    28 #include "Python_appui.h"
       
    29 #include "symbian_python_ext_util.h"
       
    30 
       
    31 extern TBool touch_enabled_flag;
       
    32 extern TBool directional_pad_flag;
       
    33 
       
    34 #define DARKGREY TRgb(140, 140, 140)
       
    35 #define LIGHTGREY TRgb(196, 196, 196)
       
    36 
       
    37 #define TICKDELAY 500000    // 500 milliseconds
       
    38 #define TICKINTERVAL 175000 // 175 milliseconds
       
    39 
       
    40 // enum values for the UI widget controls
       
    41 #define LISTBOX 0
       
    42 #define TEXT 1
       
    43 #define CANVAS 2
       
    44 #define GLCANVAS 3
       
    45 
       
    46 NONSHARABLE_CLASS(CRepeatEventGenerator) : public CBase
       
    47 {
       
    48 public:
       
    49     static CRepeatEventGenerator* NewL(const CCoeControl* aParent, TKeyEvent aKeyEvent);
       
    50     ~CRepeatEventGenerator();
       
    51 protected:
       
    52     CRepeatEventGenerator(const CCoeControl* aParent, TKeyEvent aKeyEvent);
       
    53 private:
       
    54     void ConstructL();
       
    55     static TInt Tick(TAny* aObject);
       
    56     void DoTick();
       
    57 private:
       
    58     CPeriodic* iPeriodic;
       
    59     const CCoeControl* iParent;
       
    60     TKeyEvent iKeyEvent;
       
    61 };
       
    62 
       
    63 NONSHARABLE_CLASS(CDirectionalPad) : public CCoeControl
       
    64 {
       
    65 public:
       
    66   CDirectionalPad();
       
    67   void DrawKeys(CWindowGc *gc, TRect keyRect, CArrayFix<TPoint>* polygonPoints);
       
    68   virtual ~CDirectionalPad();
       
    69   virtual void ConstructL(const CCoeControl* aParent, CAmarettoAppUi* aAppui);
       
    70   void CalculateAndDrawGraphic(CWindowGc *gc);
       
    71 
       
    72 private:
       
    73   const CCoeControl* iParent;
       
    74   CAmarettoAppUi* iAppui;
       
    75   TRect iPrevDpadRect;
       
    76   TRect iLeftButton, iRightButton, iCenterButton, iUpButton, iDownButton, iTopLeftButton, iTopRightButton;
       
    77   CArrayFix<TPoint>* iLeftTriangle, *iRightTriangle, *iUpTriangle, *iDownTriangle, *iCenterRect;
       
    78   virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    79   CRepeatEventGenerator* iRepeatEventHandle;
       
    80 
       
    81 };
       
    82 
       
    83 NONSHARABLE_CLASS(CAmarettoContainer) : public CCoeControl, MCoeControlObserver
       
    84 {
       
    85 public:
       
    86   static CAmarettoContainer *NewL(const TRect& aRect, CAmarettoAppUi* aAppui);
       
    87   virtual ~CAmarettoContainer();
       
    88 
       
    89   TInt SetComponentL(CCoeControl* aComponent,
       
    90              CAmarettoCallback* aEventHandler=NULL, TInt aControlName=-1);
       
    91   void Refresh() {SizeChanged(); DrawNow();}
       
    92   void EnableTabsL(const CDesCArray* aTabTexts, CAmarettoCallback* aFunc);
       
    93   void SetActiveTab(TInt aIndex);
       
    94   void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    95   void DisablePointerForwarding(TBool aValue);
       
    96   TInt CreateDirectionalPad(CAmarettoAppUi* aAppui);
       
    97   void RefreshDirectionalPad();
       
    98   void RemoveDirectionalPad();
       
    99   CDirectionalPad *iDirectionalPad;
       
   100   CWindowGc *iDirectionalPadGc;
       
   101   CAmarettoAppUi* iAppui;
       
   102 protected:
       
   103   void ConstructL(const TRect&, CAmarettoAppUi *aAppui);
       
   104 
       
   105 private:
       
   106   void SizeChanged();
       
   107   TInt CountComponentControls() const {return (iTop ? 1 : 0);}
       
   108   CCoeControl* ComponentControl(TInt aIx) const {return ((aIx == 0) ? iTop : NULL);}
       
   109   void Draw(const TRect& aRect) const;
       
   110   TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   111   void HandleControlEventL(CCoeControl*, TCoeEvent) {;}
       
   112   void SetScrollbarVisibility(TBool aValue);
       
   113 
       
   114 private:
       
   115   CAknNavigationControlContainer* GetNaviPane() const;
       
   116   CAknNavigationDecorator* iDecoratedTabGroup;
       
   117   CAknTabGroup* iTabGroup;
       
   118   CCoeControl* iTop;
       
   119   CAmarettoCallback* iTabCallback;
       
   120   CAmarettoCallback* iEventCallback;
       
   121   TBool iPointerForwardDisabled;
       
   122   TInt iTopControl;
       
   123 };
       
   124 
       
   125 #endif /* __CONTAINER_H */