924 // too. |
924 // too. |
925 private void paintTextBackground(SynthContext context, Graphics g, |
925 private void paintTextBackground(SynthContext context, Graphics g, |
926 int x, int y, int w, int h) { |
926 int x, int y, int w, int h) { |
927 // Text is odd in that it uses the TEXT_BACKGROUND vs BACKGROUND. |
927 // Text is odd in that it uses the TEXT_BACKGROUND vs BACKGROUND. |
928 JComponent c = context.getComponent(); |
928 JComponent c = context.getComponent(); |
|
929 Container container = c.getParent(); |
|
930 Container containerParent = null; |
929 GTKStyle style = (GTKStyle)context.getStyle(); |
931 GTKStyle style = (GTKStyle)context.getStyle(); |
930 Region id = context.getRegion(); |
932 Region id = context.getRegion(); |
931 int state = context.getComponentState(); |
933 int state = context.getComponentState(); |
|
934 |
|
935 if (c instanceof ListCellRenderer && container != null) { |
|
936 containerParent = container.getParent(); |
|
937 if (containerParent instanceof JComboBox |
|
938 && containerParent.hasFocus()) { |
|
939 state |= SynthConstants.FOCUSED; |
|
940 } |
|
941 } |
|
942 |
932 synchronized (UNIXToolkit.GTK_LOCK) { |
943 synchronized (UNIXToolkit.GTK_LOCK) { |
933 if (ENGINE.paintCachedImage(g, x, y, w, h, id, state)) { |
944 if (ENGINE.paintCachedImage(g, x, y, w, h, id, state)) { |
934 return; |
945 return; |
935 } |
946 } |
936 |
947 |
937 int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state); |
948 int gtkState = GTKLookAndFeel.synthStateToGTKState(id, state); |
938 int focusSize = 0; |
949 int focusSize = 0; |
939 boolean interiorFocus = style.getClassSpecificBoolValue( |
950 boolean interiorFocus = style.getClassSpecificBoolValue( |
940 context, "interior-focus", true); |
951 context, "interior-focus", true); |
|
952 |
|
953 focusSize = style.getClassSpecificIntValue(context, |
|
954 "focus-line-width",1); |
941 if (!interiorFocus && (state & SynthConstants.FOCUSED) != 0) { |
955 if (!interiorFocus && (state & SynthConstants.FOCUSED) != 0) { |
942 focusSize = style.getClassSpecificIntValue(context, |
|
943 "focus-line-width",1); |
|
944 x += focusSize; |
956 x += focusSize; |
945 y += focusSize; |
957 y += focusSize; |
946 w -= 2 * focusSize; |
958 w -= 2 * focusSize; |
947 h -= 2 * focusSize; |
959 h -= 2 * focusSize; |
948 } |
960 } |
959 y + yThickness, |
971 y + yThickness, |
960 w - (2 * xThickness), |
972 w - (2 * xThickness), |
961 h - (2 * yThickness), |
973 h - (2 * yThickness), |
962 ColorType.TEXT_BACKGROUND); |
974 ColorType.TEXT_BACKGROUND); |
963 |
975 |
964 if (focusSize > 0) { |
976 if (focusSize > 0 && (state & SynthConstants.FOCUSED) != 0) { |
965 x -= focusSize; |
977 if (!interiorFocus) { |
966 y -= focusSize; |
978 x -= focusSize; |
967 w += 2 * focusSize; |
979 y -= focusSize; |
968 h += 2 * focusSize; |
980 w += 2 * focusSize; |
|
981 h += 2 * focusSize; |
|
982 } else { |
|
983 if (containerParent instanceof JComboBox) { |
|
984 x += (focusSize + 2); |
|
985 y += (focusSize + 1); |
|
986 w -= (2 * focusSize + 1); |
|
987 h -= (2 * focusSize + 2); |
|
988 } else { |
|
989 x += focusSize; |
|
990 y += focusSize; |
|
991 w -= 2 * focusSize; |
|
992 h -= 2 * focusSize; |
|
993 } |
|
994 } |
969 ENGINE.paintFocus(g, context, id, gtkState, |
995 ENGINE.paintFocus(g, context, id, gtkState, |
970 "entry", x, y, w, h); |
996 "entry", x, y, w, h); |
971 } |
997 } |
972 ENGINE.finishPainting(); |
998 ENGINE.finishPainting(); |
973 } |
999 } |