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

Class SmilePicker

src/main/java/Client/SmilePicker.java:44–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42import ui.controls.form.DefForm;
43
44public class SmilePicker
45 extends DefForm
46 implements
47 VirtualElement
48{
49
50 private final static int CURSOR_HOFFSET=1;
51 private final static int CURSOR_VOFFSET=1;
52
53 private int imgCnt;
54 private int xCnt;
55 private int xLastCnt;
56 private int xCursor;
57 private int lines;
58
59 private int lineHeight;
60 private int imgWidth;
61
62 private ImageList il;
63
64 private int caretPos;
65
66 private int realWidth=0;
67 private int xBorder = 0;
68
69 private Vector smileTable;
70
71 private MessageEdit me;
72
73 /** Creates a new instance of SmilePicker
74 * @param caretPos
75 * @param me
76 */
77 public SmilePicker(int caretPos, MessageEdit me) {
78 super(SR.MS_SELECT);
79 this.caretPos=caretPos;
80
81 this.me = me;
82
83 il = SmilesIcons.getInstance();
84//#ifdef SMILES
85 smileTable=MessageParser.getInstance().getSmileTable();
86//#endif
87
88 imgCnt=smileTable.size();
89
90 realWidth=VirtualCanvas.getInstance().getWidth()-scrollbar.getScrollWidth();
91
92 imgWidth=Math.max(il.getWidth()+(CURSOR_HOFFSET*2), cf.minItemHeight);
93 lineHeight = il.getHeight()+(CURSOR_VOFFSET*2);
94
95 xCnt= realWidth / imgWidth;
96
97 lines=imgCnt/xCnt;
98 xLastCnt=imgCnt-lines*xCnt;
99 if (xLastCnt>0) lines++; else xLastCnt=xCnt;
100
101 xBorder=(realWidth-(xCnt*imgWidth))/2;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected