Public Member Functions | |
NewGRFWindow (const WindowDesc *desc, bool editable, bool show_params, bool exec_changes, GRFConfig **config) | |
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 | OnResize () |
Called after the window got resized. | |
virtual void | SetStringParameters (int widget) const |
Initialize string parameters for a widget. | |
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 | OnClick (Point pt, int widget, int click_count) |
A click with the left mouse button has been made on the window. | |
virtual void | OnDropdownSelect (int widget, int index) |
A dropdown option associated to this window has been selected. | |
virtual void | OnQueryTextFinished (char *str) |
The query window opened from this window has closed. | |
virtual void | OnInvalidateData (int data=0) |
Some data on this window has become invalid. | |
Data Fields | |
GRFConfig ** | orig_list |
grf list the window is shown with | |
GRFConfig * | list |
temporary grf list to which changes are made | |
GRFConfig * | sel |
selected grf item | |
bool | editable |
is the window editable | |
bool | show_params |
are the grf-parameters shown in the info-panel | |
bool | execute |
on pressing 'apply changes' are grf changes applied immediately, or only list is updated | |
int | query_widget |
widget that opened a query | |
int | preset |
selected preset |
Definition at line 552 of file newgrf_gui.cpp.
virtual void NewGRFWindow::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 592 of file newgrf_gui.cpp.
References FONT_HEIGHT_NORMAL, GetStringBoundingBox(), Dimension::height, SmallVector< T, S >::Length(), max(), maxdim(), SetDParamStr(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, WD_MATRIX_BOTTOM, WD_MATRIX_TOP, and Dimension::width.
virtual void NewGRFWindow::OnResize | ( | ) | [inline, virtual] |
Called after the window got resized.
For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
Reimplemented from Window.
Definition at line 619 of file newgrf_gui.cpp.
References Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, Scrollbar::SetCapacityFromWidget(), and Window::vscroll.
virtual void NewGRFWindow::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 625 of file newgrf_gui.cpp.
References preset, SetDParam(), and SetDParamStr().
virtual void NewGRFWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 639 of file newgrf_gui.cpp.
References Window::DrawWidgets().
virtual void NewGRFWindow::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 644 of file newgrf_gui.cpp.
References _dynlang, Rect::bottom, DrawSprite(), DrawString(), GRFConfig::error, GRFConfig::filename, GRFConfig::flags, FONT_HEIGHT_NORMAL, GCF_COMPATIBLE, GCF_STATIC, GCS_ACTIVATED, GCS_DISABLED, GCS_NOT_FOUND, HasBit(), Scrollbar::IsVisible(), Rect::left, GRFConfig::name, GRFConfig::next, Window::resize, Rect::right, sel, GRFConfig::status, ResizeInfo::step_height, StrEmpty(), TD_RTL, DynamicLanguages::text_dir, Rect::top, Window::vscroll, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and WD_MATRIX_TOP.
virtual void NewGRFWindow::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 703 of file newgrf_gui.cpp.
References BSWAP32(), CopyGRFConfigList(), CS_ALPHANUMERAL, CS_NUMERAL_SPACE, Window::DeleteChildWindows(), DeleteWindowByClass(), execute, GRFConfig::filename, GRFConfig::flags, GamelogGetOriginalGRFMD5Checksum(), GCF_COMPATIBLE, GCS_NOT_FOUND, Scrollbar::GetPosition(), GRFIdentifier::grfid, HasBit(), INVALID_STRING_ID, Window::InvalidateData(), lastof, SmallVector< T, S >::Length(), lengthof, GRFIdentifier::md5sum, GRFConfig::name, NewGRFConfirmationCallback(), GRFConfig::next, orig_list, preset, query_widget, ReloadNewGRFData(), Window::resize, Scrollbar::ScrollTowards(), sel, Window::SetDirty(), SetDParamStr(), ShowDropDownList(), ShowErrorMessage(), ShowQuery(), ShowQueryString(), GRFConfig::status, ResizeInfo::step_height, ttd_strlcpy(), Window::vscroll, GRFConfig::windows_paletted, and Point::y.
virtual void NewGRFWindow::OnDropdownSelect | ( | int | widget, | |
int | index | |||
) | [inline, virtual] |
A dropdown option associated to this window has been selected.
widget | the widget (button) that the dropdown is associated with. | |
index | the element in the dropdown that is selected. |
Reimplemented from Window.
Definition at line 877 of file newgrf_gui.cpp.
References Window::InvalidateData(), preset, and sel.
virtual void NewGRFWindow::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 897 of file newgrf_gui.cpp.
References Window::InvalidateData(), SmallVector< T, S >::Length(), lengthof, GRFConfig::num_params, GRFConfig::param, parse_intlist(), preset, query_widget, and sel.
virtual void NewGRFWindow::OnInvalidateData | ( | int | data = 0 |
) | [inline, virtual] |
Some data on this window has become invalid.
data | information about the changed data. |
Reimplemented from Window.
Definition at line 933 of file newgrf_gui.cpp.
References Window::DisableWidget(), editable, GRFConfig::filename, GRFConfig::flags, GCF_COMPATIBLE, GCS_NOT_FOUND, GCS_UNKNOWN, Scrollbar::GetCapacity(), GRFIdentifier::grfid, HasBit(), GRFConfig::info, GRFConfig::IsOpenTTDBaseGRF(), MAT_COL_START, MAT_ROW_START, GRFIdentifier::md5sum, GRFConfig::name, GRFConfig::next, preset, sel, Scrollbar::SetCapacityFromWidget(), Scrollbar::SetCount(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), GRFConfig::status, Window::vscroll, and WIDGET_LIST_END.