Public Member Functions | |
NewGRFAddWindow (const WindowDesc *desc, Window *parent, GRFConfig **list) | |
virtual void | OnInvalidateData (int data) |
Some data on this window has become invalid. | |
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 | OnPaint () |
The window must be repainted. | |
virtual void | DrawWidget (const Rect &r, int widget) const |
Draw the contents of a nested widget. | |
virtual void | OnDoubleClick (Point pt, int widget) |
A double click with the left mouse button has been made on the window. | |
virtual void | OnClick (Point pt, int widget) |
A click with the left mouse button has been made on the window. | |
virtual void | OnMouseLoop () |
Called for every mouse loop run, which is at least once per (game) tick. | |
virtual EventState | OnKeyPress (uint16 key, uint16 keycode) |
A key has been pressed. | |
virtual void | OnOSKInput (int wid) |
Private Types | |
enum | { EDITBOX_MAX_SIZE = 50, EDITBOX_MAX_LENGTH = 300 } |
typedef GUIList< const GRFConfig * > | GUIGRFConfigList |
Private Member Functions | |
void | BuildGrfList () |
(Re)build the grf as its amount has changed because an item has been added or deleted for example | |
void | SortGrfList () |
Sort the grf list. | |
void | UpdateListPosition () |
Update selection position. | |
void | FilterGrfList () |
Filter the grf list. | |
void | ScrollToSelected () |
Make sure that the currently selected grf is within the visible part of the list. | |
Static Private Member Functions | |
static int CDECL | NameSorter (const GRFConfig *const *a, const GRFConfig *const *b) |
Sort grfs by name. | |
static bool CDECL | TagNameFilter (const GRFConfig *const *a, const char *filter_string) |
Filter grfs by tags/name. | |
Private Attributes | |
GRFConfig ** | list |
GUIGRFConfigList | grfs |
const GRFConfig * | sel |
int | sel_pos |
Static Private Attributes | |
static Listing | last_sorting = {false, 0} |
Runtime saved values. | |
static Filtering | last_filtering = {false, 0} |
static GUIGRFConfigList::SortFunction *const | sorter_funcs [] |
static GUIGRFConfigList::FilterFunction *const | filter_funcs [] |
Definition at line 157 of file newgrf_gui.cpp.
void NewGRFAddWindow::UpdateListPosition | ( | ) | [inline, private] |
Update selection position.
Definition at line 223 of file newgrf_gui.cpp.
References SmallVector< T, S >::FindIndex().
Referenced by FilterGrfList(), and SortGrfList().
virtual void NewGRFAddWindow::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 276 of file newgrf_gui.cpp.
References BuildGrfList(), GUIList< T, F >::ForceRebuild(), GRFConfig::IsOpenTTDBaseGRF(), and Window::SetWidgetDisabledState().
virtual void NewGRFAddWindow::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 290 of file newgrf_gui.cpp.
References FONT_HEIGHT_NORMAL, Dimension::height, max(), WD_FRAMERECT_BOTTOM, and WD_FRAMERECT_TOP.
virtual void NewGRFAddWindow::OnResize | ( | ) | [inline, virtual] |
Called after the window got resized.
For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
Reimplemented from Window.
Definition at line 304 of file newgrf_gui.cpp.
References Scrollbar::SetCapacityFromWidget(), and Window::vscroll.
virtual void NewGRFAddWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 309 of file newgrf_gui.cpp.
References Window::DrawWidgets().
virtual void NewGRFAddWindow::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 315 of file newgrf_gui.cpp.
References Rect::bottom, DrawString(), GRFConfig::filename, Scrollbar::GetCapacity(), Scrollbar::GetPosition(), GfxFillRect(), Rect::left, SmallVector< T, S >::Length(), min(), GRFConfig::name, Window::resize, Rect::right, ResizeInfo::step_height, StrEmpty(), Rect::top, Window::vscroll, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.
virtual void NewGRFAddWindow::OnDoubleClick | ( | Point | pt, | |
int | widget | |||
) | [inline, virtual] |
A double 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. |
Reimplemented from Window.
Definition at line 347 of file newgrf_gui.cpp.
References OnClick().
virtual void NewGRFAddWindow::OnClick | ( | Point | pt, | |
int | widget | |||
) | [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. |
Reimplemented from Window.
Definition at line 352 of file newgrf_gui.cpp.
References DeleteWindowByClass(), GRFConfig::filename, Scrollbar::GetPosition(), GRFIdentifier::grfid, GRFConfig::info, INVALID_STRING_ID, Window::InvalidateData(), InvalidateWindowData(), SmallVector< T, S >::Length(), GRFConfig::name, GRFConfig::next, Window::resize, ShowErrorMessage(), ResizeInfo::step_height, Window::vscroll, WD_FRAMERECT_TOP, and Point::y.
Referenced by OnDoubleClick().
virtual EventState NewGRFAddWindow::OnKeyPress | ( | uint16 | key, | |
uint16 | keycode | |||
) | [inline, virtual] |
A key has been pressed.
key | the Unicode value of the key. | |
keycode | the untranslated key code including shift state. |
Reimplemented from Window.
Definition at line 411 of file newgrf_gui.cpp.
References Window::ES_HANDLED, Window::ES_NOT_HANDLED, Scrollbar::GetCapacity(), Window::InvalidateData(), SmallVector< T, S >::Length(), min(), ScrollToSelected(), and Window::vscroll.
NewGRFAddWindow::GUIGRFConfigList::SortFunction *const NewGRFAddWindow::sorter_funcs [static, private] |
NewGRFAddWindow::GUIGRFConfigList::FilterFunction *const NewGRFAddWindow::filter_funcs [static, private] |