javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwinCustomDraw.cpp
branchRCL_3
changeset 34 71c436fe3ce0
parent 25 9ac0a0a7da70
child 59 e5618cc85d74
equal deleted inserted replaced
25:9ac0a0a7da70 34:71c436fe3ce0
    29 //
    29 //
    30 CMIDTextEditorEdwinCustomDraw::CMIDTextEditorEdwinCustomDraw(
    30 CMIDTextEditorEdwinCustomDraw::CMIDTextEditorEdwinCustomDraw(
    31     const MLafEnv& aLafEnv,
    31     const MLafEnv& aLafEnv,
    32     const MFormCustomDraw& aParentDraw,
    32     const MFormCustomDraw& aParentDraw,
    33     const CMIDTextEditorEdwin& aEdwin) :
    33     const CMIDTextEditorEdwin& aEdwin) :
    34     CLafEdwinCustomDrawBase(aLafEnv, aEdwin),
    34         CLafEdwinCustomDrawBase(aLafEnv, aEdwin),
    35     iEdwin(aEdwin), iParentDraw(aParentDraw)
    35         iEdwin(aEdwin), iParentDraw(aParentDraw)
    36 {
    36 {
    37     DEBUG("CMIDTextEditorEdwinCustomDraw::CMIDTextEditorEdwinCustomDraw");
    37     DEBUG("CMIDTextEditorEdwinCustomDraw::CMIDTextEditorEdwinCustomDraw");
    38 }
    38 }
    39 
    39 
    40 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    74         // If scaling is on, it clips drawing to canvas size. After it
    74         // If scaling is on, it clips drawing to canvas size. After it
    75         // draws its background.
    75         // draws its background.
    76         // Only drawing otherwise.
    76         // Only drawing otherwise.
    77         if (iEdwin.IsScalingOn())
    77         if (iEdwin.IsScalingOn())
    78         {
    78         {
    79             aParam.iGc.SetClippingRect(iEdwin.GetOnScreenCanvasRect());
    79 
       
    80             aParam.iGc.SetClippingRect(GetClippingRectForScaling());
    80 
    81 
    81             iParentDraw.DrawBackground(aParam, aBackground, aDrawn);
    82             iParentDraw.DrawBackground(aParam, aBackground, aDrawn);
    82 
    83 
    83             aParam.iGc.CancelClippingRect();
    84             aParam.iGc.CancelClippingRect();
    84         }
    85         }
   101     // If scaling is on, it clips drawing to canvas size. After it
   102     // If scaling is on, it clips drawing to canvas size. After it
   102     // draws its lines.
   103     // draws its lines.
   103     // Only drawing otherwise.
   104     // Only drawing otherwise.
   104     if (iEdwin.IsScalingOn())
   105     if (iEdwin.IsScalingOn())
   105     {
   106     {
   106         aParam.iGc.SetClippingRect(iEdwin.GetOnScreenCanvasRect());
   107 
       
   108         aParam.iGc.SetClippingRect(GetClippingRectForScaling());
   107 
   109 
   108         iParentDraw.DrawLineGraphics(aParam, aLineInfo);
   110         iParentDraw.DrawLineGraphics(aParam, aLineInfo);
   109 
   111 
   110         aParam.iGc.CancelClippingRect();
   112         aParam.iGc.CancelClippingRect();
   111     }
   113     }
   144     // If scaling is on, it clips drawing to canvas size. After it
   146     // If scaling is on, it clips drawing to canvas size. After it
   145     // draws its text.
   147     // draws its text.
   146     // Only drawing otherwise.
   148     // Only drawing otherwise.
   147     if (iEdwin.IsScalingOn())
   149     if (iEdwin.IsScalingOn())
   148     {
   150     {
   149         aParam.iGc.SetClippingRect(iEdwin.GetOnScreenCanvasRect());
   151         aParam.iGc.SetClippingRect(GetClippingRectForScaling());
   150 
   152 
   151         iParentDraw.DrawText(
   153         iParentDraw.DrawText(
   152             aParam,
   154             aParam,
   153             aLineInfo,
   155             aLineInfo,
   154             aFormat,
   156             aFormat,
   202     // If scaling is on, it clips drawing to canvas size. After it
   204     // If scaling is on, it clips drawing to canvas size. After it
   203     // draws its text.
   205     // draws its text.
   204     // Only drawing otherwise.
   206     // Only drawing otherwise.
   205     if (iEdwin.IsScalingOn())
   207     if (iEdwin.IsScalingOn())
   206     {
   208     {
   207         aParam.iGc.SetClippingRect(iEdwin.GetOnScreenCanvasRect());
   209 
       
   210         aParam.iGc.SetClippingRect(GetClippingRectForScaling());
   208 
   211 
   209         iParentDraw.DrawText(
   212         iParentDraw.DrawText(
   210             aParam,
   213             aParam,
   211             aLineInfo,
   214             aLineInfo,
   212             aFormat,
   215             aFormat,
   256     }
   259     }
   257 
   260 
   258     return ret;
   261     return ret;
   259 }
   262 }
   260 
   263 
       
   264 // ---------------------------------------------------------------------------
       
   265 // CMIDTextEditorEdwinCustomDraw::GetClippingRectForScaling()
       
   266 // (other items were commented in the header file)
       
   267 // ---------------------------------------------------------------------------
       
   268 //
       
   269 const TRect CMIDTextEditorEdwinCustomDraw::GetClippingRectForScaling() const
       
   270 {
       
   271     // It gets intersection of editor and canvas rectangles.
       
   272     TRect rect = iEdwin.GetOnScreenCanvasRect();
       
   273     rect.Intersection(iEdwin.Rect());
       
   274     return rect;
       
   275 }
       
   276 
   261 // End of file
   277 // End of file