|
OpenTTD Source 20260129-master-g2bb01bd0e4
|
Class for PickerClassWindow to collect information and retain state. More...
#include <picker_gui.h>
Public Member Functions | |
| PickerCallbacks (const std::string &ini_group) | |
| virtual void | Close (int) |
| virtual GrfSpecFeature | GetFeature () const =0 |
| virtual bool | IsActive () const =0 |
| Should picker class/type selection be enabled? | |
| virtual bool | HasClassChoice () const =0 |
| Are there multiple classes to chose from? | |
| virtual StringID | GetClassTooltip () const =0 |
| Get the tooltip string for the class list. | |
| virtual int | GetClassCount () const =0 |
| Get the number of classes. | |
| virtual int | GetSelectedClass () const =0 |
| Get the index of the selected class. | |
| virtual void | SetSelectedClass (int id) const =0 |
| Set the selected class. | |
| virtual StringID | GetClassName (int id) const =0 |
| Get the name of a class. | |
| virtual StringID | GetTypeTooltip () const =0 |
| Get the tooltip string for the type grid. | |
| virtual int | GetTypeCount (int cls_id) const =0 |
| Get the number of types in a class. | |
| virtual int | GetSelectedType () const =0 |
| Get the selected type. | |
| virtual void | SetSelectedType (int id) const =0 |
| Set the selected type. | |
| virtual PickerItem | GetPickerItem (int cls_id, int id) const =0 |
| Get data about an item. | |
| virtual StringID | GetTypeName (int cls_id, int id) const =0 |
| Get the item of a type. | |
| virtual std::span< const BadgeID > | GetTypeBadges (int cls_id, int id) const =0 |
| Get the item of a type. | |
| virtual bool | IsTypeAvailable (int cls_id, int id) const =0 |
| Test if an item is currently buildable. | |
| virtual void | DrawType (int x, int y, int cls_id, int id) const =0 |
| Draw preview image of an item. | |
| virtual StringID | GetCollectionTooltip () const =0 |
| Get the tooltip string for the collection list. | |
| virtual void | FillUsedItems (std::set< PickerItem > &items)=0 |
| Fill a set with all items that are used by the current player. | |
| virtual std::map< std::string, std::set< PickerItem > > | UpdateSavedItems (const std::map< std::string, std::set< PickerItem > > &src)=0 |
| Update link between grfid/localidx and class_index/index in saved items. | |
| std::set< std::string > | InitializeInactiveCollections (const std::map< std::string, std::set< PickerItem > > collections) |
| Initialize the list of active collections for sorting purposes. | |
Data Fields | |
| Listing | class_last_sorting = { false, 0 } |
| Default sorting of PickerClassList. | |
| Filtering | class_last_filtering = { false, 0 } |
| Default filtering of PickerClassList. | |
| Listing | type_last_sorting = { false, 0 } |
| Default sorting of PickerTypeList. | |
| Filtering | type_last_filtering = { false, 0 } |
| Default filtering of PickerTypeList. | |
| Listing | collection_last_sorting = { false, 0 } |
| Default sorting of PickerCollectionList. | |
| const std::string | ini_group |
| Ini Group for saving favourites. | |
| uint8_t | mode = 0 |
Bitmask of PickerFilterModes. | |
| bool | rename_collection = false |
| Are we renaming a collection? | |
| std::string | sel_collection |
| Currently selected collection of saved items. | |
| std::string | edit_collection |
| Collection to rename or delete. | |
| std::set< std::string > | rm_collections |
| Set of removed or renamed collections for updating ini file. | |
| int | preview_height = 0 |
| Previously adjusted height. | |
| std::set< PickerItem > | used |
| Set of items used in the current game by the current company. | |
| std::map< std::string, std::set< PickerItem > > | saved |
| Set of saved collections of items. | |
Class for PickerClassWindow to collect information and retain state.
Definition at line 39 of file picker_gui.h.
|
explicit |
Definition at line 50 of file picker_gui.cpp.
|
virtual |
Definition at line 55 of file picker_gui.cpp.
|
inlinevirtual |
Definition at line 44 of file picker_gui.h.
|
pure virtual |
Draw preview image of an item.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
Referenced by PickerWindow::DrawWidget().
|
pure virtual |
Fill a set with all items that are used by the current player.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
|
pure virtual |
Get the number of classes.
Implemented in PickerCallbacksNewGRFClass< T >, PickerCallbacksNewGRFClass< ObjectClass >, PickerCallbacksNewGRFClass< RoadStopClass >, PickerCallbacksNewGRFClass< StationClass >, and HousePickerCallbacks.
Referenced by PickerWindow::BuildPickerClassList(), and PickerWindow::BuildPickerTypeList().
|
pure virtual |
Get the name of a class.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
Referenced by PickerWindow::BuildPickerClassList(), ClassTagNameFilter(), and PickerWindow::DrawWidget().
|
pure virtual |
Get the tooltip string for the class list.
Implemented in RoadStopPickerCallbacks< roadstoptype >, RoadStopPickerCallbacks< roadstoptype >, ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
|
pure virtual |
Get the tooltip string for the collection list.
Implemented in RoadStopPickerCallbacks< roadstoptype >, RoadStopPickerCallbacks< roadstoptype >, ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
|
pure virtual |
Get data about an item.
Implemented in PickerCallbacksNewGRFClass< T >, PickerCallbacksNewGRFClass< ObjectClass >, PickerCallbacksNewGRFClass< RoadStopClass >, PickerCallbacksNewGRFClass< StationClass >, and HousePickerCallbacks.
Referenced by PickerWindow::BuildPickerTypeList().
|
pure virtual |
Get the index of the selected class.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
Referenced by PickerWindow::BuildPickerTypeList(), PickerWindow::DrawWidget(), and PickerWindow::OnClick().
|
pure virtual |
Get the selected type.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
|
pure virtual |
Get the item of a type.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
Referenced by PickerWindow::DrawWidget(), and TypeTagNameFilter().
|
pure virtual |
Get the number of types in a class.
Implemented in PickerCallbacksNewGRFClass< T >, PickerCallbacksNewGRFClass< ObjectClass >, PickerCallbacksNewGRFClass< RoadStopClass >, PickerCallbacksNewGRFClass< StationClass >, and HousePickerCallbacks.
Referenced by PickerWindow::BuildPickerTypeList().
|
pure virtual |
Get the item of a type.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
Referenced by PickerWindow::BuildPickerTypeList(), PickerWindow::DrawWidget(), InitializeInactiveCollections(), and TypeTagNameFilter().
|
pure virtual |
Get the tooltip string for the type grid.
Implemented in RoadStopPickerCallbacks< roadstoptype >, RoadStopPickerCallbacks< roadstoptype >, ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
|
pure virtual |
Are there multiple classes to chose from?
Implemented in PickerCallbacksNewGRFClass< T >, PickerCallbacksNewGRFClass< ObjectClass >, PickerCallbacksNewGRFClass< RoadStopClass >, PickerCallbacksNewGRFClass< StationClass >, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
|
inline |
Initialize the list of active collections for sorting purposes.
| collections | The map of collections to check. |
Definition at line 97 of file picker_gui.h.
References GetTypeName(), and INVALID_STRING_ID.
|
pure virtual |
Should picker class/type selection be enabled?
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
|
pure virtual |
Test if an item is currently buildable.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
Referenced by PickerWindow::DrawWidget(), and PickerWindow::OnClick().
|
pure virtual |
Set the selected class.
Implemented in HousePickerCallbacks, ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, and RoadWaypointPickerCallbacks.
Referenced by PickerWindow::OnClick().
|
pure virtual |
Set the selected type.
Implemented in ObjectPickerCallbacks, StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, RoadWaypointPickerCallbacks, and HousePickerCallbacks.
Referenced by PickerWindow::OnClick().
|
pure virtual |
Update link between grfid/localidx and class_index/index in saved items.
Implemented in PickerCallbacksNewGRFClass< T >, PickerCallbacksNewGRFClass< ObjectClass >, PickerCallbacksNewGRFClass< RoadStopClass >, PickerCallbacksNewGRFClass< StationClass >, and HousePickerCallbacks.
| Filtering PickerCallbacks::class_last_filtering = { false, 0 } |
Default filtering of PickerClassList.
Definition at line 118 of file picker_gui.h.
| Listing PickerCallbacks::class_last_sorting = { false, 0 } |
Default sorting of PickerClassList.
Definition at line 117 of file picker_gui.h.
| Listing PickerCallbacks::collection_last_sorting = { false, 0 } |
Default sorting of PickerCollectionList.
Definition at line 123 of file picker_gui.h.
| std::string PickerCallbacks::edit_collection |
Collection to rename or delete.
Definition at line 129 of file picker_gui.h.
Referenced by PickerWindow::OnClick(), and PickerWindow::OnQueryTextFinished().
| const std::string PickerCallbacks::ini_group |
Ini Group for saving favourites.
Definition at line 125 of file picker_gui.h.
Referenced by PickerLoadConfig(), and PickerSaveConfig().
| uint8_t PickerCallbacks::mode = 0 |
Bitmask of PickerFilterModes.
Definition at line 126 of file picker_gui.h.
Referenced by PickerWindow::BuildPickerClassList(), PickerWindow::BuildPickerTypeList(), PickerWindow::OnClick(), and PickerWindow::OnInvalidateData().
| int PickerCallbacks::preview_height = 0 |
Previously adjusted height.
Definition at line 132 of file picker_gui.h.
Referenced by PickerWindow::OnClick().
| bool PickerCallbacks::rename_collection = false |
Are we renaming a collection?
Definition at line 127 of file picker_gui.h.
Referenced by PickerWindow::OnClick().
| std::set<std::string> PickerCallbacks::rm_collections |
Set of removed or renamed collections for updating ini file.
Definition at line 130 of file picker_gui.h.
Referenced by PickerWindow::OnQueryTextFinished(), and PickerSaveConfig().
| std::map<std::string, std::set<PickerItem> > PickerCallbacks::saved |
Set of saved collections of items.
Definition at line 135 of file picker_gui.h.
Referenced by PickerWindow::BuildPickerClassList(), PickerWindow::BuildPickerCollectionList(), PickerWindow::BuildPickerTypeList(), PickerWindow::DrawWidget(), PickerWindow::OnClick(), PickerWindow::OnQueryTextFinished(), PickerLoadConfig(), and PickerSaveConfig().
| std::string PickerCallbacks::sel_collection |
Currently selected collection of saved items.
Definition at line 128 of file picker_gui.h.
Referenced by PickerWindow::BuildPickerTypeList(), PickerWindow::GetWidgetString(), PickerWindow::OnClick(), PickerWindow::OnDropdownSelect(), and PickerWindow::OnQueryTextFinished().
| Filtering PickerCallbacks::type_last_filtering = { false, 0 } |
Default filtering of PickerTypeList.
Definition at line 121 of file picker_gui.h.
| Listing PickerCallbacks::type_last_sorting = { false, 0 } |
Default sorting of PickerTypeList.
Definition at line 120 of file picker_gui.h.
| std::set<PickerItem> PickerCallbacks::used |
Set of items used in the current game by the current company.
Definition at line 134 of file picker_gui.h.
Referenced by PickerWindow::BuildPickerClassList(), PickerWindow::BuildPickerTypeList(), and PickerWindow::DrawWidget().