javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasBuffer.java
changeset 35 85266cc22c7f
parent 26 dc7c549001d5
child 40 c6043ea9b06a
child 44 0105bdca6f9c
child 47 f40128debb5d
child 49 35baca0e7a2e
equal deleted inserted replaced
26:dc7c549001d5 35:85266cc22c7f
     1 /*
       
     2 * Copyright (c) 2009,2010 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 package javax.microedition.lcdui;
       
    18 
       
    19 import org.eclipse.swt.widgets.Control;
       
    20 import org.eclipse.swt.graphics.Rectangle;
       
    21 import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
       
    22 import org.eclipse.swt.widgets.Internal_PackageSupport;
       
    23 
       
    24 final class CanvasBuffer extends Buffer
       
    25 {
       
    26 
       
    27     private Canvas host;
       
    28 
       
    29     CanvasBuffer(Canvas canvas, Control ctrl)
       
    30     {
       
    31         super();
       
    32         setControlBounds(ctrl);
       
    33         host = canvas;
       
    34     }
       
    35 
       
    36     int getHostType()
       
    37     {
       
    38         return HOST_TYPE_CANVAS;
       
    39     }
       
    40 
       
    41     void setupWindowSurface()
       
    42     {
       
    43         if(super.windowSurface == null)
       
    44         {
       
    45             super.windowSurface = Internal_PackageSupport.getWindowsurface(host.getShell());
       
    46         }
       
    47     }
       
    48 
       
    49     Object getHost()
       
    50     {
       
    51         return host;
       
    52     }
       
    53 
       
    54     void bindToHost(GraphicsContext gc)
       
    55     {
       
    56         gc.bindTarget(super.windowSurface);
       
    57     }
       
    58 }