#ifdef INTERFACE
-CLASS(XonoticTextListBox) EXTENDS(ListBox)
- METHOD(XonoticTextListBox, configureXonoticTextListBox, void(entity))
- ATTRIB(XonoticTextListBox, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticTextListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
- ATTRIB(XonoticTextListBox, src, string, SKINGFX_SCROLLBAR)
- ATTRIB(XonoticTextListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
- ATTRIB(XonoticTextListBox, rowsPerItem, float, 1)
- METHOD(XonoticTextListBox, resizeNotify, void(entity, vector, vector, vector, vector))
- ATTRIB(XonoticTextListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
- ATTRIB(XonoticTextListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
- ATTRIB(XonoticTextListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
- ATTRIB(XonoticTextListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
- ATTRIB(XonoticTextListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
- ATTRIB(XonoticTextListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
+CLASS(XonoticTextBox) EXTENDS(ListBox)
+ METHOD(XonoticTextBox, configureXonoticTextBox, void(entity))
+ ATTRIB(XonoticTextBox, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticTextBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
+ ATTRIB(XonoticTextBox, src, string, SKINGFX_SCROLLBAR)
+ ATTRIB(XonoticTextBox, tolerance, vector, SKINTOLERANCE_SLIDER)
+ ATTRIB(XonoticTextBox, rowsPerItem, float, 1)
+ METHOD(XonoticTextBox, resizeNotify, void(entity, vector, vector, vector, vector))
+ ATTRIB(XonoticTextBox, color, vector, SKINCOLOR_SCROLLBAR_N)
+ ATTRIB(XonoticTextBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
+ ATTRIB(XonoticTextBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
+ ATTRIB(XonoticTextBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
+ ATTRIB(XonoticTextBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
+ ATTRIB(XonoticTextBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
- METHOD(XonoticTextListBox, setSelected, void(entity, float))
- METHOD(XonoticTextListBox, destroy, void(entity))
- ATTRIB(XonoticTextListBox, textbuf, float, -1)
- ATTRIB(XonoticTextListBox, textbufSize, float, 0)
- ATTRIB(XonoticTextListBox, allowColors, float, 0)
- METHOD(XonoticTextListBox, setText, void(entity, string))
- METHOD(XonoticTextListBox, drawListBoxItem, void(entity, float, vector, float)) // item number, width/height, selected
-ENDCLASS(XonoticTextListBox)
-entity makeXonoticTextListBox();
+ METHOD(XonoticTextBox, setSelected, void(entity, float))
+ METHOD(XonoticTextBox, destroy, void(entity))
+ ATTRIB(XonoticTextBox, textbuf, float, -1)
+ ATTRIB(XonoticTextBox, textbufSize, float, 0)
+ ATTRIB(XonoticTextBox, allowColors, float, 0)
+ METHOD(XonoticTextBox, setText, void(entity, string))
+ METHOD(XonoticTextBox, drawListBoxItem, void(entity, float, vector, float)) // item number, width/height, selected
+ENDCLASS(XonoticTextBox)
+entity makeXonoticTextBox();
#endif
#ifdef IMPLEMENTATION
-entity makeXonoticTextListBox()
+entity makeXonoticTextBox()
{
entity me;
- me = spawnXonoticTextListBox();
- me.configureXonoticTextListBox(me);
+ me = spawnXonoticTextBox();
+ me.configureXonoticTextBox(me);
return me;
}
-void XonoticTextListBox_configureXonoticTextListBox(entity me)
+void XonoticTextBox_configureXonoticTextBox(entity me)
{
me.configureListBox(me, me.scrollbarWidth, 1); // item height gets set up later
}
-void XonoticTextListBox_setSelected(entity me, float i)
+void XonoticTextBox_setSelected(entity me, float i)
{
// nothing
}
-void XonoticTextListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+void XonoticTextBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
me.itemHeight = me.rowsPerItem * me.fontSize / absSize_y;
- SUPER(XonoticTextListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+ SUPER(XonoticTextBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
}
-void XonoticTextListBox_setText(entity me, string theText)
+void XonoticTextBox_setText(entity me, string theText)
{
int i, k;
string ts;
strunzone(s);
me.textbufSize = buf_getsize(me.textbuf);
}
-void XonoticTextListBox_destroy(entity me)
+void XonoticTextBox_destroy(entity me)
{
if(me.textbuf >= 0)
buf_del(me.textbuf);
}
-void XonoticTextListBox_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticTextBox_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
{
if(me.textbufSize > 0)
draw_CenterText(me.realUpperMargin * eY + 0.5 * eX, bufstr_get(me.textbuf, i), me.realFontSize, '1 1 1', 1, me.allowColors);