From e85218aa4d4fc2a9365c61031c60b167ada27f27 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 5 Apr 2015 15:23:49 +0200 Subject: [PATCH] TextListBox --> TextBox --- qcsrc/menu/xonotic/dialog_welcome.qc | 2 +- qcsrc/menu/xonotic/textbox.qc | 66 ++++++++++++++-------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/qcsrc/menu/xonotic/dialog_welcome.qc b/qcsrc/menu/xonotic/dialog_welcome.qc index 624fc0aff..1f618290e 100644 --- a/qcsrc/menu/xonotic/dialog_welcome.qc +++ b/qcsrc/menu/xonotic/dialog_welcome.qc @@ -105,7 +105,7 @@ void XonoticWelcomeDialog_fill(entity me) me.TD(me, 1, me.columns / 2, me.serverinfo_ip_ent = makeXonoticTextLabel(0, "")); me.gotoRC(me, 4, 0); - me.TD(me, me.rows - 4 - 1, me.columns, me.serverinfo_MOTD_ent = makeXonoticTextListBox()); + me.TD(me, me.rows - 4 - 1, me.columns, me.serverinfo_MOTD_ent = makeXonoticTextBox()); me.serverinfo_MOTD_ent.allowColors = 1; me.gotoRC(me, me.rows - 1, 0); me.TD(me, 1, me.columns / 2, e = makeXonoticCommandButton(_("Disconnect"), '0 0 0', "disconnect", COMMANDBUTTON_CLOSE)); diff --git a/qcsrc/menu/xonotic/textbox.qc b/qcsrc/menu/xonotic/textbox.qc index 7c6ec9a44..89101a816 100644 --- a/qcsrc/menu/xonotic/textbox.qc +++ b/qcsrc/menu/xonotic/textbox.qc @@ -1,56 +1,56 @@ #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; @@ -81,12 +81,12 @@ void XonoticTextListBox_setText(entity me, string theText) 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); -- 2.39.2