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

Method getVWidth

src/main/java/ui/ComplexString.java:212–243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

210 }
211
212 public int getVWidth() {
213 //g.setColor(0);
214 if (width>0) return width; // cached
215
216 int w=0;
217 int imgWidth=imgWidth();
218
219 for (int index=0; index<elementCount;index++) {
220 Object ob=elementData[index];
221 if (ob!=null) {
222
223 if (ob instanceof String ){
224 // string element
225 w+=font.stringWidth((String)ob);
226 } else if ((ob instanceof Integer)&& imageList!=null) {
227 // image element or color
228 int i=(((Integer)ob).intValue());
229 switch (i&0xff000000) {
230 case IMAGE:
231//#ifdef ANI_SMILES
232 if (imageList instanceof AniImageList) {
233 imgWidth = ((AniImageList)imageList).iconAt(i).getWidth();
234 }
235//#endif
236 w+=imgWidth;
237 break;
238 }
239 } // Integer
240 } // if ob!=null
241 } // for
242 return width=w;
243 }
244
245 public void setElementAt(Object obj, int index) {
246 height=width=0; // discarding cached values

Callers

nothing calls this directly

Calls 4

imgWidthMethod · 0.95
iconAtMethod · 0.80
stringWidthMethod · 0.65
getWidthMethod · 0.65

Tested by

no test coverage detected