X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fitem%2Finputbox.qc;h=6f7ed9f24309b7d7556d5d594144acf642198a83;hb=f72821fdcebe3ca01181a99727a06198de65ea08;hp=89adfaae934425dcc46ca6b024a79fac384dc24e;hpb=c741e6b3f012aa525f23e1df30d1d933b383fbc5;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/item/inputbox.qc b/qcsrc/menu/item/inputbox.qc index 89adfaae9..6f7ed9f24 100644 --- a/qcsrc/menu/item/inputbox.qc +++ b/qcsrc/menu/item/inputbox.qc @@ -1,49 +1,8 @@ -#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)); +#include "inputbox.qh" - 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, 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); @@ -132,6 +91,8 @@ { m_play_click_sound(MENU_SOUND_CLEAR); me.setText(me, ""); + if(me.applyButton) + me.applyButton.disabled = false; me.cb_pressed = 0; return 1; } @@ -167,6 +128,8 @@ if (ascii >= 32 && ascii != 127) { me.enterText(me, chr(ascii)); + if(me.applyButton) + me.applyButton.disabled = false; return 1; } switch (key) @@ -192,6 +155,8 @@ { me.cursorPos -= 1; me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1))); + if(me.applyButton) + me.applyButton.disabled = false; } return 1; case K_KP_DEL: @@ -202,9 +167,9 @@ me.setText(me, ""); } else - { me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1))); - } + if(me.applyButton) + me.applyButton.disabled = false; return 1; } return 0; @@ -398,4 +363,3 @@ { me.focusable = !me.disabled; } -#endif