gnu.java.awt.peer.qt

Class QtToolkit


public class QtToolkit
extends ClasspathToolkit

Field Summary

static EventQueue
eventQueue
static QtGraphicsEnvironment
graphicsEnv
static MainQtThread
guiThread
static QtRepaintThread
repaintThread

Fields inherited from class java.awt.Toolkit

desktopProperties, desktopPropsSupport

Constructor Summary

QtToolkit()
Construct the toolkit!

Method Summary

void
beep()
Causes a "beep" tone to be generated.
int
checkImage(Image image, int w, int h, ImageObserver observer)
Checks the status of specified image as it is being readied for rendering.
protected ButtonPeer
createButton(Button target)
Creates a peer object for the specified Button.
protected CanvasPeer
createCanvas(Canvas target)
Creates a peer object for the specified Canvas.
protected CheckboxPeer
createCheckbox(Checkbox target)
Creates a peer object for the specified Checkbox.
protected CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem target)
Creates a peer object for the specified CheckboxMenuItem.
protected ChoicePeer
createChoice(Choice target)
Creates a peer object for the specified Choice.
protected DialogPeer
createDialog(Dialog target)
Creates a peer object for the specified Dialog.
DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent dge)
EmbeddedWindowPeer
createEmbeddedWindow(EmbeddedWindow w)
Creates an embedded window peer, and associates it with an EmbeddedWindow object.
protected FileDialogPeer
createFileDialog(FileDialog target)
Creates a peer object for the specified FileDialog.
Font
createFont(int format, InputStream stream)
Creates a font, reading the glyph definitions from a stream.
protected FramePeer
createFrame(Frame target)
Creates a peer object for the specified Frame.
Image
createImage(byte[] imageData, int imageOffset, int imageLength)
Creates an image from the specified portion of the byte array passed.
Image
createImage(ImageProducer producer)
Creates an image using the specified ImageProducer
Image
createImage(String filename)
Image
createImage(URL url)
protected LabelPeer
createLabel(Label target)
Creates a peer object for the specified Label.
protected ListPeer
createList(List target)
Creates a peer object for the specified List.
protected MenuPeer
createMenu(Menu target)
Creates a peer object for the specified Menu.
protected MenuBarPeer
createMenuBar(MenuBar target)
Creates a peer object for the specified MenuBar.
protected MenuItemPeer
createMenuItem(MenuItem target)
Creates a peer object for the specified MenuItem.
protected PanelPeer
createPanel(Panel target)
Creates a peer object for the specified Panel.
protected PopupMenuPeer
createPopupMenu(PopupMenu target)
Creates a peer object for the specified PopupMenu.
RobotPeer
createRobot(GraphicsDevice screen)
protected ScrollPanePeer
createScrollPane(ScrollPane target)
Creates a peer object for the specified ScrollPane.
protected ScrollbarPeer
createScrollbar(Scrollbar target)
Creates a peer object for the specified Scrollbar.
protected TextAreaPeer
createTextArea(TextArea target)
Creates a peer object for the specified TextArea.
protected TextFieldPeer
createTextField(TextField target)
Creates a peer object for the specified TextField.
protected WindowPeer
createWindow(Window target)
Creates a peer object for the specified Window.
AWTEventListener[]
getAWTEventListeners()
AWTEventListener[]
getAWTEventListeners(long mask)
ClasspathFontPeer
getClasspathFontPeer(String name, Map attrs)
Acquires an appropriate ClasspathFontPeer, for use in classpath's implementation of Font.
ClasspathTextLayoutPeer
getClasspathTextLayoutPeer(AttributedString str, FontRenderContext frc)
ColorModel
getColorModel()
Returns the color model of the screen.
String[]
getFontList()
Just return the defaults.
FontMetrics
getFontMetrics(Font font)
Deprecated.
protected FontPeer
getFontPeer(String name, int style)
Deprecated.
Image
getImage(String filename)
Returns an image from the specified file, which must be in a recognized format.
Image
getImage(URL url)
Returns an image from the specified URL, which must be in a recognized format.
GraphicsEnvironment
getLocalGraphicsEnvironment()
Returns a shared instance of the local, platform-specific graphics environment.
PrintJob
getPrintJob(Frame frame, String jobtitle, Properties props)
Returns a instance of PrintJob for the specified arguments.
int
getScreenResolution()
Returns the screen resolution in dots per square inch.
Dimension
getScreenSize()
Returns the dimensions of the screen in pixels.
Clipboard
getSystemClipboard()
Returns the system clipboard.
protected EventQueue
getSystemEventQueueImpl()
Returns the event queue that is suitable for the calling context.
Map
mapInputMethodHighlight(InputMethodHighlight highlight)
boolean
prepareImage(Image image, int w, int h, ImageObserver observer)
Readies an image to be rendered on the screen.
void
sync()
Flushes any buffered data to the screen so that it is in sync with what the AWT system has drawn to it.

