OpenTTD Source  20240917-master-g9ab0a47812
PickerCallbacks Class Referenceabstract

Class for PickerClassWindow to collect information and retain state. More...

#include <picker_gui.h>

Inheritance diagram for PickerCallbacks:
HousePickerCallbacks PickerCallbacksNewGRFClass< T > PickerCallbacksNewGRFClass< ObjectClass > PickerCallbacksNewGRFClass< RoadStopClass > PickerCallbacksNewGRFClass< StationClass > ObjectPickerCallbacks RoadStopPickerCallbacks< roadstoptype > RoadWaypointPickerCallbacks StationPickerCallbacks WaypointPickerCallbacks

Public Member Functions

 PickerCallbacks (const std::string &ini_group)
 
virtual void Close (int)
 
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. More...
 
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. More...
 
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 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 void FillUsedItems (std::set< PickerItem > &items)=0
 Fill a set with all items that are used by the current player.
 
virtual std::set< PickerItemUpdateSavedItems (const std::set< PickerItem > &src)=0
 Update link between grfid/localidx and class_index/index in saved items.
 

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.
 
const std::string ini_group
 Ini Group for saving favourites.
 
uint8_t mode = 0
 Bitmask of PickerFilterModes.
 
std::set< PickerItemused
 Set of items used in the current game by the current company.
 
std::set< PickerItemsaved
 Set of saved favourite items.
 

Detailed Description

Class for PickerClassWindow to collect information and retain state.

Definition at line 37 of file picker_gui.h.

Member Function Documentation

◆ GetClassCount()

virtual int PickerCallbacks::GetClassCount ( ) const
pure virtual

Get the number of classes.

Note
Used only to estimate space requirements.

Implemented in HousePickerCallbacks, and PickerCallbacksNewGRFClass< T >.

Referenced by PickerWindow::BuildPickerClassList(), and PickerWindow::BuildPickerTypeList().

◆ GetTypeCount()

virtual int PickerCallbacks::GetTypeCount ( int  cls_id) const
pure virtual

The documentation for this class was generated from the following files: