javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferSymbian.java
changeset 35 85266cc22c7f
child 57 59b3b4473dc8
equal deleted inserted replaced
26:dc7c549001d5 35:85266cc22c7f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 package javax.microedition.lcdui;
       
    19 
       
    20 import org.eclipse.swt.graphics.Rectangle;
       
    21 import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
       
    22 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
       
    23 import org.eclipse.swt.widgets.Control;
       
    24 import org.eclipse.swt.widgets.Internal_PackageSupport;
       
    25 import org.eclipse.swt.widgets.Widget;
       
    26 
       
    27 final class CustomItemBufferSymbian extends Buffer
       
    28 {
       
    29     private CustomItem host;
       
    30     private WindowSurface surface;
       
    31 
       
    32     CustomItemBufferSymbian(CustomItem customItem, Control ctrl)
       
    33     {
       
    34         super();
       
    35         setControlBounds(ctrl);
       
    36         host = customItem;
       
    37     }
       
    38 
       
    39     protected void init() 
       
    40     {
       
    41     	super.init();
       
    42     	surface = Internal_PackageSupport.getWindowsurface(host.layouter.dfi.getForm().getContentComp().getShell());
       
    43     }
       
    44     
       
    45     int getHostType()
       
    46     {
       
    47         return HOST_TYPE_CUSTOMITEM;
       
    48     }
       
    49 
       
    50     Object getHost()
       
    51     {
       
    52         return host;
       
    53     }
       
    54 
       
    55     void bindToHost(GraphicsContext gc)
       
    56     {
       
    57         gc.bindTarget(surface);
       
    58     }
       
    59 
       
    60     void blit(GraphicsContext gc, Widget widget) {
       
    61 		surface.flush();
       
    62 	}
       
    63 
       
    64     void endPaint() {
       
    65 		surface.endPaint();
       
    66 	}
       
    67 
       
    68     void beginPaint(int x, int y, int w, int h) {
       
    69 		Rectangle rect = toWindowCoordinates(x, y, w, h);
       
    70 		surface.beginPaint(rect.x, rect.y, rect.width, rect.height);
       
    71 	}
       
    72 
       
    73 	boolean isPaintingActive() {
       
    74 		return false;
       
    75 	}
       
    76 	
       
    77 	WindowSurface getWindowSurface()
       
    78     {
       
    79         return surface;
       
    80     }
       
    81 }