Methods inherited from class gnu.java.awt.ClasspathToolkit

createEmbeddedWindow, createFont, createRobot, getClasspathFontPeer, getClasspathTextLayoutPeer, getFont, getLocalGraphicsEnvironment, registerImageIOSpis

Methods inherited from class java.awt.Toolkit

addAWTEventListener, addPropertyChangeListener, beep, checkImage, createButton, createCanvas, createCheckbox, createCheckboxMenuItem, createChoice, createComponent, createCustomCursor, createDialog, createDragGestureRecognizer, createDragSourceContextPeer, createFileDialog, createFrame, createImage, createImage, createImage, createImage, createImage, createLabel, createList, createMenu, createMenuBar, createMenuItem, createPanel, createPopupMenu, createScrollPane, createScrollbar, createTextArea, createTextField, createWindow, getAWTEventListeners, getAWTEventListeners, getBestCursorSize, getColorModel, getDefaultToolkit, getDesktopProperty, getFontList, getFontMetrics, getFontPeer, getImage, getImage, getLockingKeyState, getMaximumCursorColors, getMenuShortcutKeyMask, getNativeContainer, getPrintJob, getPrintJob, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getScreenInsets, getScreenResolution, getScreenSize, getSystemClipboard, getSystemEventQueue, getSystemEventQueueImpl, getSystemSelection, initializeDesktopProperties, isDynamicLayoutActive, isDynamicLayoutSet, isFrameStateSupported, lazilyLoadDesktopProperty, loadSystemColors, mapInputMethodHighlight, prepareImage, removeAWTEventListener, removePropertyChangeListener, setDesktopProperty, setDynamicLayout, setLockingKeyState, sync

Methods inherited from class java.lang.Object

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

Field Details

eventQueue

public static EventQueue eventQueue

graphicsEnv

public static QtGraphicsEnvironment graphicsEnv

guiThread

public static MainQtThread guiThread

repaintThread

public static QtRepaintThread repaintThread

Constructor Details

QtToolkit

public QtToolkit()
Construct the toolkit!

Method Details

beep

public void beep()
Causes a "beep" tone to be generated.
Overrides:
beep in interface Toolkit

checkImage

public int checkImage(Image image,
                      int w,
                      int h,
                      ImageObserver observer)
Checks the status of specified image as it is being readied for rendering.
Overrides:
checkImage in interface Toolkit
Parameters:
image - The image to prepare for rendering.
observer - The observer to receive events about the preparation process.
Returns:
A union of the bitmasks from java.awt.image.ImageObserver that indicates the current state of the imaging readying process.

createButton

protected ButtonPeer createButton(Button target)
Creates a peer object for the specified Button.
Overrides:
createButton in interface Toolkit
Parameters:
target - The Button to create the peer for.
Returns:
The peer for the specified Button object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createCanvas

protected CanvasPeer createCanvas(Canvas target)
Creates a peer object for the specified Canvas.
Overrides:
createCanvas in interface Toolkit
Parameters:
target - The Canvas to create the peer for.
Returns:
The peer for the specified Canvas object.

