X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fitem%2Finputbox.qc;h=3272ed54f39ec1953ff8e61b822cced36287b414;hb=62d736d8c3a51baf5fa3a4265e39a2b773704a91;hp=43ef41f817d20303f668c4b2ae2177fe2d982195;hpb=826222f84e886d85179a032b07edc71d99982040;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/item/inputbox.qc b/qcsrc/menu/item/inputbox.qc index 43ef41f81..3272ed54f 100644 --- a/qcsrc/menu/item/inputbox.qc +++ b/qcsrc/menu/item/inputbox.qc @@ -1,51 +1,8 @@ #include "inputbox.qh" -#ifndef ITEM_INPUTBOX_H - #define ITEM_INPUTBOX_H - #include "label.qc" - CLASS(InputBox, Label) - METHOD(InputBox, configureInputBox, void(entity, string, float, float, string)); - METHOD(InputBox, draw, void(entity)); - METHOD(InputBox, setText, void(entity, string)); - METHOD(InputBox, enterText, void(entity, string)); - METHOD(InputBox, keyDown, float(entity, float, float, float)); - METHOD(InputBox, mouseMove, float(entity, vector)); - METHOD(InputBox, mouseRelease, float(entity, vector)); - METHOD(InputBox, mousePress, float(entity, vector)); - METHOD(InputBox, mouseDrag, float(entity, vector)); - METHOD(InputBox, showNotify, void(entity)); - METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector)); - ATTRIB(InputBox, src, string, string_null) +.float cb_offset; +.string cb_src; - ATTRIB(InputBox, cursorPos, float, 0) // characters - ATTRIB(InputBox, scrollPos, float, 0) // widths - - ATTRIB(InputBox, focusable, float, 1) - ATTRIB(InputBox, allowFocusSound, float, 1) - ATTRIB(InputBox, disabled, float, 0) - ATTRIB(InputBox, lastChangeTime, float, 0) - ATTRIB(InputBox, dragScrollTimer, float, 0) - ATTRIB(InputBox, dragScrollPos, vector, '0 0 0') - ATTRIB(InputBox, pressed, float, 0) - ATTRIB(InputBox, editColorCodes, float, 1) - ATTRIB(InputBox, forbiddenCharacters, string, "") - ATTRIB(InputBox, color, vector, '1 1 1') - ATTRIB(InputBox, colorF, vector, '1 1 1') - ATTRIB(InputBox, maxLength, float, 255) // if negative, it counts bytes, not chars - ATTRIB(InputBox, applyButton, entity, NULL) - - ATTRIB(InputBox, enableClearButton, float, 1) - ATTRIB(InputBox, clearButton, entity, NULL) - ATTRIB(InputBox, cb_width, float, 0) - ATTRIB(InputBox, cb_pressed, float, 0) - ATTRIB(InputBox, cb_focused, float, 0) - ATTRIB(InputBox, cb_color, vector, '1 1 1') - ATTRIB(InputBox, cb_colorF, vector, '1 1 1') - ATTRIB(InputBox, cb_colorC, vector, '1 1 1') - ENDCLASS(InputBox) -#endif - -#ifdef IMPLEMENTATION void InputBox_configureInputBox(entity me, string theText, float theCursorPos, float theFontSize, string gfx) { SUPER(InputBox).configureLabel(me, theText, theFontSize, 0.0); @@ -65,7 +22,7 @@ void InputBox_setText(entity me, string txt) { - if (me.text) strunzone(me.text); + strfree(me.text); SUPER(InputBox).setText(me, strzone(txt)); } @@ -114,17 +71,17 @@ return 1; } - float InputBox_mousePress(entity me, vector pos) + METHOD(InputBox, mousePress, bool(InputBox this, vector pos)) { - if (me.enableClearButton) - if (over_ClearButton(me, pos)) + if (this.enableClearButton) + if (over_ClearButton(this, pos)) { - me.cb_pressed = 1; - return 1; + this.cb_pressed = 1; + return true; } - me.dragScrollTimer = time; - me.pressed = 1; - return InputBox_mouseDrag(me, pos); + this.dragScrollTimer = time; + this.pressed = 1; + return InputBox_mouseDrag(this, pos); } float InputBox_mouseRelease(entity me, vector pos) @@ -399,11 +356,10 @@ } // skipping SUPER(InputBox).draw(me); - Item_draw(me); + MenuItem_draw(me); } void InputBox_showNotify(entity me) { me.focusable = !me.disabled; } -#endif