Public Member Functions | Static Public Member Functions | Data Fields

NetworkChatWindow Struct Reference

Window to enter the chat message in. More...

Inheritance diagram for NetworkChatWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 NetworkChatWindow (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 Point OnInitialPosition (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 EventState OnKeyPress (WChar key, uint16 keycode)
 A key has been pressed.
virtual void OnEditboxChanged (int wid)
 The text in an editbox has been edited.
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.
QueryString message_editbox
 Message editbox.

Detailed Description

Window to enter the chat message in.

Definition at line 280 of file network_chat_gui.cpp.


Constructor & Destructor Documentation

NetworkChatWindow::NetworkChatWindow ( WindowDesc desc,
DestType  type,
int  dest 
) [inline]

Create a chat input window.

Parameters:
desc Description of the looks of the window.
type The type of destination.
dest The actual destination index.

Definition at line 292 of file network_chat_gui.cpp.

References QueryString::cancel_button, dest_string, dtype, Window::height, Window::InitNested(), InvalidateWindowData(), lengthof, message_editbox, QueryString::ok_button, PositionNetworkChatWindow(), Window::querystrings, Window::SetFocusedWidget(), WC_NEWS_WINDOW, and WID_NC_TEXTBOX.


Member Function Documentation

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 365 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.

Parameters:
item The current indexed item to return. This function can, and most likely will, alter item, to skip empty items in the arrays.
Returns:
Returns the char that matched to the index.

Definition at line 328 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.

Parameters:
r Rectangle occupied by the widget.
widget Number of the widget to draw.
Note:
This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 474 of file network_chat_gui.cpp.

References dest, DESTTYPE_CLIENT, DrawString(), dtype, NetworkClientInfo::GetByClientID(), SA_RIGHT, SetDParamStr(), WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and WID_NC_DESTINATION.

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.

Parameters:
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 484 of file network_chat_gui.cpp.

References Textbuf::buf, message_editbox, SendChat(), WID_NC_CLOSE, and WID_NC_SENDBUTTON.

virtual void NetworkChatWindow::OnEditboxChanged ( int  widget  )  [inline, virtual]

The text in an editbox has been edited.

Parameters:
widget The widget of the editbox.

Reimplemented from Window.

Definition at line 504 of file network_chat_gui.cpp.

virtual Point NetworkChatWindow::OnInitialPosition ( int16  sm_width,
int16  sm_height,
int  window_number 
) [inline, virtual]

Compute the initial position of the window.

Parameters:
sm_width Smallest width of the window.
sm_height Smallest height of the window.
window_number The window number of the new window.
Returns:
Initial position of the top-left corner of the window.

Reimplemented from Window.

Definition at line 455 of file network_chat_gui.cpp.

References FindWindowById(), Window::height, and WC_STATUS_BAR.

virtual void NetworkChatWindow::OnInvalidateData ( int  data = 0,
bool  gui_scope = true 
) [inline, virtual]

Some data on this window has become invalid.

Parameters:
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 514 of file network_chat_gui.cpp.

References dest.

virtual EventState NetworkChatWindow::OnKeyPress ( WChar  key,
uint16  keycode 
) [inline, virtual]

A key has been pressed.

Parameters:
key the Unicode value of the key.
keycode the untranslated key code including shift state.
Returns:
ES_HANDLED if the key press has been handled and no other window should receive the event.

Reimplemented from Window.

Definition at line 494 of file network_chat_gui.cpp.

References ChatTabCompletion().

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.

Parameters:
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 461 of file network_chat_gui.cpp.

References dest, dest_string, DESTTYPE_CLIENT, dtype, NetworkClientInfo::GetByClientID(), GetStringBoundingBox(), maxdim(), SetDParamStr(), WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, and WID_NC_DESTINATION.


The documentation for this struct was generated from the following file: