javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java
changeset 47 f40128debb5d
parent 35 85266cc22c7f
child 61 bf7ee68962da
equal deleted inserted replaced
35:85266cc22c7f 47:f40128debb5d
    66 
    66 
    67     private com.nokia.mj.impl.rt.support.Finalizer finalizer;
    67     private com.nokia.mj.impl.rt.support.Finalizer finalizer;
    68 
    68 
    69     // Graphics command buffer for this instance
    69     // Graphics command buffer for this instance
    70     Buffer graphicsBuffer;
    70     Buffer graphicsBuffer;
    71     Graphics CustomItemGraphics;
    71     Graphics customItemGraphics;
    72 
    72 
    73     CustomItemLayouter layouter;
    73     CustomItemLayouter layouter;
    74 
    74 
    75 
    75 
    76 
    76 
   548                 if(event.widget.isDisposed())
   548                 if(event.widget.isDisposed())
   549                 {
   549                 {
   550                     widgetDisposed = true;
   550                     widgetDisposed = true;
   551                     return;
   551                     return;
   552                 }
   552                 }
   553                 if(CustomItemGraphics == null)
   553                 if(customItemGraphics == null)
   554                 {
   554                 {
   555                     graphicsBuffer = Buffer.createInstance(self, (Control)event.widget);
   555                     graphicsBuffer = Buffer.createInstance(self, (Control)event.widget);
   556                     CustomItemGraphics = graphicsBuffer.getGraphics();
   556                     customItemGraphics = graphicsBuffer.getGraphics();
   557                     CustomItemGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
   557                     customItemGraphics.setSyncStrategy(Graphics.SYNC_LEAVE_SURFACE_SESSION_OPEN);
   558                 }
   558                 }
   559                 else
   559                 else
   560                 {
   560                 {
   561                     graphicsBuffer.setControlBounds((Control)event.widget);
   561                     graphicsBuffer.setControlBounds((Control)event.widget);
   562                 }
   562                 }
   581                 {
   581                 {
   582                     contentWidth = this.contentWidth;
   582                     contentWidth = this.contentWidth;
   583                     contentHeight = this.contentHeight;
   583                     contentHeight = this.contentHeight;
   584                 }
   584                 }
   585 
   585 
   586                 CustomItemGraphics.setClip(0, 0, contentWidth, contentHeight);
   586                 customItemGraphics.setClip(0, 0, contentWidth, contentHeight);
   587                 CustomItemGraphics.cleanBackground(new Rectangle(0, 0, contentWidth, contentHeight));
   587                 customItemGraphics.cleanBackground(new Rectangle(0, 0, contentWidth, contentHeight));
   588                 cleanupNeeded = false;
   588                 cleanupNeeded = false;
   589             }
   589             }
   590         }
   590         }
   591 
   591 
   592         // Clip must define the invalid area
   592         // Clip must define the invalid area
   593         CustomItemGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
   593         customItemGraphics.reset();
       
   594         customItemGraphics.setClip(redrawNowX, redrawNowY, redrawNowW, redrawNowH);
   594 
   595 
   595         // The callback
   596         // The callback
   596         paint(CustomItemGraphics, contentWidth, contentHeight);
   597         paint(customItemGraphics, contentWidth, contentHeight);
   597 
   598 
   598         // Wait until the UI thread is available. Then in the UI thread
   599         // Wait until the UI thread is available. Then in the UI thread
   599         // synchronously send a paint event.
   600         // synchronously send a paint event.
   600         ESWTUIThreadRunner.safeSyncExec(new Runnable()
   601         ESWTUIThreadRunner.safeSyncExec(new Runnable()
   601         {
   602         {