Пример #1
0
/**
  Second phase constructor for CCtlContainer class.\n
  Invokes the base class "CCtlBase" second phase constructor.\n
  Adds three  objects each of CCtlContainee class as component controls.\n
  The first two are added using a component Id while the same is not provided for the third control.\n
  The container control window is activated.\n
*/	
void CCtlContainer::ConstructL( const TDesC& aName )
	{
	CCtlBase::ConstructL() ;
	// construct the kids, add them to the array.	
	iName = aName.AllocL() ;
	CreateWindowL() ;
	InitComponentArrayL();
	
	CCtlContainee* child = NULL ;
	child = new (ELeave) CCtlContainee ;
	Components().AppendLC( child, KChildOneID ) ;
	child->ConstructL( _L("child1") ) ;
	CleanupStack::Pop( child ) ;

	child = new (ELeave) CCtlContainee ;
	Components().AppendLC( child, KChildTwoID ) ;
	child->ConstructL( _L("child2") ) ;
	CleanupStack::Pop( child ) ;
	
	CCtlContainee* temp = new (ELeave) CCtlContainee ;
	Components().AppendLC( temp ) ;
	temp ->ConstructL( _L("orphan") ) ;
	CleanupStack::Pop( temp ) ;	
	iOrphan = temp ;		
	
	ActivateL() ;
	}
Пример #2
0
void CSliderControl::ConstructFromResourceL(TResourceReader& reader)
	{
	iVal=0;
		CreateWindowL();	
		InitComponentArrayL();
		iLabel = new (ELeave) CEikLabel;
		iLabel->SetContainerWindowL(*this);
		TRgb lbc; 
		MAknsSkinInstance* skin=AknsUtils::SkinInstance();
		AknsUtils::GetCachedColor(skin,lbc,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6 );
		iLabel->OverrideColorL(EColorLabelText,lbc);
		iLabel->SetAlignment(EHCenterVCenter);
		iLabel->SetBrushStyle(CGraphicsContext::ENullBrush);
		iLabel->MakeVisible(ETrue);
		iLabel->SetTextL(reader.ReadTPtrC16());
		Components().AppendLC(iLabel);
		CleanupStack::Pop(iLabel);
		_LIT(KDesCEmpty,"");
		iSlider = new (ELeave) CSliderForDialog(KDesCEmpty,0,255);
		iSlider->ConstructL(this);
		iSlider->SetContainerWindowL(*this);
		iSlider->MakeVisible(ETrue);
		Components().AppendLC(iSlider);
		CleanupStack::Pop(iSlider);
		
		//SetExtentToWholeScreen();
		
		iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,TRect(TPoint(0,0),CEikonEnv::Static()->ScreenDevice()->SizeInPixels()),ETrue);	
		ActivateL();
		_LOGDATA2(_L("Window pos: %d,%d"),Window().Position().iX,Window().Position().iY);
		_LOGDATA2(_L("Window size: %d,%d"),Window().Size().iWidth,Window().Size().iHeight);
		
		
	}
Пример #3
0
void C{{PROJECT}}AppView::ConstructL(const TRect& aRect)
	{
	CreateWindowL();
	EnableDragEvents();
	Window().SetPointerGrab(ETrue);
	InitComponentArrayL();
	SetRect(aRect);
	}
