skin on CAknDialog
| Sun, 2006-05-14 07:43 | |
|
Hi everybody,
I search and searched but couldn't find an answer to my problem. Maybe you can. In my application i'm using a simple dialog as my main screen. My problem is that I can't show the skin on the background of the main pane. Instead, I have the default white BG. I saw that simple dialog is not skin-aware but form, lists and more are skin-aware. I've managed to display the BG bacground on my forms using BaseConstruct(EAknEnableSkin) in my UI class. I guess I can use AknsUtils but I don't know where to put the code. Also, please note that I'm not using controls. I just you my CAknDialog-derived class. I'll appreciate any help Imzadi |
|






Forum posts: 40
imzadi
Forum posts: 5
Suppose u have a CEikEdwin control filling the entire dialog
This should work
void CMyEditorDialog::PreLayoutDynInitL()
{
iEditor = STATIC_CAST(CMyEdwin*, Control(EIdMyEdwin));
TRect rect(iEikonEnv->EikAppUi()->ClientRect());
iEditor->SetRect(rect);
}
SEikControlInfo CMyEditorDialog::CreateCustomControlL(TInt aControlType)
{
CCoeControl *control = NULL;
SEikControlInfo info = {control,0,0};
Forum posts: 5
Suppose u have a CEikEdwin control filling the entire dialog
This should work
//MyEditorDialog.cpp
...
void CMyEditorDialog::PreLayoutDynInitL()
  {
  iEditor = STATIC_CAST(CMyEdwin*, Control(EIdMyEdwin));
  TRect rect(iEikonEnv->EikAppUi()->ClientRect());
  iEditor->SetRect(rect);
  }
SEikControlInfo CMyEditorDialog::CreateCustomControlL(TInt aControlType)
  {
  CCoeControl *control = NULL;
  SEikControlInfo info = {control,0,0};
  if(aControlType == EIdMyEdwin)
   {
    info.iControl = new(ELeave) CMyEdwin(this);
      break;
    ((CMyEdwin*)info.iControl)
        ->SetSkinBackgroundControlContextL(NULL);
    }
   }
CMyEditorDialog::ActivateL()
 {
 ...
 iEditor->InitEditor();
 }
....
//MyEdwin.h
...
CAknsBasicBackgroundControlContext* iSkinContext;
CEikDialog* iParent;
TRect iBackgroundRect;
...
//MyEdwin.cpp
...
CMyEdwin::CMyEdwin(CEikDialog* aParent)
:iParent(aParent)
 {
 }
CMyEdwin::InitEditor()
 {
 ...
 iBackgroundRect = iParent->Rect();
 if(!iSkinContext)
  {
        iSkinContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,iBackgroundRect,EFalse);
  }
 ...
 }
TBool CMyEdwin::SupplyMopObject(TTypeUid aId,TTypeUid::Ptr& ptr)
{
if(aId.iUid == MAknsControlContext::ETypeId)
{
ptr = MAknsControlContext::
                   SupplyMopObject(aId, iSkinContext);
return ETrue;
}
return EFalse;
}
void CMyEdwin::Draw(const TRect& aRect) const Â
 {
 CWindowGc& gc = SystemGc();
 TRect tempMainPane;
 AknLayoutUtils::LayoutMetricsRect
       (AknLayoutUtils::EMainPane,tempMainPane);
 TRect mainPane(TPoint(0, 0), tempMainPane.Size());
 if(iSkinContext)
  {
  iSkinContext->SetRect(iParent->Rect());
  SetSkinBackgroundControlContextL
               (iSkinContext);
  AknsDrawUtils::Background( AknsUtils::SkinInstance(),
      iSkinContext, this, gc, mainPane);
  }
 }      Â