(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
This commit is contained in:
@@ -284,10 +284,11 @@ static void SendChat(const char *buf, DestType type, int dest)
|
||||
}
|
||||
|
||||
/** Window to enter the chat message in. */
|
||||
struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||
struct NetworkChatWindow : public Window {
|
||||
DestType dtype; ///< The type of destination.
|
||||
StringID dest_string; ///< String representation of the destination.
|
||||
int dest; ///< The identifier of the destination.
|
||||
QueryString message_editbox; ///< Message editbox.
|
||||
|
||||
/**
|
||||
* Create a chat input window.
|
||||
@@ -295,13 +296,14 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||
* @param type The type of destination.
|
||||
* @param dest The actual destination index.
|
||||
*/
|
||||
NetworkChatWindow(const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(NETWORK_CHAT_LENGTH)
|
||||
NetworkChatWindow(const WindowDesc *desc, DestType type, int dest) : message_editbox(NETWORK_CHAT_LENGTH)
|
||||
{
|
||||
this->dtype = type;
|
||||
this->dest = dest;
|
||||
this->cancel_button = WID_NC_CLOSE;
|
||||
this->ok_button = WID_NC_SENDBUTTON;
|
||||
this->afilter = CS_ALPHANUMERAL;
|
||||
this->querystrings[WID_NC_TEXTBOX] = &this->message_editbox;
|
||||
this->message_editbox.cancel_button = WID_NC_CLOSE;
|
||||
this->message_editbox.ok_button = WID_NC_SENDBUTTON;
|
||||
this->message_editbox.afilter = CS_ALPHANUMERAL;
|
||||
|
||||
static const StringID chat_captions[] = {
|
||||
STR_NETWORK_CHAT_ALL_CAPTION,
|
||||
@@ -383,9 +385,9 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||
void ChatTabCompletion()
|
||||
{
|
||||
static char _chat_tab_completion_buf[NETWORK_CHAT_LENGTH];
|
||||
assert(this->text.max_bytes == lengthof(_chat_tab_completion_buf));
|
||||
assert(this->message_editbox.text.max_bytes == lengthof(_chat_tab_completion_buf));
|
||||
|
||||
Textbuf *tb = &this->text;
|
||||
Textbuf *tb = &this->message_editbox.text;
|
||||
size_t len, tb_len;
|
||||
uint item;
|
||||
char *tb_buf, *pre_buf;
|
||||
@@ -437,9 +439,9 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||
|
||||
/* Change to the found name. Add ': ' if we are at the start of the line (pretty) */
|
||||
if (pre_buf == tb_buf) {
|
||||
this->text.Print("%s: ", cur_name);
|
||||
this->message_editbox.text.Print("%s: ", cur_name);
|
||||
} else {
|
||||
this->text.Print("%s %s", pre_buf, cur_name);
|
||||
this->message_editbox.text.Print("%s %s", pre_buf, cur_name);
|
||||
}
|
||||
|
||||
this->SetDirty();
|
||||
@@ -450,7 +452,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||
|
||||
if (second_scan) {
|
||||
/* We walked all posibilities, and the user presses tab again.. revert to original text */
|
||||
this->text.Assign(_chat_tab_completion_buf);
|
||||
this->message_editbox.text.Assign(_chat_tab_completion_buf);
|
||||
_chat_tab_completion_active = false;
|
||||
|
||||
this->SetDirty();
|
||||
@@ -491,7 +493,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
|
||||
{
|
||||
switch (widget) {
|
||||
/* Send */
|
||||
case WID_NC_SENDBUTTON: SendChat(this->text.buf, this->dtype, this->dest);
|
||||
case WID_NC_SENDBUTTON: SendChat(this->message_editbox.text.buf, this->dtype, this->dest);
|
||||
/* FALL THROUGH */
|
||||
case WID_NC_CLOSE: /* Cancel */ delete this; break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user