void CPreviewPopUpContent::InitialiseL(const TRect& aRect,
                                      const TDesC& aMbmName,
                                      TInt aNbrOfRows, 
                                      TInt aImageId,
                                      TInt aMaskId)
{
   // Do not call CreateWindowL() as parent CAknPreviewPopUpController owns window
   
   InitComponentArrayL();
   
   iMbmName = aMbmName.AllocL();

   MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   TRgb fgcolor(0,0,0);
   AknsUtils::GetCachedColor(skin, fgcolor, KAknsIIDQsnTextColors, 
                             EAknsCIQsnTextColorsCG55);

   if (aImageId != -1 && aMaskId != -1) {
      AknIconUtils::CreateIconL(iBitmap, iMask, *iMbmName, aImageId, aMaskId);
      AknIconUtils::SetSize(iBitmap, TSize(10, 10), 
                            EAspectRatioPreservedAndUnusedSpaceRemoved);
   }

   iStringLengths = new (ELeave) CArrayFixFlat<TInt>(aNbrOfRows);
   iLabelContainer.Reset();
 
   // Create one label with standard font size.
   iStringLengths->AppendL(aRect.Width());
   CEikLabel* label = new (ELeave) CEikLabel();
   label->SetContainerWindowL(*this);
   Components().AppendLC(label);
   label->OverrideColorL(EColorLabelText, fgcolor);
   label->SetTextL(KDefaultText);
   CleanupStack::Pop(label);
   iLabelContainer.AppendL(TLabelData(label));
   // The rest of the labels with a smaller font.
   const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);
   for (TInt i = 0; i < aNbrOfRows-1; ++i) {
      iStringLengths->AppendL(aRect.Width());
      CEikLabel* label = new (ELeave) CEikLabel();
      label->SetContainerWindowL(*this);
      Components().AppendLC(label);
      label->SetFont(font);
      label->OverrideColorL(EColorLabelText, fgcolor);
      label->SetTextL(KDefaultText);
      CleanupStack::Pop(label);
      iLabelContainer.AppendL(TLabelData(label));
   }
   //CEikonEnv::Static()->ScreenDevice()->ReleaseFont(font);
   Components().SetControlsOwnedExternally(EFalse);

   // Set the windows size
   SetRect(aRect);

   // Activate the window, which makes it ready to be drawn
   ActivateL();
}
Пример #5
0
void CTestRectBackground::ConstructL()
    {
    CreateWindowL();    
	CTestRectGc::ConstructL(TPoint(20,20),TSize(600,200), KRgbBlack, KRgbYellow, CGraphicsContext::ESolidBrush);
	InitComponentArrayL();

	//Create a default control
    CreateComponentControlL(2, 7);
    	
	//Control to display the offscreen bitmap
    iControlImage = new (ELeave) CTestRectImageGc();
    iControlImage->CreateWindowL(this);
    iControlImage->DrawableWindow()->SetRequiredDisplayMode(EColor16MA); 
    iControlImage->ConstructL(TPoint(200,36),TSize(128,128), KRgbRed, KRgbGreen, CGraphicsContext::ESolidBrush); 
    iControlImage->ActivateL();

	//Second control to display blended overlay
    iControlImage2 = new (ELeave) CTestRectImageGc();
    iControlImage2->CreateWindowL(this); 
    iControlImage2->DrawableWindow()->SetRequiredDisplayMode(EColor16MA); 
    iControlImage2->ConstructL(TPoint(400,36),TSize(128,128), KRgbRed, KRgbGreen, CGraphicsContext::ESolidBrush); 
    iControlImage2->ActivateL();

	//Create an offscreen bitmap     
    iOffScreen = COffScreenBitmapGc::NewL(TSize(128,128));	
	
	//Create a second offscreen bitmap     
    iOffScreen2 = COffScreenBitmapGc::NewL(TSize(128,128));	
	
	//Set up the control images to display the two offscreen maps
	iControlImage->SetBitmap(iOffScreen->GetBitmap());	
	iControlImage2->SetBitmap(iOffScreen2->GetBitmap());	
    
    iBmpBackground = new (ELeave) CFbsBitmap();
    User::LeaveIfError(iBmpBackground->Load(_L("z:\\conetest\\city.mbm")));

	//Set up the Gc origin so that the offscreen bitmaps can be tiled in the same way as the screen drawn control
	TPoint ControlPos = iControl->PositionRelativeToScreen();
	iOffScreen->OffScreenGc()->SetWindowOrigin(ControlPos);
	iOffScreen2->OffScreenGc()->SetWindowOrigin(ControlPos);
	
    ActivateL();
    
    }
