NewGRFParametersWindow Struct Reference

Window for setting the parameters of a NewGRF. More...

Inheritance diagram for NewGRFParametersWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 NewGRFParametersWindow (const WindowDesc *desc, GRFConfig *c)
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 SetStringParameters (int widget) const
 Initialize string parameters for a widget.
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 OnResize ()
 Called after the window got resized.
virtual void OnInvalidateData (int data=0, bool gui_scope=true)
 Some data on this window has become invalid.
virtual void OnTick ()
 Called once per (game) tick.

Static Public Member Functions

static GRFParameterInfoGetDummyParameterInfo (uint nr)
 Get a dummy parameter-info object with default information.

Data Fields

GRFConfiggrf_config
 Set the parameters of this GRFConfig.
uint clicked_button
 The row in which a button was clicked or UINT_MAX.
bool clicked_increase
 True if the increase button was clicked, false for the decrease button.
int timeout
 How long before we unpress the last-pressed button?
uint clicked_row
 The selected parameter.
int line_height
 Height of a row in the matrix widget.
Scrollbarvscroll
bool action14present
 True if action14 information is present.

Static Public Attributes

static GRFParameterInfo dummy_parameter_info
 Dummy info in case a newgrf didn't provide info about some parameter.

Detailed Description

Window for setting the parameters of a NewGRF.

Definition at line 150 of file newgrf_gui.cpp.


Member Function Documentation

virtual void NewGRFParametersWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]
static GRFParameterInfo* NewGRFParametersWindow::GetDummyParameterInfo ( uint  nr  )  [inline, static]

Get a dummy parameter-info object with default information.

Parameters:
nr The param number that should be changed.
Returns:
GRFParameterInfo with dummy information about the given parameter.

Definition at line 183 of file newgrf_gui.cpp.

References dummy_parameter_info, and GRFParameterInfo::param_nr.

Referenced by DrawWidget(), OnClick(), and OnQueryTextFinished().

virtual void NewGRFParametersWindow::OnClick ( Point  pt,
int  widget,
int  click_count 
) [inline, virtual]
virtual void NewGRFParametersWindow::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 387 of file newgrf_gui.cpp.

References action14present, clicked_row, Window::DeleteChildWindows(), Scrollbar::GetCount(), grf_config, GRFPAR_WIDGET_NUMPAR_DEC, GRFPAR_WIDGET_NUMPAR_INC, GRFConfig::num_params, GRFConfig::num_valid_params, Scrollbar::SetCount(), and Window::SetWidgetDisabledState().

virtual void NewGRFParametersWindow::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 364 of file newgrf_gui.cpp.

References clicked_row, GetDummyParameterInfo(), grf_config, SmallVector< T, S >::Length(), GRFParameterInfo::max_value, GRFParameterInfo::min_value, GRFConfig::param_info, Window::SetDirty(), GRFParameterInfo::SetValue(), and StrEmpty().

virtual void NewGRFParametersWindow::OnResize (  )  [inline, virtual]

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 375 of file newgrf_gui.cpp.

References NWidgetBase::current_y, Scrollbar::GetCapacity(), GRFPAR_WIDGET_BACKGROUND, MAT_COL_START, MAT_ROW_START, Scrollbar::SetCapacity(), and NWidgetCore::widget_data.

virtual void NewGRFParametersWindow::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 221 of file newgrf_gui.cpp.

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

virtual void NewGRFParametersWindow::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 189 of file newgrf_gui.cpp.

References FONT_HEIGHT_NORMAL, GB(), GetStringBoundingBox(), GRFPAR_WIDGET_BACKGROUND, GRFPAR_WIDGET_DESCRIPTION, GRFPAR_WIDGET_NUMPAR, GRFPAR_WIDGET_NUMPAR_DEC, GRFPAR_WIDGET_NUMPAR_INC, line_height, MAT_ROW_BITS, MAT_ROW_START, maxdim(), SetDParam(), WD_MATRIX_BOTTOM, WD_MATRIX_TOP, WD_TEXTPANEL_BOTTOM, and WD_TEXTPANEL_TOP.


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

Generated on Wed Apr 13 00:48:46 2011 for OpenTTD by  doxygen 1.6.1