/*
* 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.
*/
/**
* @author Joshua Outwater
* @author Scott Violet
*/
// Need to support:
// default_outside_border: Insets when default.
// interior_focus: Indicates if focus should appear inside border, or
// outside border.
// focus-line-width: Integer giving size of focus border
// focus-padding: Integer giving padding between border and focus
// indicator.
// focus-line-pattern:
//
};
};
private GTKPainter() {
}
}
Graphics g, int x, int y, int w, int h) {
paintRadioButtonBackground(context, g, x, y, w, h);
}
Graphics g, int x, int y, int w, int h) {
paintRadioButtonMenuItemBackground(context, g, x, y, w, h);
}
// FORMATTED_TEXT_FIELD
Graphics g, int x, int y,
int w, int h) {
paintTextBackground(context, g, x, y, w, h);
}
//
// TOOL_BAR_DRAG_WINDOW
//
Graphics g, int x, int y,
int w, int h) {
paintToolBarBackground(context, g, x, y, w, h);
}
//
// TOOL_BAR
//
Graphics g, int x, int y,
int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
state, orientation))
{
"handlebox_bin", x, y, w, h);
}
}
}
Graphics g,
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
}
//
// PASSWORD_FIELD
//
Graphics g, int x, int y,
int w, int h) {
paintTextBackground(context, g, x, y, w, h);
}
//
// TEXT_FIELD
//
int x, int y, int w, int h) {
paintTreeCellEditorBackground(context, g, x, y, w, h);
} else {
paintTextBackground(context, g, x, y, w, h);
}
}
//
// RADIO_BUTTON
//
// NOTE: this is called for JCheckBox too
Graphics g, int x, int y,
int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
}
}
//
// RADIO_BUTTON_MENU_ITEM
//
// NOTE: this is called for JCheckBoxMenuItem too
Graphics g, int x, int y,
int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
shadow, "menuitem", x, y, w, h);
}
}
}
}
//
// LABEL
//
Graphics g, int x, int y,
int w, int h) {
if (name == "TableHeader.renderer" ||
name == "GTKFileChooser.directoryListLabel" ||
name == "GTKFileChooser.fileListLabel") {
x, y, w, h, true, false, false, false);
}
/*
* If the label is a ListCellRenderer and it's in a container
* (CellRendererPane) which is in a JComboBox then we paint the label
* as a TextField like a gtk_entry for a combobox.
*/
else if (c instanceof ListCellRenderer &&
paintTextBackground(context, g, x, y, w, h);
}
}
//
// INTERNAL_FRAME
//
Graphics g, int x, int y,
int w, int h) {
}
//
// DESKTOP_PANE
//
Graphics g, int x, int y,
int w, int h) {
// Does not call into ENGINE for better performance
}
//
// DESKTOP_ICON
//
Graphics g, int x, int y,
int w, int h) {
}
int x, int y, int w, int h) {
} else {
}
}
boolean paintBackground, boolean paintFocus,
boolean defaultCapable, boolean toolButton) {
synchronized (UNIXToolkit.GTK_LOCK) {
return;
}
// Paint the default indicator
if (defaultCapable && !toolButton) {
context, "default-border",
}
x += defaultInsets.left;
y += defaultInsets.top;
}
context, "interior-focus", true);
// Render the box.
if (!interiorFocus &&
x += totalFocusSize;
y += totalFocusSize;
w -= 2 * totalFocusSize;
h -= 2 * totalFocusSize;
}
boolean paintBg;
if (toolButton) {
// Toolbar buttons should only have their background painted
// in the PRESSED, SELECTED, or MOUSE_OVER states.
paintBg =
} else {
// Otherwise, always paint the button's background, unless
// the user has overridden it and we're in the ENABLED state.
paintBg =
}
if (paintBg) {
}
shadowType, detail, x, y, w, h);
}
// focus
if (interiorFocus) {
x += xThickness + focusPad;
y += yThickness + focusPad;
} else {
x -= totalFocusSize;
y -= totalFocusSize;
w += 2 * totalFocusSize;
h += 2 * totalFocusSize;
}
}
}
}
//
// ARROW_BUTTON
//
int x, int y, int w, int h,
int direction) {
switch (direction) {
case SwingConstants.NORTH:
case SwingConstants.SOUTH:
case SwingConstants.EAST:
case SwingConstants.WEST:
}
detail = "vscrollbar";
} else {
detail = "hscrollbar";
}
} else if (name == "Spinner.nextButton" ||
name == "Spinner.previousButton") {
detail = "spinbutton";
} else if (name != "ComboBox.arrowButton") {
assert false : "unexpected name: " + name;
}
synchronized (UNIXToolkit.GTK_LOCK) {
if (ENGINE.paintCachedImage(g, x, y, w, h,
return;
}
}
}
Graphics g, int x, int y, int w, int h) {
switch (direction) {
default:
case SwingConstants.EAST:
case SwingConstants.WEST:
detail = "hscrollbar";
break;
case SwingConstants.NORTH:
case SwingConstants.SOUTH:
detail = "vscrollbar";
break;
}
} else if (name == "Spinner.previousButton") {
detail = "spinbutton_down";
} else if (name == "Spinner.nextButton") {
detail = "spinbutton_up";
} else if (name != "ComboBox.arrowButton") {
assert false : "unexpected name: " + name;
}
synchronized (UNIXToolkit.GTK_LOCK) {
{
return;
}
/*
* The ubuntulooks engine (and presumably others) expect us to
* first draw the full "spinbutton" background, and then draw
* the individual "spinbutton_up/down" buttons on top of that.
* Note that it is the state of the JSpinner (not its arrow
* button) that determines how we draw this background.
*/
int modh = h*2;
}
{
}
x, y, w, h);
}
}
//
// LIST
//
int x, int y, int w, int h) {
// Does not call into ENGINE for better performance
}
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
return;
}
shadowType, "menubar", x, y, w, h);
}
}
//
// MENU
//
Graphics g,
int x, int y, int w, int h) {
paintMenuItemBackground(context, g, x, y, w, h);
}
// This is called for both MENU and MENU_ITEM
Graphics g,
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
"menuitem", x, y, w, h);
}
}
}
}
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
return;
}
x + xThickness, y + yThickness,
}
}
Graphics g,
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
}
int x, int y, int w, int h,
int orientation) {
synchronized (UNIXToolkit.GTK_LOCK) {
// Note that we don't call paintCachedImage() here. Since the
// progress bar foreground is painted differently for each value
// it would be wasteful to try to cache an image for each state,
// so instead we simply avoid caching in this case.
if (w <= 0 || h <= 0) {
return;
}
}
}
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
}
Graphics g,
int x, int y, int w, int h,
int orientation) {
/*
* Note: In theory, the style's x/y thickness values would determine
* the width of the separator content. In practice, however, some
* engines will render a line that is wider than the corresponding
* thickness value. For example, ubuntulooks reports x/y thickness
* values of 1 for separators, but always renders a 2-pixel wide line.
* As a result of all this, we need to be careful not to restrict
* the w/h values below too much, so that the full thickness of the
* rendered line will be captured by our image caching code.
*/
/*
* GTK renders toolbar separators differently in that an
* artificial padding is added to each end of the separator.
* The value of 0.2f below is derived from the source code of
* gtktoolbar.c in the current version of GTK+ (2.8.20 at the
* time of this writing). Specifically, the relevant values are:
* SPACE_LINE_DIVISION 10.0
* SPACE_LINE_START 2.0
* SPACE_LINE_END 8.0
* These are used to determine the distance from the top (or left)
* edge of the toolbar to the other edge. So for example, the
* height of a horizontal toolbar away from the top edge, which
* point is 8/10 of the height away from the top edge, or in other
* words, it is 2/10 away from the bottom edge, which is again
* how we arrive at the 0.2f value below.
*
* The separator is also centered horizontally or vertically,
* depending on its orientation. This was determined empirically
* and by examining the code referenced above.
*/
detail = "toolbar";
float pct = 0.2f;
x += (int)(w * pct);
w -= (int)(w * pct * 2);
} else {
y += (int)(h * pct);
h -= (int)(h * pct * 2);
}
} else {
detail = "separator";
} else {
}
}
synchronized (UNIXToolkit.GTK_LOCK) {
detail, x, y, w, h);
} else {
detail, x, y, w, h);
}
}
}
}
Graphics g,
int x, int y, int w,int h) {
// For focused sliders, we paint focus rect outside the bounds passed.
// Need to adjust for that.
int focusSize = 0;
if (focused) {
x -= focusSize;
y -= focusSize;
w += focusSize * 2;
h += focusSize * 2;
}
// The ubuntulooks engine paints slider troughs differently depending
// on the current slider value and its component orientation.
synchronized (UNIXToolkit.GTK_LOCK) {
// Note that we don't call paintCachedImage() here. Since some
// engines (e.g. ubuntulooks) paint the slider background
// differently for any given slider value, it would be wasteful
// to try to cache an image for each state, so instead we simply
// avoid caching in this case.
if (w <= 0 || h <= 0) {
return;
}
if (focused) {
"trough", x, y, w, h);
}
}
}
synchronized (UNIXToolkit.GTK_LOCK) {
"hscale" : "vscale");
}
}
}
//
// SPINNER
//
Graphics g,
int x, int y, int w, int h) {
// This is handled in paintTextFieldBackground
}
//
// SPLIT_PANE_DIVIDER
//
Graphics g,
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
if (! ENGINE.paintCachedImage(g, x, y, w, h,
}
}
}
Graphics g,int x, int y, int w, int h,
int orientation) {
}
Graphics g, int x, int y, int w, int h) {
pane.getTabPlacement());
int gapStart = 0;
int gapSize = 0;
if (selectedIndex != -1) {
}
else {
}
}
synchronized (UNIXToolkit.GTK_LOCK) {
if (! ENGINE.paintCachedImage(g, x, y, w, h,
ENGINE.startPainting(g, x, y, w, h,
}
}
}
Graphics g,
int x, int y, int w, int h,
int tabIndex) {
synchronized (UNIXToolkit.GTK_LOCK) {
if (! ENGINE.paintCachedImage(g, x, y, w, h,
ENGINE.startPainting(g, x, y, w, h,
}
}
}
//
// TEXT_PANE
//
int x, int y, int w, int h) {
paintTextAreaBackground(context, g, x, y, w, h);
}
//
// EDITOR_PANE
//
int x, int y, int w, int h) {
paintTextAreaBackground(context, g, x, y, w, h);
}
//
// TEXT_AREA
//
int x, int y, int w, int h) {
// Does not call into ENGINE for better performance
}
//
// TEXT_FIELD
//
// NOTE: Combobox and Label, Password and FormattedTextField calls this
// too.
int x, int y, int w, int h) {
// Text is odd in that it uses the TEXT_BACKGROUND vs BACKGROUND.
if (containerParent instanceof JComboBox
&& containerParent.hasFocus()) {
}
}
synchronized (UNIXToolkit.GTK_LOCK) {
return;
}
int focusSize = 0;
context, "interior-focus", true);
"focus-line-width",1);
x += focusSize;
y += focusSize;
w -= 2 * focusSize;
h -= 2 * focusSize;
}
x + xThickness,
y + yThickness,
w - (2 * xThickness),
h - (2 * yThickness),
if (!interiorFocus) {
x -= focusSize;
y -= focusSize;
w += 2 * focusSize;
h += 2 * focusSize;
} else {
if (containerParent instanceof JComboBox) {
x += (focusSize + 2);
y += (focusSize + 1);
} else {
x += focusSize;
y += focusSize;
w -= 2 * focusSize;
h -= 2 * focusSize;
}
}
"entry", x, y, w, h);
}
}
}
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
}
//
// ROOT_PANE
//
int x, int y, int w, int h) {
// Does not call into ENGINE for better performance
}
//
// TOGGLE_BUTTON
//
Graphics g,
int x, int y, int w, int h) {
x, y, w, h,
}
//
// SCROLL_BAR
//
Graphics g,
int x, int y, int w,int h) {
boolean focused =
synchronized (UNIXToolkit.GTK_LOCK) {
return;
}
// Note: the scrollbar insets already include the "trough-border",
// which is needed to position the scrollbar buttons properly.
// But when we render, we need to take the trough border out
// of the equation so that we paint the entire area covered by
// the trough border and the scrollbar content itself.
int troughBorder =
if (focused) {
}
}
}
//
// SCROLL_BAR_THUMB
//
// The clearlooks engine paints scrollbar thumbs differently
// depending on the current scroll value (specifically, it will avoid
// rendering a certain line when the thumb is at the starting or
// ending position). Therefore, we normalize the current value to
// the range [0,100] here and then pass it down to setRangeValue()
// so that the native widget is configured appropriately. Note that
// there are really only four values that matter (min, middle, max,
// or fill) so we restrict to one of those four values to avoid
// blowing out the image cache.
boolean rtl =
double min = 0;
double max = 100;
double visible = 20;
double value;
// In this case, the thumb fills the entire track, so it is
// touching both ends at the same time
value = 0;
visible = 100;
// At minimum
// At maximum
} else {
// Somewhere in between
value = 50;
}
synchronized (UNIXToolkit.GTK_LOCK) {
{
}
}
}
//
// TOOL_TIP
//
int x, int y, int w,int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
}
//
// TREE_CELL
//
int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
// the string arg should alternate based on row being painted,
// but we currently don't pass that in.
}
}
}
int x, int y, int w, int h) {
}
//
// TREE
//
int x, int y, int w, int h) {
// As far as I can tell, these don't call into the ENGINE.
}
//
// VIEWPORT
//
int x, int y, int w, int h) {
// As far as I can tell, these don't call into the ENGINE.
// Also note that you don't want this to call into the ENGINE
// as if it where to paint a background JViewport wouldn't scroll
// correctly.
}
synchronized (UNIXToolkit.GTK_LOCK) {
}
}
}
synchronized (UNIXToolkit.GTK_LOCK) {
if (! ENGINE.paintCachedImage(
if (detail == "metacity-arrow") {
} else if (detail == "metacity-box") {
} else if (detail == "metacity-vline") {
gtkState, "", x, y, w, h);
}
}
}
}
Method paintMethod, int x, int y, int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
try {
} catch (IllegalAccessException iae) {
assert false;
} catch (InvocationTargetException ite) {
assert false;
}
}
}
}
synchronized (UNIXToolkit.GTK_LOCK) {
if (! ENGINE.paintCachedImage(g,
try {
} catch (IllegalAccessException iae) {
assert false;
} catch (InvocationTargetException ite) {
assert false;
}
}
}
}
// All icon painting methods are called from under GTK_LOCK
}
}
}
}
}
}
}
}
// The orientation parameter passed down by Synth refers to the
// orientation of the toolbar, but the one we pass to GTK refers
// to the orientation of the handle. Therefore, we need to swap
// the value here: horizontal toolbars have vertical handles, and
// vice versa.
}
}
}
/*
* Fill an area with color determined from this context's Style using the
* specified GTKColorType
*/
g.fillRect(x, y, w, h);
}
}
// Refer to GTKLookAndFeel for details on this.
private boolean selectedCell;
private boolean focusedCell;
return new ListTableFocusBorder(true, true);
}
return new ListTableFocusBorder(false, true);
}
return new ListTableFocusBorder(false, false);
}
this.selectedCell = selectedCell;
this.focusedCell = focusedCell;
}
if (c instanceof JLabel) {
}
}
return context;
}
int w, int h) {
if (focusedCell) {
}
}
}
}
return i;
}
public boolean isBorderOpaque() {
return true;
}
}
// TitledBorder implementation for GTK L&F
int w, int h) {
synchronized (UNIXToolkit.GTK_LOCK) {
"frame", x, y, w, h);
}
}
}
}
public boolean isBorderOpaque() {
return true;
}
}
}
}
}