Window used for aligning sprites. More...
Public Member Functions | |
SpriteAlignerWindow (const 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) |
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 |
Window used for aligning sprites.
Definition at line 569 of file newgrf_debug_gui.cpp.
virtual void SpriteAlignerWindow::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 614 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, SAW_LIST, SAW_SPRITE, SetDParam(), NewGrfDebugSpritePicker::sprites, ST_NORMAL, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, Sprite::width, Window::width, Sprite::x_offs, and Sprite::y_offs.
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.
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 655 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, SAW_DOWN, SAW_GOTO, SAW_LEFT, SAW_LIST, SAW_NEXT, SAW_PICKER, SAW_PREVIOUS, SAW_RIGHT, SAW_UP, Window::SetDirty(), ShowQueryString(), NewGrfDebugSpritePicker::sprites, ST_NORMAL, Sprite::x_offs, and Sprite::y_offs.
virtual void SpriteAlignerWindow::OnInvalidateData | ( | int | data | ) | [inline, virtual] |
Some data on this window has become invalid.
data | information about the changed data. |
Reimplemented from Window.
Definition at line 739 of file newgrf_debug_gui.cpp.
References SmallVector< T, S >::Length(), Window::RaiseWidget(), SAW_PICKER, Scrollbar::SetCount(), and NewGrfDebugSpritePicker::sprites.
virtual void SpriteAlignerWindow::OnQueryTextFinished | ( | char * | str | ) | [inline, virtual] |
The query window opened from this window has closed.
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 727 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 748 of file newgrf_debug_gui.cpp.
References Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, SAW_LIST, and Scrollbar::SetCapacityFromWidget().
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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 583 of file newgrf_debug_gui.cpp.
References current_sprite, GetOriginFileSlot(), SAW_CAPTION, SAW_OFFSETS, SetDParam(), SetDParamStr(), ST_NORMAL, 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.
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 603 of file newgrf_debug_gui.cpp.
References FONT_HEIGHT_NORMAL, max(), and SAW_LIST.