/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* GTKEngine delegates all painting job to native GTK libraries.
*
* Painting with GTKEngine looks like this:
* First, startPainting() is called. It prepares an offscreen buffer of the
* required size.
* Then, any number of paintXXX() methods can be called. They effectively ignore
* the Graphics parameter and draw to the offscreen buffer.
* Finally, finishPainting() should be called. It fills the data buffer passed
* in with the image data.
*
* @author Josh Outwater
*/
class GTKEngine {
/** Size of the image cache */
/** This enum mirrors that in gtk2_interface.h */
static enum WidgetType {
}
/**
* Representation of GtkSettings properties.
* When we need more settings we can add them here and
* to all implementations of getGTKSetting().
*/
static enum Settings {
}
/* Custom regions are needed for representing regions that don't exist
* in the original Region class.
*/
/*
* TITLED_BORDER Region is mapped to GtkFrame class which can draw
* titled borders around components.
*/
}
}
private native void native_paint_arrow(
private native void native_paint_box(
private native void native_paint_box_gap(
private native void native_paint_check(
private native void native_paint_expander(
private native void native_paint_extension(
private native void native_paint_flat_box(
private native void native_paint_focus(
private native void native_paint_handle(
private native void native_paint_hline(
private native void native_paint_option(
private native void native_paint_shadow(
private native void native_paint_slider(
private native void native_paint_vline(
private native void native_paint_background(
double visible);
private native void nativeStartPainting(int w, int h);
private native void native_switch_theme();
static {
// Make sure the awt toolkit is loaded so we have access to native
// methods.
// Initialize regionToWidgetTypeMap
}
/** Translate Region and JComponent into WidgetType ordinals */
if (value instanceof WidgetType) {
return (WidgetType)value;
}
if (c == null ) {
return widgets[0];
}
if (c instanceof JScrollBar) {
} else if (c instanceof JSeparator) {
/* We should return correrct WidgetType if the seperator is inserted
*/
return WidgetType.POPUP_MENU_SEPARATOR;
return WidgetType.TOOL_BAR_SEPARATOR;
}
} else if (c instanceof JSlider) {
} else if (c instanceof JProgressBar) {
} else if (c instanceof JSplitPane) {
/*
* For all ListCellRenderers we will use COMBO_BOX_TEXT_FIELD widget
* type because we can get correct insets. List items however won't be
* drawn as a text entry (see GTKPainter.paintLabelBackground).
*/
if (c instanceof ListCellRenderer) {
return widgets[1];
} else {
return widgets[0];
}
return widgets[1];
} else {
return widgets[0];
}
return widgets[1];
} else {
return widgets[0];
}
if (c.getParent() instanceof JScrollBar) {
c.getClientProperty("__arrow_direction__");
switch (dir) {
case SwingConstants.WEST:
return WidgetType.HSCROLL_BAR_BUTTON_LEFT;
case SwingConstants.EAST:
return WidgetType.HSCROLL_BAR_BUTTON_RIGHT;
case SwingConstants.NORTH:
return WidgetType.VSCROLL_BAR_BUTTON_UP;
case SwingConstants.SOUTH:
return WidgetType.VSCROLL_BAR_BUTTON_DOWN;
default:
return null;
}
return WidgetType.COMBO_BOX_ARROW_BUTTON;
} else {
return WidgetType.SPINNER_ARROW_BUTTON;
}
}
return null;
}
}
}
}
}
int gtkState =
}
}
}
int x, int y, int w, int h) {
expanderStyle.ordinal());
}
}
}
}
int x, int y, int w, int h, Orientation orientation) {
}
}
}
int x, int y, int w, int h) {
int gtkState =
}
int x, int y, int w, int h, Orientation orientation) {
}
}
}
// Transparency.OPAQUE
// Transparency.BITMASK
// Transparency.TRANSLUCENT
};
private final static int[][] BAND_OFFSETS = {
{ 0x00ff0000, 0x0000ff00, 0x000000ff }, // OPAQUE
{ 0x00ff0000, 0x0000ff00, 0x000000ff, 0x01000000 }, // BITMASK
{ 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 } // TRANSLUCENT
};
/**
* Paint a cached image identified by its size and a set of additional
* arguments, if there's one.
*
* @return true if a cached image has been painted, false otherwise
*/
if (w <= 0 || h <= 0) {
return true;
}
// look for cached image
return true;
}
return false;
}
/*
* Allocate a native offscreen buffer of the specified size.
*/
nativeStartPainting(w, h);
x0 = x;
y0 = y;
w0 = w;
h0 = h;
graphics = g;
}
/**
* Convenience method that delegates to finishPainting() with
* caching enabled.
*/
public void finishPainting() {
finishPainting(true);
}
/**
* Called to indicate that painting is finished. We create a new
* BufferedImage from the offscreen buffer, (optionally) cache it,
* and paint it.
*/
// Note that stealData() requires a markDirty() afterwards
// since we modify the data in it.
int transparency =
if (useCache) {
}
}
/**
* Notify native layer of theme change, and flush cache
*/
public void themeChanged() {
}
}
/* GtkSettings enum mirrors that in gtk2_interface.h */
}
}
/**
* Sets up the GtkAdjustment values for the native GtkRange widget
* associated with the given region (e.g. SLIDER, SCROLL_BAR).
*/
}
}