createCheckbox

protected CheckboxPeer createCheckbox(Checkbox target)
Creates a peer object for the specified Checkbox.
Overrides:
createCheckbox in interface Toolkit
Parameters:
target - The Checkbox to create the peer for.
Returns:
The peer for the specified Checkbox object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createCheckboxMenuItem

protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
Creates a peer object for the specified CheckboxMenuItem.
Overrides:
createCheckboxMenuItem in interface Toolkit
Parameters:
target - The CheckboxMenuItem to create the peer for.
Returns:
The peer for the specified CheckboxMenuItem object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createChoice

protected ChoicePeer createChoice(Choice target)
Creates a peer object for the specified Choice.
Overrides:
createChoice in interface Toolkit
Parameters:
target - The Choice to create the peer for.
Returns:
The peer for the specified Choice object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createDialog

protected DialogPeer createDialog(Dialog target)
Creates a peer object for the specified Dialog.
Overrides:
createDialog in interface Toolkit
Parameters:
target - The dialog to create the peer for
Returns:
The peer for the specified font name.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createDragSourceContextPeer

public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
Overrides:
createDragSourceContextPeer in interface Toolkit
Since:
1.3

createEmbeddedWindow

public EmbeddedWindowPeer createEmbeddedWindow(EmbeddedWindow w)
Creates an embedded window peer, and associates it with an EmbeddedWindow object.
Overrides:
createEmbeddedWindow in interface ClasspathToolkit
Parameters:
w - The embedded window with which to associate a peer.

createFileDialog

protected FileDialogPeer createFileDialog(FileDialog target)
Creates a peer object for the specified FileDialog.
Overrides:
createFileDialog in interface Toolkit
Parameters:
target - The FileDialog to create the peer for.
Returns:
The peer for the specified FileDialog object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createFont

public Font createFont(int format,
                       InputStream stream)
Creates a font, reading the glyph definitions from a stream.

This method provides the platform-specific implementation for the static factory method Font.createFont(int,InputStream).

Overrides:
createFont in interface ClasspathToolkit
Parameters:
format - the format of the font data, such as Font.TRUETYPE_FONT. An implementation may ignore this argument if it is able to automatically recognize the font format from the provided data.
stream - an input stream from where the font data is read in. The stream will be advanced to the position after the font data, but not closed.
Throws:
IllegalArgumentException - if format is not supported.

createFrame

protected FramePeer createFrame(Frame target)
Creates a peer object for the specified Frame.
Overrides:
createFrame in interface Toolkit
Parameters:
target - The Frame to create the peer for.
Returns:
The peer for the specified Frame object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createImage

public Image createImage(byte[] imageData,
                         int imageOffset,
                         int imageLength)
Creates an image from the specified portion of the byte array passed. The array must be in a recognized format. Supported formats vary from toolkit to toolkit.
Overrides:
createImage in interface Toolkit
Parameters:
Returns:
The created image.

createImage

public Image createImage(ImageProducer producer)
Creates an image using the specified ImageProducer
Overrides:
createImage in interface Toolkit
Parameters:
producer - The ImageProducer to create the image from.
Returns:
The created image.

createImage

public Image createImage(String filename)
Overrides:
createImage in interface Toolkit

createImage

public Image createImage(URL url)
Overrides:
createImage in interface Toolkit

createLabel

protected LabelPeer createLabel(Label target)
Creates a peer object for the specified Label.
Overrides:
createLabel in interface Toolkit
Parameters:
target - The Label to create the peer for.
Returns:
The peer for the specified Label object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createList

protected ListPeer createList(List target)
Creates a peer object for the specified List.
Overrides:
createList in interface Toolkit
Parameters:
target - The List to create the peer for.
Returns:
The peer for the specified List object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createMenu

