adds an edit box
| 2085 | |
| 2086 | // adds an edit box |
| 2087 | char *newuiSheet::AddEditBox(const char *title, int16_t maxlen, int16_t w, int16_t id, int16_t flags, bool on_escape_quit) { |
| 2088 | int8_t type = GADGET_EDITBOX; |
| 2089 | if (flags & UIED_PASSWORD) { |
| 2090 | type = GADGET_EDITBOXPASS; |
| 2091 | } else if (flags & UIED_NUMBERS) { |
| 2092 | type = GADGET_EDITBOXNUM; |
| 2093 | } |
| 2094 | |
| 2095 | newuiSheet::t_gadget_desc *gadget = AddGadget(id, type, title); |
| 2096 | |
| 2097 | ASSERT(maxlen < EDIT_BUFLEN_MAX); |
| 2098 | ASSERT(w <= 0xfff); |
| 2099 | |
| 2100 | char *strbuf = (char *)mem_malloc(maxlen + 1); |
| 2101 | strbuf[0] = 0; |
| 2102 | gadget->internal = strbuf; |
| 2103 | gadget->parm.s[0] = (w & 0xfff); |
| 2104 | gadget->parm.s[1] = maxlen; |
| 2105 | |
| 2106 | // awful hack to store extra info into gadget structure. width should never exceed 4096 |
| 2107 | if (on_escape_quit) { |
| 2108 | gadget->parm.s[0] |= (0x1000); |
| 2109 | } |
| 2110 | |
| 2111 | return (char *)gadget->internal; |
| 2112 | } |
| 2113 | |
| 2114 | ////////////////////////////////////////////////////////////////////////////// |
| 2115 | // CLASS simple buttons |
no outgoing calls
no test coverage detected