classicui_pub/slider_api/tsrc/src/testsdkslidercontainer.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  slider_api
       
    15  *
       
    16 */
       
    17 
       
    18 #include "testsdkslidercontainer.h"
       
    19 #include "testsdksliderview.h"
       
    20 // ---------------------------------------------------------------------------
       
    21 // C++ default Constructor
       
    22 // ---------------------------------------------------------------------------
       
    23 //
       
    24 CSliderContainer::CSliderContainer()
       
    25     {
       
    26 
       
    27     }
       
    28 // ---------------------------------------------------------------------------
       
    29 // Destructor
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSliderContainer::~CSliderContainer()
       
    33     {
       
    34 
       
    35     ResetControl();
       
    36 
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Symbian 2nd Constructor
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void CSliderContainer::ConstructL(const TRect& aRect)
       
    44     {
       
    45     CreateWindowL();
       
    46     SetRect(aRect);
       
    47     ActivateL();
       
    48 
       
    49     }
       
    50 
       
    51 // ----------------------------------------------------------------------------
       
    52 // CSliderContainer::Draw
       
    53 // Fills the window's rectangle.
       
    54 // ----------------------------------------------------------------------------
       
    55 //
       
    56 void CSliderContainer::Draw(const TRect& aRect) const
       
    57     {
       
    58     CWindowGc& gc = SystemGc();
       
    59     gc.SetPenStyle(CGraphicsContext::ENullPen);
       
    60     gc.SetBrushColor( KRgbGray);
       
    61     gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
    62     gc.DrawRect(aRect);
       
    63     }
       
    64 // ---------------------------------------------------------------------------
       
    65 // CSliderContainer::CountComponentControls
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 TInt CSliderContainer::CountComponentControls() const
       
    69     {
       
    70     if (iControl)
       
    71         {
       
    72         return 1;
       
    73         }
       
    74     else
       
    75         {
       
    76         return 0;
       
    77         }
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // CSliderContainer::ComponentControl
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 CCoeControl* CSliderContainer::ComponentControl(TInt) const
       
    85     {
       
    86     return iControl;
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // CSliderContainer::SetControlL
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 void CSliderContainer::SetControlL(CCoeControl* aControl)
       
    94     {
       
    95     iControl = aControl;
       
    96     if (iControl)
       
    97         {
       
    98         // You can change the position and size
       
    99         iControl->SetExtent(Rect().iTl, Rect().Size() );
       
   100         iControl->ActivateL();
       
   101         DrawNow();
       
   102         }
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // CSliderContainer::ResetControl
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 void CSliderContainer::ResetControl()
       
   110     {
       
   111     delete iControl;
       
   112     iControl = NULL;
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // CSliderContainer::GetCoeEnv
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 CCoeEnv* CSliderContainer::GetCoeEnv()
       
   120     {
       
   121     return iCoeEnv;
       
   122     }