protected MenuPeer createMenu(Menu target)
Creates a peer object for the specified Menu.
Overrides:
createMenu in interface Toolkit
Parameters:
target - The Menu to create the peer for.
Returns:
The peer for the specified Menu object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createMenuBar

protected MenuBarPeer createMenuBar(MenuBar target)
Creates a peer object for the specified MenuBar.
Overrides:
createMenuBar in interface Toolkit
Parameters:
target - The MenuBar to create the peer for.
Returns:
The peer for the specified MenuBar object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createMenuItem

protected MenuItemPeer createMenuItem(MenuItem target)
Creates a peer object for the specified MenuItem.
Overrides:
createMenuItem in interface Toolkit
Parameters:
target - The MenuItem to create the peer for.
Returns:
The peer for the specified MenuItem object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createPanel

protected PanelPeer createPanel(Panel target)
Creates a peer object for the specified Panel.
Overrides:
createPanel in interface Toolkit
Parameters:
target - The Panel to create the peer for.
Returns:
The peer for the specified Panel object.

createPopupMenu

protected PopupMenuPeer createPopupMenu(PopupMenu target)
Creates a peer object for the specified PopupMenu.
Overrides:
createPopupMenu in interface Toolkit
Parameters:
target - The PopupMenu to create the peer for.
Returns:
The peer for the specified PopupMenu object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createRobot

public RobotPeer createRobot(GraphicsDevice screen)
            throws AWTException
Overrides:
createRobot in interface ClasspathToolkit

createScrollPane

protected ScrollPanePeer createScrollPane(ScrollPane target)
Creates a peer object for the specified ScrollPane.
Overrides:
createScrollPane in interface Toolkit
Parameters:
target - The ScrollPane to create the peer for.
Returns:
The peer for the specified ScrollPane object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createScrollbar

protected ScrollbarPeer createScrollbar(Scrollbar target)
Creates a peer object for the specified Scrollbar.
Overrides:
createScrollbar in interface Toolkit
Parameters:
target - The Scrollbar to create the peer for.
Returns:
The peer for the specified Scrollbar object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createTextArea

protected TextAreaPeer createTextArea(TextArea target)
Creates a peer object for the specified TextArea.
Overrides:
createTextArea in interface Toolkit
Parameters:
target - The TextArea to create the peer for.
Returns:
The peer for the specified TextArea object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createTextField

protected TextFieldPeer createTextField(TextField target)
Creates a peer object for the specified TextField.
Overrides:
createTextField in interface Toolkit
Parameters:
target - The TextField to create the peer for.
Returns:
The peer for the specified TextField object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createWindow

protected WindowPeer createWindow(Window target)
Creates a peer object for the specified Window.
Overrides:
createWindow in interface Toolkit
Parameters:
target - The Window to create the peer for.
Returns:
The peer for the specified Window object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getAWTEventListeners

public AWTEventListener[] getAWTEventListeners()
Overrides:
getAWTEventListeners in interface Toolkit
Since:
1.4

getAWTEventListeners

public AWTEventListener[] getAWTEventListeners(long mask)
Overrides:
getAWTEventListeners in interface Toolkit
Since:
1.4

getClasspathFontPeer

public ClasspathFontPeer getClasspathFontPeer(String name,
                                              Map attrs)
Acquires an appropriate ClasspathFontPeer, for use in classpath's implementation of Font.
Overrides:
getClasspathFontPeer in interface ClasspathToolkit
Parameters:
name - The logical name of the font. This may be either a face name or a logical font name, or may even be null. A default implementation of name decoding is provided in ClasspathFontPeer, but may be overridden in other toolkits.
attrs - Any extra TextAttribute attributes this font peer should have, such as size, weight, family name, or transformation.

getClasspathTextLayoutPeer

public ClasspathTextLayoutPeer getClasspathTextLayoutPeer(AttributedString str,
                                                          FontRenderContext frc)
Overrides:
getClasspathTextLayoutPeer in interface ClasspathToolkit

getColorModel

