OpenTTD Source 20241224-master-gf74b0cf984
PickerCallbacksNewGRFClass< T > Class Template Reference

Helper for PickerCallbacks when the class system is based on NewGRFClass. More...

#include <picker_gui.h>

Inheritance diagram for PickerCallbacksNewGRFClass< T >:
PickerCallbacks

Public Member Functions

 PickerCallbacksNewGRFClass (const std::string &ini_group)
 
T::index_type GetClassIndex (int cls_id) const
 
const T * GetClass (int cls_id) const
 
const T::spec_type * GetSpec (int cls_id, int id) const
 
bool HasClassChoice () const override
 Are there multiple classes to chose from?
 
int GetClassCount () const override
 Get the number of classes.
 
int GetTypeCount (int cls_id) const override
 Get the number of types in a class.
 
PickerItem GetPickerItem (const typename T::spec_type *spec, int cls_id=-1, int id=-1) const
 
PickerItem GetPickerItem (int cls_id, int id) const override
 Get data about an item.
 
std::set< PickerItemUpdateSavedItems (const std::set< PickerItem > &src) override
 Update link between grfid/localidx and class_index/index in saved items.
 
- Public Member Functions inherited from PickerCallbacks
 PickerCallbacks (const std::string &ini_group)
 
virtual void Close (int)
 
virtual bool IsActive () const =0
 Should picker class/type selection be enabled?
 
virtual StringID GetClassTooltip () const =0
 Get the tooltip string for the class list.
 
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 GetSelectedType () const =0
 Get the selected type.
 
virtual void SetSelectedType (int id) const =0
 Set the selected type.
 
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.
 

Additional Inherited Members

- Data Fields inherited from PickerCallbacks
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

template<typename T>
class PickerCallbacksNewGRFClass< T >

Helper for PickerCallbacks when the class system is based on NewGRFClass.

Definition at line 100 of file picker_gui.h.

Constructor & Destructor Documentation

◆ PickerCallbacksNewGRFClass()

template<typename T >
PickerCallbacksNewGRFClass< T >::PickerCallbacksNewGRFClass ( const std::string &  ini_group)
inlineexplicit

Definition at line 102 of file picker_gui.h.

Member Function Documentation

◆ GetClass()

template<typename T >
const T * PickerCallbacksNewGRFClass< T >::GetClass ( int  cls_id) const
inline

Definition at line 105 of file picker_gui.h.

◆ GetClassCount()

template<typename T >
int PickerCallbacksNewGRFClass< T >::GetClassCount ( ) const
inlineoverridevirtual

Get the number of classes.

Note
Used only to estimate space requirements.

Implements PickerCallbacks.

Definition at line 110 of file picker_gui.h.

◆ GetClassIndex()

template<typename T >
T::index_type PickerCallbacksNewGRFClass< T >::GetClassIndex ( int  cls_id) const
inline

Definition at line 104 of file picker_gui.h.

◆ GetPickerItem() [1/2]

template<typename T >
PickerItem PickerCallbacksNewGRFClass< T >::GetPickerItem ( const typename T::spec_type *  spec,
int  cls_id = -1,
int  id = -1 
) const
inline

Definition at line 113 of file picker_gui.h.

◆ GetPickerItem() [2/2]

template<typename T >
PickerItem PickerCallbacksNewGRFClass< T >::GetPickerItem ( int  cls_id,
int  id 
) const
inlineoverridevirtual

Get data about an item.

Implements PickerCallbacks.

Definition at line 119 of file picker_gui.h.

◆ GetSpec()

template<typename T >
const T::spec_type * PickerCallbacksNewGRFClass< T >::GetSpec ( int  cls_id,
int  id 
) const
inline

Definition at line 106 of file picker_gui.h.

◆ GetTypeCount()

template<typename T >
int PickerCallbacksNewGRFClass< T >::GetTypeCount ( int  cls_id) const
inlineoverridevirtual

Get the number of types in a class.

Note
Used only to estimate space requirements.

Implements PickerCallbacks.

Definition at line 111 of file picker_gui.h.

◆ HasClassChoice()

template<typename T >
bool PickerCallbacksNewGRFClass< T >::HasClassChoice ( ) const
inlineoverridevirtual

Are there multiple classes to chose from?

Implements PickerCallbacks.

Reimplemented in StationPickerCallbacks, WaypointPickerCallbacks, RoadStopPickerCallbacks< roadstoptype >, and RoadWaypointPickerCallbacks.

Definition at line 108 of file picker_gui.h.

◆ UpdateSavedItems()

template<typename T >
std::set< PickerItem > PickerCallbacksNewGRFClass< T >::UpdateSavedItems ( const std::set< PickerItem > &  src)
inlineoverridevirtual

Update link between grfid/localidx and class_index/index in saved items.

Implements PickerCallbacks.

Definition at line 124 of file picker_gui.h.


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