MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / drawItem

Method drawItem

src/main/java/ui/ComplexString.java:93–210  ·  view source on GitHub ↗
(Graphics g, int offset, boolean selected)

Source from the content-addressed store, hash-verified

91 public void onSelect(){};
92
93 public void drawItem(Graphics g, int offset, boolean selected){
94 boolean ralign=false;
95 boolean underline=false;
96
97//#if NICK_COLORS
98 boolean nick=false;
99//#endif
100
101 int w = g.getClipX() + offset;
102 int dw;
103 int imageYOfs=(( getVHeight()-imgHeight() )>>1);
104
105 int fontYOfs=(( getVHeight()-font.getHeight() )>>1);//+heightCorrect;
106
107 int imgWidth=imgWidth();
108
109 g.setFont(font);
110 for (int index=0; index<elementCount;index++) {
111 Object ob=elementData[index];
112 if (ob!=null) {
113
114 if (ob instanceof String ){
115 // string element
116 String s=(String) ob;
117//#if NICK_COLORS
118 if (nick) {
119 int nickColor=ColorTheme.getColor(ColorTheme.NICK_COLOR);
120 int vColor=ColorTheme.strong(nickColor);
121 //int randColor=randomColor();
122 dw=0;
123 int p1=0;
124 while (p1<s.length()) {
125 int p2=p1;
126 char c1=s.charAt(p1);
127 //processing the same cp
128 while (p2<s.length()) {
129 char c2=s.charAt(p2);
130 if ( (c1&0xff00) != (c2 &0xff00) ) break;
131 p2++;
132 }
133 g.setColor( (c1>255) ? vColor : nickColor);
134 //g.setColor(randColor);
135 dw=font.substringWidth(s, p1, p2-p1);
136 if (ralign) w-=dw;
137 g.drawSubstring( s, p1, p2-p1,
138 w,fontYOfs,Graphics.LEFT|Graphics.TOP);
139 if (!ralign) w+=dw;
140 p1=p2;
141 }
142
143 g.setColor(color);
144 } else {
145//#endif
146 g.setColor(getColor());
147 dw=font.stringWidth(s);
148 if (ralign) {
149 w-=dw;
150 if (centered) {

Callers 1

drawItemMethod · 0.95

Calls 15

getVHeightMethod · 0.95
imgHeightMethod · 0.95
imgWidthMethod · 0.95
getColorMethod · 0.95
strongMethod · 0.95
getColorMethod · 0.95
drawStringMethod · 0.95
iconAtMethod · 0.80
getHeightMethod · 0.65
substringWidthMethod · 0.65
stringWidthMethod · 0.65
getWidthMethod · 0.65

Tested by

no test coverage detected