SpriteAlignerWindow Struct Reference

Window used for aligning sprites. More...

Inheritance diagram for SpriteAlignerWindow:
Window ZeroedMemoryAllocator

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=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.
Scrollbarvscroll

Detailed Description

Window used for aligning sprites.

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

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 691 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 = 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 780 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.

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 763 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 790 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.

Parameters:
widget Widget number.

Reimplemented from Window.

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

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 639 of file newgrf_debug_gui.cpp.

References FONT_HEIGHT_NORMAL, max(), and SAW_LIST.


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

Generated on Wed Apr 13 00:49:03 2011 for OpenTTD by  doxygen 1.6.1