Пример #6
0
void CComponentControl::ConstructL(TInt aChildren, TInt aOwners, TPoint aPt, TSize aSize, TRgb aPenColor, TRgb aBrushColor, CGraphicsContext::TBrushStyle aBrushStyle)
    {
    	//Construct the base window of the control
    	CTestRectGc::ConstructL(aPt, aSize, aPenColor, aBrushColor, aBrushStyle);
    	InitComponentArrayL();

		TSize ChildSize(aSize.iWidth/2, aSize.iHeight/2);
		
		TPoint Offset;
		if (aOwners&1)
			Offset.SetXY(0,0);
		else
			Offset = aPt;
			
		CreateChildControlL(aChildren, aOwners>>1, Offset, ChildSize, aPenColor, aBrushColor, aBrushStyle);
		CreateChildControlL(aChildren, aOwners>>1, Offset+TSize(ChildSize.iWidth, 0), ChildSize, aPenColor, aBrushColor, aBrushStyle);
		CreateChildControlL(aChildren, aOwners>>1, Offset+TSize(0, ChildSize.iHeight), ChildSize, aPenColor, aBrushColor, aBrushStyle);
		CreateChildControlL(aChildren, aOwners>>1, Offset+TSize(ChildSize.iWidth, ChildSize.iHeight), ChildSize, aPenColor, aBrushColor, aBrushStyle);
		    		  		  	  		  	  	
    }
Пример #7
0
void CMainMenuListContainer::ConstructL(const TRect& aRect,
                                        CMainMenuListView* aView,
                                        const TInt* aMbmImageIds,
                                        const TInt* aMbmMaskIds,
                                        const TInt* aMainMenuCommandIds,
                                        const TInt* aMainMenuFirstLabelIds,
                                        const TInt* aMainMenuSecondLabelIds)
{
    CreateWindowL();

    InitComponentArrayL();

    iBgContext =
        CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,
                aRect, ETrue);

    iView = aView;
    iMainMenuCommandIds = aMainMenuCommandIds;

    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    TRgb fgcolor(0,0,0);
    AknsUtils::GetCachedColor(skin, fgcolor, KAknsIIDQsnTextColors,
                              EAknsCIQsnTextColorsCG6);

    CEikLabel* label = new (ELeave) CEikLabel();

    label->SetContainerWindowL(*this);
    Components().AppendLC(label, ETitleLabel);
    label->OverrideColorL(EColorLabelText, fgcolor);
    label->SetTextL(KDefaultTitle());
    label->SetLabelAlignment(ELayoutAlignCenter);
    HBufC* titleText = CEikonEnv::Static()->AllocReadResourceLC(R_MM_TITLE_TEXT);
    label->SetTextL(*titleText);
    CleanupStack::PopAndDestroy(titleText);
    CleanupStack::Pop(label);

    // Create and populate the listbox
    iListBox = new( ELeave ) CAknDoubleLargeStyleListBox();
    Components().AppendLC(iListBox, EListBox);

    iListBox->SetContainerWindowL(*this);
    iListBox->SetMopParent(this);
    {
        TResourceReader reader;
        iEikonEnv->CreateResourceReaderLC( reader, R_WAYFINDER_MAIN_MENU_LIST_VIEW_LISTBOX );
        iListBox->ConstructFromResourceL( reader );
        CleanupStack::PopAndDestroy(); // reader internal state
    }

    iListBox->SetFocus(ETrue);
    iListBox->SetListBoxObserver(this);

    iListBox->ItemDrawer()->FormattedCellData()->SetMarqueeParams(5, 3, 1000000, 200000);
    iListBox->ItemDrawer()->FormattedCellData()->EnableMarqueeL(ETrue);

    for (TInt i = 0; iMainMenuCommandIds[i] != -1; ++i) {
        AddItemL(aMbmImageIds[i], aMbmMaskIds[i],
                 aMainMenuFirstLabelIds[i],
                 aMainMenuSecondLabelIds[i]);
    }
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
            CEikScrollBarFrame::EOff);
    iListBox->UpdateScrollBarsL();

    iListBox->SetCurrentItemIndex(0);
    iListBox->DrawNow();
    CleanupStack::Pop(iListBox);

    //Activate view
    SetRect(aRect);
    ActivateL();
}