|
OpenTTD Source 20260129-master-g2bb01bd0e4
|
File for dealing with picker windows. More...
#include "stdafx.h"#include "core/backup_type.hpp"#include "company_func.h"#include "dropdown_func.h"#include "gui.h"#include "hotkeys.h"#include "ini_type.h"#include "newgrf_badge.h"#include "newgrf_badge_config.h"#include "newgrf_badge_gui.h"#include "picker_gui.h"#include "querystring_gui.h"#include "settings_type.h"#include "sortlist_type.h"#include "sound_func.h"#include "sound_type.h"#include "string_func.h"#include "stringfilter_type.h"#include "strings_func.h"#include "widget_type.h"#include "window_func.h"#include "window_gui.h"#include "window_type.h"#include "zoom_func.h"#include "widgets/picker_widget.h"#include "table/sprites.h"#include "table/strings.h"#include <charconv>#include "safeguards.h"Go to the source code of this file.
Functions | |
| static std::vector< PickerCallbacks * > & | GetPickerCallbacks () |
| static void | PickerLoadConfig (const IniFile &ini, PickerCallbacks &callbacks) |
| Load favourites of a picker from config. | |
| static void | PickerSaveConfig (IniFile &ini, const PickerCallbacks &callbacks) |
| Save favourites of a picker to config. | |
| void | PickerLoadConfig (const IniFile &ini) |
| Load favourites of all registered Pickers from config. | |
| void | PickerSaveConfig (IniFile &ini) |
| Save favourites of all registered Pickers to config. | |
| static bool | ClassIDSorter (int const &a, int const &b) |
| Sort classes by id. | |
| static bool | ClassTagNameFilter (int const *item, PickerFilterData &filter) |
| Filter classes by class name. | |
| static bool | TypeIDSorter (PickerItem const &a, PickerItem const &b) |
| Sort types by id. | |
| static bool | TypeTagNameFilter (PickerItem const *item, PickerFilterData &filter) |
| Filter types by class name. | |
| static bool | CollectionIDSorter (std::string const &a, std::string const &b) |
| Sort collections by id. | |
| std::unique_ptr< NWidgetBase > | MakePickerClassWidgets () |
| Create nested widgets for the class picker widgets. | |
| std::unique_ptr< NWidgetBase > | MakePickerTypeWidgets () |
| Create nested widgets for the type picker widgets. | |
| void | InvalidateAllPickerWindows () |
Variables | |
| PickerWindow * | picker_window |
| Allow the collection sorter to test if the collection has inactive items. | |
| static const std::initializer_list< PickerClassList::SortFunction *const > | _class_sorter_funcs = { &ClassIDSorter } |
| Sort functions of the PickerClassList. | |
| static const std::initializer_list< PickerClassList::FilterFunction *const > | _class_filter_funcs = { &ClassTagNameFilter } |
| Filter functions of the PickerClassList. | |
| static const std::initializer_list< PickerTypeList::SortFunction *const > | _type_sorter_funcs = { TypeIDSorter } |
| Sort functions of the PickerTypeList. | |
| static const std::initializer_list< PickerTypeList::FilterFunction *const > | _type_filter_funcs = { TypeTagNameFilter } |
| Filter functions of the PickerTypeList. | |
| static const std::initializer_list< PickerCollectionList::SortFunction *const > | _collection_sorter_funcs = { &CollectionIDSorter } |
| Sort functions of the PickerCollectionList. | |
File for dealing with picker windows.
Definition in file picker_gui.cpp.
|
static |
Sort classes by id.
Definition at line 146 of file picker_gui.cpp.
|
static |
Filter classes by class name.
Definition at line 152 of file picker_gui.cpp.
References PickerFilterData::callbacks, PickerCallbacks::GetClassName(), StringFilter::GetState(), GetString(), and StringFilter::ResetState().
|
static |
Sort collections by id.
| a | First string for sorting. |
| b | Second string for sorting. |
Definition at line 188 of file picker_gui.cpp.
References GetString(), PickerWindow::inactive, picker_window, and StrNaturalCompare().
|
static |
Definition at line 44 of file picker_gui.cpp.
| void InvalidateAllPickerWindows | ( | ) |
Definition at line 1014 of file picker_gui.cpp.
| std::unique_ptr< NWidgetBase > MakePickerClassWidgets | ( | ) |
Create nested widgets for the class picker widgets.
Definition at line 937 of file picker_gui.cpp.
References EndContainer(), EqualSize, MakeNWidgets(), NWID_HORIZONTAL, NWID_SELECTION, NWID_VERTICAL, NWID_VSCROLLBAR, NWidget(), SetFill(), SetMatrixDataTip(), SetMinimalSize(), SetPadding(), SetResize(), SetScrollbar(), SetStringTip(), SetToolTip(), WidgetDimensions::unscaled, WID_PW_CLASS_FILTER, WID_PW_CLASS_LIST, WID_PW_CLASS_SCROLL, WID_PW_CLASS_SEL, WID_PW_COLEC_ADD, WID_PW_COLEC_DELETE, WID_PW_COLEC_LIST, WID_PW_COLEC_RENAME, WWT_DROPDOWN, WWT_EDITBOX, WWT_MATRIX, WWT_PANEL, and WWT_PUSHTXTBTN.
| std::unique_ptr< NWidgetBase > MakePickerTypeWidgets | ( | ) |
Create nested widgets for the type picker widgets.
Definition at line 972 of file picker_gui.cpp.
References EndContainer(), EqualSize, MakeNWidgets(), NWID_HORIZONTAL, NWID_MATRIX, NWID_SELECTION, NWID_VERTICAL, NWID_VSCROLLBAR, NWidget(), SetAspect(), SetFill(), SetMinimalTextLines(), SetPadding(), SetPIP(), SetResize(), SetScrollbar(), SetSpriteTip(), SetStringTip(), WidgetDimensions::unscaled, WID_PW_BADGE_FILTER, WID_PW_CONFIGURE_BADGES, WID_PW_EXPAND, WID_PW_MODE_ALL, WID_PW_MODE_SAVED, WID_PW_MODE_USED, WID_PW_SHRINK, WID_PW_TYPE_FILTER, WID_PW_TYPE_ITEM, WID_PW_TYPE_MATRIX, WID_PW_TYPE_NAME, WID_PW_TYPE_RESIZE, WID_PW_TYPE_SCROLL, WID_PW_TYPE_SEL, WWT_EDITBOX, WWT_EMPTY, WWT_IMGBTN, WWT_PANEL, WWT_PUSHTXTBTN, WWT_RESIZEBOX, and WWT_TEXTBTN.
| void PickerLoadConfig | ( | const IniFile & | ini | ) |
Load favourites of all registered Pickers from config.
| ini | IniFile to load to. |
Definition at line 131 of file picker_gui.cpp.
References PickerLoadConfig().
Referenced by LoadFromConfig().
|
static |
Load favourites of a picker from config.
| ini | IniFile to load to. |
| callbacks | Picker to load. |
Definition at line 66 of file picker_gui.cpp.
References ConvertHexToBytes(), IniLoadFile::groups, PickerCallbacks::ini_group, and PickerCallbacks::saved.
Referenced by PickerLoadConfig().
| void PickerSaveConfig | ( | IniFile & | ini | ) |
Save favourites of all registered Pickers to config.
| ini | IniFile to save to. |
Definition at line 140 of file picker_gui.cpp.
References PickerSaveConfig().
Referenced by SaveToConfig().
|
static |
Save favourites of a picker to config.
| ini | IniFile to save to. |
| callbacks | Picker to save. |
Definition at line 110 of file picker_gui.cpp.
References IniGroup::Clear(), IniGroup::CreateItem(), IniLoadFile::GetOrCreateGroup(), PickerCallbacks::ini_group, IniLoadFile::RemoveGroup(), PickerCallbacks::rm_collections, and PickerCallbacks::saved.
Referenced by PickerSaveConfig().
|
static |
Sort types by id.
Definition at line 160 of file picker_gui.cpp.
|
static |
Filter types by class name.
Definition at line 168 of file picker_gui.cpp.
References PickerFilterData::callbacks, StringFilter::GetState(), GetString(), PickerCallbacks::GetTypeBadges(), PickerCallbacks::GetTypeName(), and StringFilter::ResetState().
|
static |
Filter functions of the PickerClassList.
Definition at line 196 of file picker_gui.cpp.
|
static |
Sort functions of the PickerClassList.
Definition at line 195 of file picker_gui.cpp.
|
static |
Sort functions of the PickerCollectionList.
Definition at line 199 of file picker_gui.cpp.
|
static |
Filter functions of the PickerTypeList.
Definition at line 198 of file picker_gui.cpp.
|
static |
Sort functions of the PickerTypeList.
Definition at line 197 of file picker_gui.cpp.
| PickerWindow* picker_window |
Allow the collection sorter to test if the collection has inactive items.
Definition at line 180 of file picker_gui.cpp.
Referenced by CollectionIDSorter(), and PickerWindow::OnQueryTextFinished().