gnu.java.awt.peer.qt

Class QtComponentPeer

Implemented Interfaces:
ComponentPeer
Known Direct Subclasses:
QtButtonPeer, QtCanvasPeer, QtCheckboxPeer, QtChoicePeer, QtContainerPeer, QtLabelPeer, QtListPeer, QtScrollbarPeer, QtTextAreaPeer, QtTextFieldPeer

public class QtComponentPeer
extends NativeWrapper
implements ComponentPeer

Field Summary

protected static int
POPUP_TRIGGER
Popup trigger button, may differ between platforms
protected QtImage
backBuffer
The component's double buffer for off-screen drawing.
protected long
qtApp
protected QtToolkit
toolkit
The toolkit which manufactured this peer.

Fields inherited from class gnu.java.awt.peer.qt.NativeWrapper

nativeObject

Method Summary

protected void
callInit()
boolean
canDetermineObscurity()
int
checkImage(Image img, int w, int h, ImageObserver o)
protected void
closeEvent()
Window closing event
void
coalescePaintEvent(PaintEvent e)
void
createBuffers(int numBuffers, BufferCapabilities caps)
Create a number of image buffers that implement a buffering strategy according to the given capabilities.
Image
createImage(int width, int height)
Image
createImage(ImageProducer producer)
VolatileImage
createVolatileImage(int w, int h)
A convenience method that creates a volatile image.
void
destroyBuffers()
Destroy the resources created by createBuffers.
void
disable()
void
dispose()
void
enable()
protected void
enterEvent(int modifiers, int x, int y, int dummy)
void
finalize()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed.
void
flip(BufferCapabilities.FlipContents contents)
Perform a page flip, leaving the contents of the back buffer in the specified state.
protected void
focusInEvent()
protected void
focusOutEvent()
Image
getBackBuffer()
Return the back buffer of this component.
Rectangle
getBounds()
Get the bounds of this component peer.
ColorModel
getColorModel()
FontMetrics
getFontMetrics(Font font)
Graphics
getGraphics()
GraphicsConfiguration
getGraphicsConfiguration()
Get the graphics configuration of the component.
Point
getLocationOnScreen()
Dimension
getMinimumSize()
Dimension
getPreferredSize()
Toolkit
getToolkit()
void
handleEvent(AWTEvent e)
boolean
handlesWheelScrolling()
void
hide()
protected void
hideEvent()
protected void
init()
Init does the creation of native widgets, it is therefore called from the main thread. (the constructor waits for this to happen.)
boolean
isFocusTraversable()
Part of the earlier 1.1 API, replaced by isFocusable().
boolean
isFocusable()
boolean
isObscured()
boolean
isReparentSupported()
Check if this component supports being reparented.
protected void
keyPressEvent(int modifiers, int code, int unicode, int dummy)
protected void
keyReleaseEvent(int modifiers, int code, int unicode, int dummy)
void
layout()
Layout this component peer.
protected void
leaveEvent(int modifiers, int x, int y, int dummy)
Dimension
minimumSize()
protected void
mouseDoubleClickEvent(int modifiers, int x, int y, int clickCount)
protected void
mouseMoveEvent(int modifiers, int x, int y, int clickCount)
protected void
mousePressEvent(int modifiers, int x, int y, int clickCount)
protected void
mouseReleaseEvent(int modifiers, int x, int y, int clickCount)
protected void
moveEvent(int x, int y, int oldx, int oldy)
void
paint(Graphics g)
paint() is called back from the native side in response to a native repaint event.
void
paintBackBuffer()
void
paintBackBuffer(int x, int y, int w, int h)
Dimension
preferredSize()
boolean
prepareImage(Image img, int w, int h, ImageObserver o)
void
print(Graphics g)
void
repaint(long tm, int x, int y, int w, int h)
Schedules a timed repaint.
void
reparent(ContainerPeer parent)
Reparent this component under another container.
void
requestFocus()
Part of the earlier 1.1 API, apparently replaced by argument form of the same method.
boolean
requestFocus(Component source, boolean bool1, boolean bool2, long x)
void
reshape(int x, int y, int width, int height)
protected void
resizeEvent(int oldWidth, int oldHeight, int width, int height)
void
setBackground(Color c)
void
setBounds(int x, int y, int width, int height)
void
setBounds(int x, int y, int width, int height, int z)
Set the bounds of this component peer.
void
setCursor(Cursor cursor)
Part of the earlier 1.1 API, apparently no longer needed.
void
setEnabled(boolean b)
void
setEventMask(long x)
Classpath-specific method
void
setFont(Font f)
void
setForeground(Color c)
void
setVisible(boolean b)
protected void
setup()
void
show()
protected void
showEvent()
void
updateCursorImmediately()
Update the cursor (note that setCursor is usually not called)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

POPUP_TRIGGER

