Window to enter the chat message in. More...
Public Member Functions | |
NetworkChatWindow (const WindowDesc *desc, DestType type, int dest) | |
Create a chat input window. | |
const char * | ChatTabCompletionNextItem (uint *item) |
Find the next item of the list of things that can be auto-completed. | |
void | ChatTabCompletion () |
See if we can auto-complete the current text of the user. | |
virtual void | OnPaint () |
The window must be repainted. | |
virtual Point | OnInitialPosition (const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) |
Compute the initial position of the window. | |
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
Update size and resize step of a widget in the window. | |
virtual void | DrawWidget (const Rect &r, int widget) const |
Draw the contents of a nested widget. | |
virtual void | OnClick (Point pt, int widget, int click_count) |
A click with the left mouse button has been made on the window. | |
virtual void | OnMouseLoop () |
Called for every mouse loop run, which is at least once per (game) tick. | |
virtual EventState | OnKeyPress (uint16 key, uint16 keycode) |
A key has been pressed. | |
virtual void | OnOpenOSKWindow (int wid) |
Callback for when the OSK window is opened. | |
virtual void | OnInvalidateData (int data=0, bool gui_scope=true) |
Some data on this window has become invalid. | |
Static Public Member Functions | |
static char * | ChatTabCompletionFindText (char *buf) |
Find what text to complete. | |
Data Fields | |
DestType | dtype |
The type of destination. | |
StringID | dest_string |
String representation of the destination. | |
int | dest |
The identifier of the destination. |
Window to enter the chat message in.
Definition at line 296 of file network_chat_gui.cpp.
NetworkChatWindow::NetworkChatWindow | ( | const WindowDesc * | desc, | |
DestType | type, | |||
int | dest | |||
) | [inline] |
Create a chat input window.
desc | Description of the looks of the window. | |
type | The type of destination. | |
dest | The actual destination index. |
Definition at line 307 of file network_chat_gui.cpp.
References CS_ALPHANUMERAL, dest_string, dtype, QueryStringBaseWindow::edit_str_buf, QueryStringBaseWindow::edit_str_size, Window::height, InitializeTextBuffer(), Window::InitNested(), InvalidateWindowData(), lengthof, PositionNetworkChatWindow(), and Window::SetFocusedWidget().
static char* NetworkChatWindow::ChatTabCompletionFindText | ( | char * | buf | ) | [inline, static] |
Find what text to complete.
It scans for a space from the left and marks the word right from that as to complete. It also writes a at the position of the space (if any). If nothing found, buf is returned.
Definition at line 379 of file network_chat_gui.cpp.
Referenced by ChatTabCompletion().
const char* NetworkChatWindow::ChatTabCompletionNextItem | ( | uint * | item | ) | [inline] |
Find the next item of the list of things that can be auto-completed.
item | The current indexed item to return. This function can, and most likely will, alter item, to skip empty items in the arrays. |
Definition at line 342 of file network_chat_gui.cpp.
References NetworkClientInfo::client_name, FOR_ALL_CLIENT_INFOS_FROM, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetPoolSize(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, lastof, MAX_CLIENT_SLOTS, and SetDParam().
Referenced by ChatTabCompletion().
virtual void NetworkChatWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 500 of file network_chat_gui.cpp.
References dest, DESTTYPE_CLIENT, DrawString(), dtype, NetworkClientInfo::GetByClientID(), SA_RIGHT, SetDParamStr(), WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.
virtual void NetworkChatWindow::OnClick | ( | Point | pt, | |
int | widget, | |||
int | click_count | |||
) | [inline, virtual] |
A click with the left mouse button has been made on the window.
pt | the point inside the window that has been clicked. | |
widget | the clicked widget. | |
click_count | Number of fast consecutive clicks at same position |
Reimplemented from Window.
Definition at line 510 of file network_chat_gui.cpp.
References Textbuf::buf, and SendChat().
virtual Point NetworkChatWindow::OnInitialPosition | ( | const WindowDesc * | desc, | |
int16 | sm_width, | |||
int16 | sm_height, | |||
int | window_number | |||
) | [inline, virtual] |
Compute the initial position of the window.
*desc | The pointer to the WindowDesc of the window to create. | |
sm_width | Smallest width of the window. | |
sm_height | Smallest height of the window. | |
window_number | The window number of the new window. |
Reimplemented from Window.
Definition at line 481 of file network_chat_gui.cpp.
References FindWindowById(), and Window::height.
virtual void NetworkChatWindow::OnInvalidateData | ( | int | data = 0 , |
|
bool | gui_scope = true | |||
) | [inline, virtual] |
Some data on this window has become invalid.
data | Information about the changed data. | |
gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details. |
Reimplemented from Window.
Definition at line 560 of file network_chat_gui.cpp.
References dest.
virtual EventState NetworkChatWindow::OnKeyPress | ( | uint16 | key, | |
uint16 | keycode | |||
) | [inline, virtual] |
A key has been pressed.
key | the Unicode value of the key. | |
keycode | the untranslated key code including shift state. |
Reimplemented from Window.
Definition at line 525 of file network_chat_gui.cpp.
References Textbuf::buf, ChatTabCompletion(), ES_HANDLED, ES_NOT_HANDLED, FindWindowById(), Window::InvalidateData(), Window::parent, and SendChat().
virtual void NetworkChatWindow::OnOpenOSKWindow | ( | int | wid | ) | [inline, virtual] |
Callback for when the OSK window is opened.
wid | The widget the OSK is opened of. |
Reimplemented from QueryStringBaseWindow.
Definition at line 550 of file network_chat_gui.cpp.
References ShowOnScreenKeyboard().
virtual void NetworkChatWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 475 of file network_chat_gui.cpp.
References Window::DrawWidgets().
virtual void NetworkChatWindow::UpdateWidgetSize | ( | int | widget, | |
Dimension * | size, | |||
const Dimension & | padding, | |||
Dimension * | fill, | |||
Dimension * | resize | |||
) | [inline, virtual] |
Update size and resize step of a widget in the window.
After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.
widget | Widget number. | |
size | Size of the widget. | |
padding | Recommended amount of space between the widget content and the widget edge. | |
fill | Fill step of the widget. | |
resize | Resize step of the widget. |
Reimplemented from Window.
Definition at line 487 of file network_chat_gui.cpp.
References dest, dest_string, DESTTYPE_CLIENT, dtype, NetworkClientInfo::GetByClientID(), GetStringBoundingBox(), maxdim(), SetDParamStr(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.