GTKStyle(Font userFont, WidgetType widgetType) { this.widgetType = widgetType.ordinal(); String pangoFontName; synchronized (sun.awt.UNIXToolkit.GTK_LOCK) { xThickness = nativeGetXThickness(this.widgetType); yThickness = nativeGetYThickness(this.widgetType); pangoFontName = nativeGetPangoFontName(this.widgetType); } Font pangoFont = null; if (pangoFontName != null) { pangoFont = PangoFonts.lookupFont(pangoFontName); } if (pangoFont != null) { this.font = pangoFont; } else if (userFont != null) { this.font = userFont; } else { this.font = DEFAULT_FONT; } }
public void paintToolBarBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int state = context.getComponentState(); int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state); int orientation = ((JToolBar)context.getComponent()).getOrientation(); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state, orientation)) { ENGINE.startPainting(g, x, y, w, h, id, state, orientation); ENGINE.paintBox(g, context, id, gtkState, ShadowType.OUT, "handlebox_bin", x, y, w, h); ENGINE.finishPainting(); } } }
public void paintRadioButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); if (gtkState == SynthConstants.MOUSE_OVER) { synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) { ENGINE.startPainting(g, x, y, w, h, id); ENGINE.paintFlatBox(g, context, id, SynthConstants.MOUSE_OVER, ShadowType.ETCHED_OUT, "checkbutton", x, y, w, h, ColorType.BACKGROUND); ENGINE.finishPainting(); } } } }
public void paintRadioButtonMenuItemBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); if (gtkState == SynthConstants.MOUSE_OVER) { synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) { ShadowType shadow = (GTKLookAndFeel.is2_2() ? ShadowType.NONE : ShadowType.OUT); ENGINE.startPainting(g, x, y, w, h, id); ENGINE.paintBox(g, context, id, gtkState, shadow, "menuitem", x, y, w, h); ENGINE.finishPainting(); } } } }
public void paintMenuBarBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); synchronized (UNIXToolkit.GTK_LOCK) { if (ENGINE.paintCachedImage(g, x, y, w, h, id)) { return; } GTKStyle style = (GTKStyle)context.getStyle(); int shadow = style.getClassSpecificIntValue( context, "shadow-type", 2); ShadowType shadowType = SHADOWS[shadow]; int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); ENGINE.startPainting(g, x, y, w, h, id); ENGINE.paintBox(g, context, id, gtkState, shadowType, "menubar", x, y, w, h); ENGINE.finishPainting(); } }
public void paintMenuItemBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { int gtkState = GTKLookAndFeel.synthStateToGTKState( context.getRegion(), context.getComponentState()); if (gtkState == SynthConstants.MOUSE_OVER) { Region id = Region.MENU_ITEM; synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) { ShadowType shadow = (GTKLookAndFeel.is2_2() ? ShadowType.NONE : ShadowType.OUT); ENGINE.startPainting(g, x, y, w, h, id); ENGINE.paintBox(g, context, id, gtkState, shadow, "menuitem", x, y, w, h); ENGINE.finishPainting(); } } } }
public void paintPopupMenuBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); synchronized (UNIXToolkit.GTK_LOCK) { if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState)) { return; } ENGINE.startPainting(g, x, y, w, h, id, gtkState); ENGINE.paintBox(g, context, id, gtkState, ShadowType.OUT, "menu", x, y, w, h); GTKStyle style = (GTKStyle)context.getStyle(); int xThickness = style.getXThickness(); int yThickness = style.getYThickness(); ENGINE.paintBackground(g, context, id, gtkState, style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND), x + xThickness, y + yThickness, w - xThickness - xThickness, h - yThickness - yThickness); ENGINE.finishPainting(); } }
public void paintProgressBarForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { Region id = context.getRegion(); 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; } ENGINE.startPainting(g, x, y, w, h, id, "fg"); ENGINE.paintBox(g, context, id, SynthConstants.MOUSE_OVER, ShadowType.OUT, "bar", x, y, w, h); ENGINE.finishPainting(false); // don't bother caching the image } }
public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int dir) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir)) { Orientation orientation = (dir == JSlider.HORIZONTAL ? Orientation.HORIZONTAL : Orientation.VERTICAL); String detail = (dir == JSlider.HORIZONTAL ? "hscale" : "vscale"); ENGINE.startPainting(g, x, y, w, h, id, gtkState, dir); ENGINE.paintSlider(g, context, id, gtkState, ShadowType.OUT, detail, x, y, w, h, orientation); ENGINE.finishPainting(); } } }
public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); JSplitPane splitPane = (JSplitPane)context.getComponent(); Orientation orientation = (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? Orientation.VERTICAL : Orientation.HORIZONTAL); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, orientation)) { ENGINE.startPainting(g, x, y, w, h, id, gtkState, orientation); ENGINE.paintHandle(g, context, id, gtkState, ShadowType.OUT, "paned", x, y, w, h, orientation); ENGINE.finishPainting(); } } }
public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex) { Region id = context.getRegion(); int state = context.getComponentState(); int gtkState = ((state & SynthConstants.SELECTED) != 0 ? SynthConstants.ENABLED : SynthConstants.PRESSED); JTabbedPane pane = (JTabbedPane)context.getComponent(); int placement = pane.getTabPlacement(); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, placement, tabIndex)) { PositionType side = POSITIONS[placement - 1]; ENGINE.startPainting(g, x, y, w, h, id, gtkState, placement, tabIndex); ENGINE.paintExtension(g, context, id, gtkState, ShadowType.OUT, "tab", x, y, w, h, side, tabIndex); ENGINE.finishPainting(); } } }
public void paintTreeCellBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); int state = context.getComponentState(); int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state)) { ENGINE.startPainting(g, x, y, w, h, id, state); // the string arg should alternate based on row being painted, // but we currently don't pass that in. ENGINE.paintFlatBox(g, context, id, gtkState, ShadowType.NONE, "cell_odd", x, y, w, h, ColorType.TEXT_BACKGROUND); ENGINE.finishPainting(); } } }
void paintMetacityElement(SynthContext context, Graphics g, int gtkState, String detail, int x, int y, int w, int h, ShadowType shadow, ArrowType direction) { synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage( g, x, y, w, h, gtkState, detail, shadow, direction)) { ENGINE.startPainting( g, x, y, w, h, gtkState, detail, shadow, direction); if (detail == "metacity-arrow") { ENGINE.paintArrow(g, context, Region.INTERNAL_FRAME_TITLE_PANE, gtkState, shadow, direction, "", x, y, w, h); } else if (detail == "metacity-box") { ENGINE.paintBox(g, context, Region.INTERNAL_FRAME_TITLE_PANE, gtkState, shadow, "", x, y, w, h); } else if (detail == "metacity-vline") { ENGINE.paintVline(g, context, Region.INTERNAL_FRAME_TITLE_PANE, gtkState, "", x, y, w, h); } ENGINE.finishPainting(); } } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { SynthContext context = getContext((JComponent)c); Region id = context.getRegion(); int state = context.getComponentState(); int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) { ENGINE.startPainting(g, x, y, w, h, id); ENGINE.paintShadow(g, context, id, gtkState, ShadowType.ETCHED_IN, "frame", x, y, w, h); ENGINE.finishPainting(); } } }
private void getTargetsDelayed() { XToolkit.awtLock(); try { long curTime = System.currentTimeMillis(); if (isSelectionNotifyProcessed || curTime >= (convertSelectionTime + UNIXToolkit.getDatatransferTimeout())) { convertSelectionTime = curTime; XlibWrapper.XConvertSelection(XToolkit.getDisplay(), selection.getSelectionAtom().getAtom(), XDataTransferer.TARGETS_ATOM.getAtom(), getTargetsPropertyAtom().getAtom(), XWindow.getXAWTRootWindow().getWindow(), XConstants.CurrentTime); isSelectionNotifyProcessed = false; } } finally { XToolkit.awtUnlock(); } }
public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int dir) { Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); boolean hasFocus = GTKLookAndFeel.is3() && ((context.getComponentState() & SynthConstants.FOCUSED) != 0); synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir, hasFocus)) { Orientation orientation = (dir == JSlider.HORIZONTAL ? Orientation.HORIZONTAL : Orientation.VERTICAL); String detail = (dir == JSlider.HORIZONTAL ? "hscale" : "vscale"); ENGINE.startPainting(g, x, y, w, h, id, gtkState, dir); ENGINE.paintSlider(g, context, id, gtkState, ShadowType.OUT, detail, x, y, w, h, orientation, hasFocus); ENGINE.finishPainting(); } } }