Public Member Functions | Data Fields

# SpriteAlignerWindow Struct Reference

Window used for aligning sprites. More...

Inheritance diagram for SpriteAlignerWindow:

## Public Member Functions
| SpriteAlignerWindow (WindowDesc *desc, WindowNumber wno)
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
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 | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
virtual void | OnResize ()
| Called after the window got resized.
## Data Fields
SpriteID | current_sprite
| The currently shown sprite.
Scrollbar * | vscroll

## Detailed Description

Window used for aligning sprites.

Definition at line 805 of file newgrf_debug_gui.cpp.

## Member Function Documentation

virtual void SpriteAlignerWindow::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 850 of file newgrf_debug_gui.cpp.

References current_sprite, DrawSprite(), DrawString(), Scrollbar::GetCapacity(), Scrollbar::GetPosition(), Sprite::height, Window::height, SmallVector< T, S >::Length(), max(), NWidgetBase::resize_y, SA_FORCE, SA_RIGHT, SetDParam(), NewGrfDebugSpritePicker::sprites, ST_NORMAL, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WID_SA_LIST, WID_SA_SPRITE, Sprite::width, Sprite::x_offs, Sprite::y_offs, and ZOOM_LVL_GUI.

virtual void SpriteAlignerWindow::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 891 of file newgrf_debug_gui.cpp.

References CS_NUMERAL, current_sprite, GetMaxSpriteID(), Scrollbar::GetPosition(), GetSpriteType(), SmallVector< T, S >::Length(), Window::LowerWidget(), MarkWholeScreenDirty(), NewGrfDebugSpritePicker::mode, NWidgetBase::pos_y, NWidgetBase::resize_y, Window::SetDirty(), ShowQueryString(), NewGrfDebugSpritePicker::sprites, ST_NORMAL, WID_SA_DOWN, WID_SA_GOTO, WID_SA_LEFT, WID_SA_LIST, WID_SA_NEXT, WID_SA_PICKER, WID_SA_PREVIOUS, WID_SA_RIGHT, WID_SA_UP, Sprite::x_offs, and Sprite::y_offs.

virtual void SpriteAlignerWindow::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 980 of file newgrf_debug_gui.cpp.

References SmallVector< T, S >::Length(), Window::RaiseWidget(), Scrollbar::SetCount(), NewGrfDebugSpritePicker::sprites, and WID_SA_PICKER.

virtual void SpriteAlignerWindow::OnQueryTextFinished | ( | char * | str | ) | `[inline, virtual]`

The query window opened from this window has closed.

Parameters:

  | str | the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str).

Reimplemented from Window.

Definition at line 963 of file newgrf_debug_gui.cpp.

References current_sprite, GetMaxSpriteID(), GetSpriteType(), Window::SetDirty(), ST_NORMAL, and StrEmpty().

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

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 990 of file newgrf_debug_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), and WID_SA_LIST.

virtual void SpriteAlignerWindow::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 819 of file newgrf_debug_gui.cpp.

References current_sprite, FioGetFilename(), GetOriginFileSlot(), SetDParam(), SetDParamStr(), ST_NORMAL, WID_SA_CAPTION, WID_SA_OFFSETS, Sprite::x_offs, and Sprite::y_offs.

virtual void SpriteAlignerWindow::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 839 of file newgrf_debug_gui.cpp.

References FONT_HEIGHT_NORMAL, max(), and WID_SA_LIST.

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

- src/newgrf_debug_gui.cpp