public ColorModel getColorModel()
Returns the color model of the screen.
Overrides:
getColorModel in interface Toolkit
Returns:
The color model of the screen.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getFontList

public String[] getFontList()
Just return the defaults.
Overrides:
getFontList in interface Toolkit

getFontMetrics

public FontMetrics getFontMetrics(Font font)

Deprecated.

Return the font metrics for the specified font
Overrides:
getFontMetrics in interface Toolkit
Parameters:
Returns:
The requested font metrics.

getFontPeer

protected FontPeer getFontPeer(String name,
                               int style)

Deprecated.

Creates a peer object for the specified font name.
Overrides:
getFontPeer in interface Toolkit
Parameters:
name - The font to create the peer for.
style - The font style to create the peer for.
Returns:
The peer for the specified font name.

getImage

public Image getImage(String filename)
Returns an image from the specified file, which must be in a recognized format. Supported formats vary from toolkit to toolkit.
Overrides:
getImage in interface Toolkit
Returns:
name The name of the file to read the image from.

getImage

public Image getImage(URL url)
Returns an image from the specified URL, which must be in a recognized format. Supported formats vary from toolkit to toolkit.
Overrides:
getImage in interface Toolkit
Returns:
url The URl to read the image from.

getLocalGraphicsEnvironment

public GraphicsEnvironment getLocalGraphicsEnvironment()
Returns a shared instance of the local, platform-specific graphics environment.

This method is specific to GNU Classpath. It gets called by the Classpath implementation of GraphicsEnvironment.getLocalGraphcisEnvironment().

Overrides:
getLocalGraphicsEnvironment in interface ClasspathToolkit

getPrintJob

public PrintJob getPrintJob(Frame frame,
                            String jobtitle,
                            Properties props)
Returns a instance of PrintJob for the specified arguments.
Overrides:
getPrintJob in interface Toolkit
Parameters:
frame - The window initiating the print job.
props - The print job properties.
Returns:
The requested print job, or null if the job was cancelled.
Throws:
NullPointerException - If frame is null, or GraphicsEnvironment.isHeadless() returns true.
SecurityException - If this thread is not allowed to initiate a print job request.

getScreenResolution

public int getScreenResolution()
Returns the screen resolution in dots per square inch.
Overrides:
getScreenResolution in interface Toolkit
Returns:
The screen resolution in dots per square inch.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getScreenSize

public Dimension getScreenSize()
Returns the dimensions of the screen in pixels.
Overrides:
getScreenSize in interface Toolkit
Returns:
The dimensions of the screen in pixels.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getSystemClipboard

public Clipboard getSystemClipboard()
Returns the system clipboard.
Overrides:
getSystemClipboard in interface Toolkit
Returns:
THe system clipboard.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getSystemEventQueueImpl

protected EventQueue getSystemEventQueueImpl()
Returns the event queue that is suitable for the calling context.

Despite the word “System” in the name of this method, a toolkit may provide different event queues for each applet. There is no guarantee that the same queue is shared system-wide.

No security checks are performed, which is why this method may only be called by Toolkits.

Overrides:
getSystemEventQueueImpl in interface Toolkit

mapInputMethodHighlight

public Map mapInputMethodHighlight(InputMethodHighlight highlight)
Overrides:
mapInputMethodHighlight in interface Toolkit
Since:
1.3

prepareImage

public boolean prepareImage(Image image,
                            int w,
                            int h,
                            ImageObserver observer)
Readies an image to be rendered on the screen. The width and height values can be set to the default sizes for the image by passing -1 in those parameters.
Overrides:
prepareImage in interface Toolkit
Parameters:
image - The image to prepare for rendering.
observer - The observer to receive events about the preparation process.
Returns:
true if the image is already prepared for rendering, false otherwise.

sync

public void sync()
Flushes any buffered data to the screen so that it is in sync with what the AWT system has drawn to it.
Overrides:
sync in interface Toolkit

QtToolkit.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.