/** @SYMTestCaseID UIF-TConeBackground-Test4L @SYMDEF PDEF112327 @SYMTestCaseDesc Tests MCoeControlBackground, when a parent window owning control has one child control not supporting background drawing and non window owning.\n @SYMTestPriority Critical @SYMTestStatus Implemented @SYMTestActions : Sets the background draw style.\n Instantiates a parent control (CConeBackgroundTestParent) which has capability of background drawing.\n After a new screen device has been instantiated,instantiates a second graphics context and assigns it to the child control.\n Thus a scenario of parent control and child control with different graphics context is created and tested.\n Activates the parent and child control\n Invokes the DrawNow function for the NonWindowOwningControl class which results in calling Draw() and DrawComponets() on the parent control itself.\n @SYMTestType Manual @SYMTestExpectedResults : The background drawing should use the parent graphics context. \n All the test code does is to exercise the defect fix and thus the draw should complete without any error.\n */ void CConeBackgroundTestView::Test4L() { delete iControl; iControl = 0; iBgDrawer->SetBgStyle(1); iControl = CConeBackgroundTestParentWindowOwning::NewL(*this, Rect(), CConeBackgroundTestDrawer2::NewL()); // create a new Gc CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice((iControl->ControlEnv())->WsSession()); CleanupStack::PushL(screenDevice); User::LeaveIfError(screenDevice->Construct()); CWindowGc* gc=new(ELeave) CWindowGc(screenDevice); CleanupStack::PushL(gc); User::LeaveIfError(gc->Construct()); gc->Activate(Window()); (iControl->ComponentControl(0))->SetCustomGc(gc); gc->Deactivate(); TSize rectSize(90,200); iControl->SetSize(rectSize); (iControl->ComponentControl(0))->SetSize(rectSize); iControl->ActivateL(); (iControl->ComponentControl(0))->ActivateL(); (iControl->ComponentControl(0))->DrawNow(); CleanupStack::PopAndDestroy(gc); CleanupStack::PopAndDestroy(screenDevice); }
void CMMADisplay::SetWindowResources(QWidget* qtWidget) { LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetWindowResources +"); CCoeControl* control = 0; if (qtWidget && qtWidget ->winId()) { control = reinterpret_cast<CCoeControl*>(qtWidget->winId()); } CCoeEnv *coeEnv = control->ControlEnv(); RWsSession * iWs = &(coeEnv->WsSession()); CWsScreenDevice* iScreenDevice = coeEnv->ScreenDevice(); RWindowBase* window = static_cast<RWindowBase*>(control->DrawableWindow()); if (!iWindow) { return; } iWindow->ProcureWindowResourcesFromQWidget(iWs,iScreenDevice,window); iWindow->SetVisible(ETrue,ETrue); LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetWindowResources -"); }