jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java
changeset 37711 972001566d66
parent 32865 f9cb6e427f9e
child 41399 367e803499c1
equal deleted inserted replaced
37710:8d246cbf84b1 37711:972001566d66
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   156             int x, int y, int width, int height);
   156             int x, int y, int width, int height);
   157     private native void native_paint_shadow(
   157     private native void native_paint_shadow(
   158             int widgetType, int state, int shadowType, String detail,
   158             int widgetType, int state, int shadowType, String detail,
   159             int x, int y, int width, int height, int synthState, int dir);
   159             int x, int y, int width, int height, int synthState, int dir);
   160     private native void native_paint_slider(
   160     private native void native_paint_slider(
   161             int widgetType, int state, int shadowType, String detail,
   161             int widgetType, int state, int shadowType, String detail, int x,
   162             int x, int y, int width, int height, int orientation);
   162             int y, int width, int height, int orientation, boolean hasFocus);
   163     private native void native_paint_vline(
   163     private native void native_paint_vline(
   164             int widgetType, int state, String detail,
   164             int widgetType, int state, String detail,
   165             int x, int y, int width, int height);
   165             int x, int y, int width, int height);
   166     private native void native_paint_background(
   166     private native void native_paint_background(
   167             int widgetType, int state, int x, int y, int width, int height);
   167             int widgetType, int state, int x, int y, int width, int height);
   489             int x, int y, int w, int h) {
   489             int x, int y, int w, int h) {
   490 
   490 
   491         int gtkState =
   491         int gtkState =
   492             GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
   492             GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
   493         int synthState = context.getComponentState();
   493         int synthState = context.getComponentState();
       
   494         Container parent = context.getComponent().getParent();
       
   495         if(GTKLookAndFeel.is3()) {
       
   496             if (parent != null && parent.getParent() instanceof JComboBox) {
       
   497                 if (parent.getParent().hasFocus()) {
       
   498                     synthState |= SynthConstants.FOCUSED;
       
   499                 }
       
   500             }
       
   501         }
   494         int dir = getTextDirection(context);
   502         int dir = getTextDirection(context);
   495         int widget = getWidgetType(context.getComponent(), id).ordinal();
   503         int widget = getWidgetType(context.getComponent(), id).ordinal();
   496         native_paint_shadow(widget, gtkState, shadowType.ordinal(), detail,
   504         native_paint_shadow(widget, gtkState, shadowType.ordinal(), detail,
   497                             x - x0, y - y0, w, h, synthState, dir);
   505                             x - x0, y - y0, w, h, synthState, dir);
   498     }
   506     }
   499 
   507 
   500     public void paintSlider(Graphics g, SynthContext context,
   508     public void paintSlider(Graphics g, SynthContext context,
   501             Region id, int state, ShadowType shadowType, String detail,
   509             Region id, int state, ShadowType shadowType, String detail, int x,
   502             int x, int y, int w, int h, Orientation orientation) {
   510             int y, int w, int h, Orientation orientation, boolean hasFocus) {
   503 
   511 
   504         state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
   512         state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal();
   505         int widget = getWidgetType(context.getComponent(), id).ordinal();
   513         int widget = getWidgetType(context.getComponent(), id).ordinal();
   506         native_paint_slider(widget, state, shadowType.ordinal(), detail,
   514         native_paint_slider(widget, state, shadowType.ordinal(), detail,
   507                             x - x0, y - y0, w, h, orientation.ordinal());
   515                          x - x0, y - y0, w, h, orientation.ordinal(), hasFocus);
   508     }
   516     }
   509 
   517 
   510     public void paintVline(Graphics g, SynthContext context,
   518     public void paintVline(Graphics g, SynthContext context,
   511             Region id, int state, String detail, int x, int y, int w, int h) {
   519             Region id, int state, String detail, int x, int y, int w, int h) {
   512 
   520