# SignListWindow Struct Reference

Inheritance diagram for SignListWindow:

## Public Member Functions
| SignListWindow (const WindowDesc *desc, WindowNumber window_number)
void | ClearFilterTextWidget ()
| Empties the string buffer that is edited by the filter text edit widget.
void | SetFilterString (const char *new_filter_string)
| This function sets the filter string of the sign list.
virtual void | OnPaint ()
| The window must be repainted.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a 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 | OnResize ()
| Called after the window got resized.
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 EventState | OnKeyPress (uint16 key, uint16 keycode)
| A key has been pressed.
virtual void | OnOSKInput (int widget)
virtual void | OnMouseLoop ()
| Called for every mouse loop run, which is at least once per (game) tick.
void | BuildSortSignList ()
virtual void | OnHundredthTick ()
| Called once every 100 (game) ticks.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
## Data Fields
int | text_offset
| Offset of the sign text relative to the left edge of the SLW_LIST widget.
Scrollbar * | vscroll
## Static Public Attributes
static Hotkey< SignListWindow > | signlist_hotkeys []

## Detailed Description

Definition at line 145 of file signs_gui.cpp.

## Member Function Documentation

void SignListWindow::ClearFilterTextWidget | ( |  | ) | `[inline]`

Empties the string buffer that is edited by the filter text edit widget.

It also triggers the redraw of the widget so it become visible that the string has been made empty.

Definition at line 174 of file signs_gui.cpp.

References QueryStringBaseWindow::edit_str_buf, Window::SetWidgetDirty(), SLW_FILTER_TEXT, and UpdateTextBufferSize().

Referenced by OnClick().

virtual void SignListWindow::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 220 of file signs_gui.cpp.

References _current_text_dir, DrawCompanyIcon(), DrawString(), FONT_HEIGHT_NORMAL, Scrollbar::GetCount(), Scrollbar::GetPosition(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, Scrollbar::IsVisible(), OWNER_NONE, Window::resize, SetDParam(), SLW_LIST, ResizeInfo::step_height, TD_RTL, text_offset, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and WD_FRAMETEXT_LEFT.

virtual void SignListWindow::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 257 of file signs_gui.cpp.

References ClearFilterTextWidget(), Scrollbar::GetScrolledRowFromWidget(), Window::InvalidateData(), ScrollMainWindowToTile(), SetFilterString(), Window::SetWidgetLoweredState(), SLW_FILTER_CLEAR_BTN, SLW_FILTER_MATCH_CASE_BTN, SLW_LIST, and WD_FRAMERECT_TOP.

Referenced by OnKeyPress().

virtual void SignListWindow::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 375 of file signs_gui.cpp.

References SignList::filter_string, GUIList< T, F >::ForceRebuild(), GUIList< T, F >::ForceResort(), and StrEmpty().

virtual EventState SignListWindow::OnKeyPress | ( | uint16 | 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 307 of file signs_gui.cpp.

References Textbuf::buf, CheckHotkeyMatch(), ES_HANDLED, ES_NOT_HANDLED, SmallVector< T, S >::Length(), OnClick(), ScrollMainWindowToTile(), SetFilterString(), Window::SetFocusedWidget(), SetFocusedWindow(), SLHK_FOCUS_FILTER_BOX, SLW_FILTER_CLEAR_BTN, SLW_FILTER_TEXT, and Window::UnfocusFocusedWidget().

virtual void SignListWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 213 of file signs_gui.cpp.

References Window::DrawWidgets(), Window::IsShaded(), GUIList< T, F >::NeedRebuild(), and SLW_FILTER_TEXT.

virtual void SignListWindow::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 281 of file signs_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), SLW_LIST, WD_FRAMERECT_BOTTOM, and WD_FRAMERECT_TOP.

void SignListWindow::SetFilterString | ( | const char * | new_filter_string | ) | `[inline]`

This function sets the filter string of the sign list.

The contents of the edit widget is not updated by this function. Depending on if the new string is zero-length or not the clear button is made disabled/enabled. The sign list is updated according to the new filter.

Definition at line 188 of file signs_gui.cpp.

References Window::DisableWidget(), Window::EnableWidget(), SignList::filter_string, Window::InvalidateData(), lastof, GUIList< T, F >::SetFilterState(), Window::SetWidgetDirty(), SLW_FILTER_CLEAR_BTN, strecpy(), and StrEmpty().

Referenced by OnClick(), and OnKeyPress().

virtual void SignListWindow::SetStringParameters | ( | int | widget | ) | const`[inline, virtual]`

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 252 of file signs_gui.cpp.

References Scrollbar::GetCount(), SetDParam(), and SLW_CAPTION.

virtual void SignListWindow::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 286 of file signs_gui.cpp.

References FONT_HEIGHT_NORMAL, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_sign_pool >::GetPoolSize(), GetSpriteSize(), GetStringBoundingBox(), MAX_LENGTH_SIGN_NAME_PIXELS, maxdim(), SetDParam(), SLW_CAPTION, SLW_LIST, text_offset, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, WD_FRAMETEXT_LEFT, and WD_FRAMETEXT_RIGHT.

## Field Documentation

Hotkey< SignListWindow > SignListWindow::signlist_hotkeys`[static]`

Initial value:

     {
      Hotkey<SignListWindow>('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),

    }

Definition at line 388 of file signs_gui.cpp.

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

- src/signs_gui.cpp