protected static final int POPUP_TRIGGER
Popup trigger button, may differ between platforms
Field Value:
3

backBuffer

protected QtImage backBuffer
The component's double buffer for off-screen drawing.

qtApp

protected long qtApp

toolkit

protected QtToolkit toolkit
The toolkit which manufactured this peer.

Method Details

callInit

protected void callInit()

canDetermineObscurity

public boolean canDetermineObscurity()
Specified by:
canDetermineObscurity in interface ComponentPeer

checkImage

public int checkImage(Image img,
                      int w,
                      int h,
                      ImageObserver o)
Specified by:
checkImage in interface ComponentPeer

closeEvent

protected void closeEvent()
Window closing event

coalescePaintEvent

public void coalescePaintEvent(PaintEvent e)
Specified by:
coalescePaintEvent in interface ComponentPeer

createBuffers

public void createBuffers(int numBuffers,
                          BufferCapabilities caps)
            throws AWTException
Create a number of image buffers that implement a buffering strategy according to the given capabilities.
Specified by:
createBuffers in interface ComponentPeer
Parameters:
numBuffers - the number of buffers
caps - the buffering capabilities
Throws:
AWTException - if the specified buffering strategy is not implemented
Since:
1.2

createImage

public Image createImage(int width,
                         int height)
Specified by:
createImage in interface ComponentPeer

createImage

public Image createImage(ImageProducer producer)
Specified by:
createImage in interface ComponentPeer

createVolatileImage

public VolatileImage createVolatileImage(int w,
                                         int h)
A convenience method that creates a volatile image. The volatile image is created on the screen device on which this component is displayed, in the device's current graphics configuration.
Specified by:
createVolatileImage in interface ComponentPeer
Parameters:
Since:
1.2
See Also:
VolatileImage

destroyBuffers

public void destroyBuffers()
Destroy the resources created by createBuffers.
Specified by:
destroyBuffers in interface ComponentPeer
Since:
1.2

disable

public void disable()
Specified by:
disable in interface ComponentPeer

dispose

public void dispose()
Specified by:
dispose in interface ComponentPeer

enable

public void enable()
Specified by:
enable in interface ComponentPeer

enterEvent

protected void enterEvent(int modifiers,
                          int x,
                          int y,
                          int dummy)

finalize

public void finalize()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. You would think that this means it eventually is called on every Object, but this is not necessarily the case. If execution terminates abnormally, garbage collection does not always happen. Thus you cannot rely on this method to always work. For finer control over garbage collection, use references from the java.lang.ref package.

Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply super.finalize().

finalize() will be called by a Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.

If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.

It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.

Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls super.finalize().

The default implementation does nothing.

Overrides:
finalize in interface Object

flip

public void flip(BufferCapabilities.FlipContents contents)
Perform a page flip, leaving the contents of the back buffer in the specified state.
Specified by:
flip in interface ComponentPeer
Parameters:
contents - the state in which to leave the back buffer
Since:
1.2

focusInEvent

protected void focusInEvent()

focusOutEvent

protected void focusOutEvent()

getBackBuffer

public Image getBackBuffer()
Return the back buffer of this component.
Specified by:
getBackBuffer in interface ComponentPeer
Returns:
the back buffer of this component.
Since:
1.2

getBounds

public Rectangle getBounds()
Get the bounds of this component peer.
Specified by:
getBounds in interface ComponentPeer
Returns:
component peer bounds
Since:
1.5

getColorModel

public ColorModel getColorModel()
Specified by:
getColorModel in interface ComponentPeer

getFontMetrics

public FontMetrics getFontMetrics(Font font)
Specified by:
getFontMetrics in interface ComponentPeer

getGraphics

public Graphics getGraphics()
Specified by:
getGraphics in interface ComponentPeer

getGraphicsConfiguration

public GraphicsConfiguration getGraphicsConfiguration()
Get the graphics configuration of the component. The color model of the component can be derived from the configuration.
Specified by:
getGraphicsConfiguration in interface ComponentPeer

getLocationOnScreen

public Point getLocationOnScreen()
Specified by:
getLocationOnScreen in interface ComponentPeer

getMinimumSize

public Dimension getMinimumSize()
Specified by:
getMinimumSize in interface ComponentPeer

getPreferredSize

public Dimension getPreferredSize()
Specified by:
getPreferredSize in interface ComponentPeer

getToolkit

public Toolkit getToolkit()
Specified by:
getToolkit in interface ComponentPeer

handleEvent

public void handleEvent(AWTEvent e)
Specified by:
handleEvent in interface ComponentPeer

handlesWheelScrolling

public boolean handlesWheelScrolling()
Specified by:
handlesWheelScrolling in interface ComponentPeer

hide

public void hide()
Specified by:
hide in interface ComponentPeer

hideEvent

protected void hideEvent()

init

protected void init()
Init does the creation of native widgets, it is therefore called from the main thread. (the constructor waits for this to happen.)

isFocusTraversable

public boolean isFocusTraversable()
Part of the earlier 1.1 API, replaced by isFocusable().
Specified by:
isFocusTraversable in interface ComponentPeer

isFocusable

public boolean isFocusable()
Specified by:
isFocusable in interface ComponentPeer

isObscured

public boolean isObscured()
Specified by:
isObscured in interface ComponentPeer

isReparentSupported

public boolean isReparentSupported()
Check if this component supports being reparented.
Specified by:
isReparentSupported in interface ComponentPeer
Returns:
true if this component can be reparented, false otherwise.
Since:
1.5

keyPressEvent

protected void keyPressEvent(int modifiers,
                             int code,
                             int unicode,
                             int dummy)

keyReleaseEvent

protected void keyReleaseEvent(int modifiers,
                               int code,
                               int unicode,
                               int dummy)

layout

public void layout()
Layout this component peer.
Specified by:
layout in interface ComponentPeer
Since:
1.5

leaveEvent

protected void leaveEvent(int modifiers,
                          int x,
                          int y,
                          int dummy)

minimumSize

public Dimension minimumSize()
Specified by:
minimumSize in interface ComponentPeer

mouseDoubleClickEvent

protected void mouseDoubleClickEvent(int modifiers,
                                     int x,
                                     int y,
                                     int clickCount)

mouseMoveEvent

protected void mouseMoveEvent(int modifiers,
                              int x,
                              int y,
                              int clickCount)

mousePressEvent

protected void mousePressEvent(int modifiers,
                               int x,
                               int y,
                               int clickCount)

mouseReleaseEvent

protected void mouseReleaseEvent(int modifiers,
                                 int x,
                                 int y,
                                 int clickCount)

moveEvent

protected void moveEvent(int x,
                         int y,
                         int oldx,
                         int oldy)

paint

public void paint(Graphics g)
paint() is called back from the native side in response to a native repaint event.
Specified by:
paint in interface ComponentPeer

paintBackBuffer

public void paintBackBuffer()
            throws InterruptedException

paintBackBuffer

public void paintBackBuffer(int x,
                            int y,
                            int w,
                            int h)
            throws InterruptedException

preferredSize

public Dimension preferredSize()
Specified by:
preferredSize in interface ComponentPeer

prepareImage

public boolean prepareImage(Image img,
                            int w,
                            int h,
                            ImageObserver o)
Specified by:
prepareImage in interface ComponentPeer

print

public void print(Graphics g)
Specified by:
print in interface ComponentPeer

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int w,
                    int h)
Schedules a timed repaint.
Specified by:
repaint in interface ComponentPeer

reparent

public void reparent(ContainerPeer parent)
Reparent this component under another container.
Specified by:
reparent in interface ComponentPeer
Parameters:
parent -
Since:
1.5

requestFocus

public void requestFocus()
Part of the earlier 1.1 API, apparently replaced by argument form of the same method.
Specified by:
requestFocus in interface ComponentPeer

requestFocus

public boolean requestFocus(Component source,
                            boolean bool1,
                            boolean bool2,
                            long x)
Specified by:
requestFocus in interface ComponentPeer

reshape

public void reshape(int x,
                    int y,
                    int width,
                    int height)
Specified by:
reshape in interface ComponentPeer

resizeEvent

protected void resizeEvent(int oldWidth,
                           int oldHeight,
                           int width,
                           int height)

setBackground

public void setBackground(Color c)
Specified by:
setBackground in interface ComponentPeer

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Specified by:
setBounds in interface ComponentPeer

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height,
                      int z)
Set the bounds of this component peer.
Specified by:
setBounds in interface ComponentPeer
Parameters:
x - the new x co-ordinate
y - the new y co-ordinate
width - the new width
height - the new height
z - the new stacking level
Since:
1.5

setCursor

public void setCursor(Cursor cursor)
Part of the earlier 1.1 API, apparently no longer needed.
Specified by:
setCursor in interface ComponentPeer

setEnabled

public void setEnabled(boolean b)
Specified by:
setEnabled in interface ComponentPeer

setEventMask

public void setEventMask(long x)
Classpath-specific method
Specified by:
setEventMask in interface ComponentPeer

setFont

public void setFont(Font f)
Specified by:
setFont in interface ComponentPeer

setForeground

public void setForeground(Color c)
Specified by:
setForeground in interface ComponentPeer

setVisible

public void setVisible(boolean b)
Specified by:
setVisible in interface ComponentPeer

setup

protected void setup()

show

public void show()
Specified by:
show in interface ComponentPeer

showEvent

protected void showEvent()

updateCursorImmediately

public void updateCursorImmediately()
Update the cursor (note that setCursor is usually not called)
Specified by:
updateCursorImmediately in interface ComponentPeer

QtComponentPeer.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.