3 * Copyright 2000-2009 JetBrains s.r.o.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package com
.intellij
.ui
;
22 import java
.util
.Arrays
;
27 public class RowIcon
implements Icon
{
29 private final Icon
[] myIcons
;
33 public RowIcon(int iconCount
/*, int orientation*/) {
34 myIcons
= new Icon
[iconCount
];
35 //myOrientation = orientation;
38 public int hashCode() {
39 return myIcons
.length
> 0 ? myIcons
[0].hashCode() : 0;
42 public boolean equals(Object obj
) {
43 return obj
instanceof RowIcon
&& Arrays
.equals(((RowIcon
)obj
).myIcons
, myIcons
);
46 public int getIconCount() {
47 return myIcons
.length
;
50 public void setIcon(Icon icon
, int layer
) {
51 myIcons
[layer
] = icon
;
55 public Icon
getIcon(int index
) {
56 return myIcons
[index
];
59 public void paintIcon(Component c
, Graphics g
, int x
, int y
) {
61 for (Icon icon
: myIcons
) {
62 if (icon
== null) continue;
63 icon
.paintIcon(c
, g
, _x
, y
);
64 _x
+= icon
.getIconWidth();
65 //_y += icon.getIconHeight();
69 public int getIconWidth() {
73 public int getIconHeight() {
77 private void recalculateSize() {
80 for (Icon icon
: myIcons
) {
81 if (icon
== null) continue;
82 width
+= icon
.getIconWidth();
83 //height += icon.getIconHeight();
84 height
= Math
.max(height
, icon
.getIconHeight());