OpenTTD Source 20241224-master-gee860a5c8e
ObjectPickerCallbacks Class Reference
Inheritance diagram for ObjectPickerCallbacks:
PickerCallbacksNewGRFClass< ObjectClass > PickerCallbacks

Public Member Functions

StringID GetClassTooltip () const override
 Get the tooltip string for the class list.
 
StringID GetTypeTooltip () const override
 Get the tooltip string for the type grid.
 
bool IsActive () const override
 Should picker class/type selection be enabled?
 
int GetSelectedClass () const override
 Get the index of the selected class.
 
void SetSelectedClass (int id) const override
 Set the selected class.
 
StringID GetClassName (int id) const override
 Get the name of a class.
 
int GetSelectedType () const override
 Get the selected type.
 
void SetSelectedType (int id) const override
 Set the selected type.
 
StringID GetTypeName (int cls_id, int id) const override
 Get the item of a type.
 
bool IsTypeAvailable (int cls_id, int id) const override
 Test if an item is currently buildable.
 
void DrawType (int x, int y, int cls_id, int id) const override
 Draw preview image of an item.
 
void FillUsedItems (std::set< PickerItem > &items) override
 Fill a set with all items that are used by the current player.
 
- Public Member Functions inherited from PickerCallbacksNewGRFClass< ObjectClass >
 PickerCallbacksNewGRFClass (const std::string &ini_group)
 
T::index_type GetClassIndex (int cls_id) const
 
const ObjectClassGetClass (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)
 

Static Public Attributes

static ObjectPickerCallbacks instance
 

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

Definition at line 44 of file object_gui.cpp.

Constructor & Destructor Documentation

◆ ObjectPickerCallbacks()

ObjectPickerCallbacks::ObjectPickerCallbacks ( )
inline

Definition at line 46 of file object_gui.cpp.

Member Function Documentation

◆ DrawType()

void ObjectPickerCallbacks::DrawType ( int  x,
int  y,
int  cls_id,
int  id 
) const
inlineoverridevirtual

Draw preview image of an item.

Implements PickerCallbacks.

Definition at line 86 of file object_gui.cpp.

References _object_gui, DrawNewObjectTileInGUI(), DrawOrigTileSeqInGUI(), and ObjectPickerSelection::sel_view.

◆ FillUsedItems()

void ObjectPickerCallbacks::FillUsedItems ( std::set< PickerItem > &  items)
inlineoverridevirtual

◆ GetClassName()

StringID ObjectPickerCallbacks::GetClassName ( int  id) const
inlineoverridevirtual

Get the name of a class.

Implements PickerCallbacks.

Definition at line 64 of file object_gui.cpp.

References INVALID_STRING_ID.

◆ GetClassTooltip()

StringID ObjectPickerCallbacks::GetClassTooltip ( ) const
inlineoverridevirtual

Get the tooltip string for the class list.

Implements PickerCallbacks.

Definition at line 48 of file object_gui.cpp.

◆ GetSelectedClass()

int ObjectPickerCallbacks::GetSelectedClass ( ) const
inlineoverridevirtual

Get the index of the selected class.

Implements PickerCallbacks.

Definition at line 61 of file object_gui.cpp.

References _object_gui, and ObjectPickerSelection::sel_class.

◆ GetSelectedType()

int ObjectPickerCallbacks::GetSelectedType ( ) const
inlineoverridevirtual

Get the selected type.

Implements PickerCallbacks.

Definition at line 71 of file object_gui.cpp.

References _object_gui, and ObjectPickerSelection::sel_type.

◆ GetTypeName()

StringID ObjectPickerCallbacks::GetTypeName ( int  cls_id,
int  id 
) const
inlineoverridevirtual

Get the item of a type.

Implements PickerCallbacks.

Definition at line 74 of file object_gui.cpp.

References INVALID_STRING_ID.

◆ GetTypeTooltip()

StringID ObjectPickerCallbacks::GetTypeTooltip ( ) const
inlineoverridevirtual

Get the tooltip string for the type grid.

Implements PickerCallbacks.

Definition at line 49 of file object_gui.cpp.

◆ IsActive()

bool ObjectPickerCallbacks::IsActive ( ) const
inlineoverridevirtual

Should picker class/type selection be enabled?

Implements PickerCallbacks.

Definition at line 51 of file object_gui.cpp.

References NewGRFClass< Tspec, Tindex, Tmax >::Classes().

◆ IsTypeAvailable()

bool ObjectPickerCallbacks::IsTypeAvailable ( int  cls_id,
int  id 
) const
inlineoverridevirtual

Test if an item is currently buildable.

Implements PickerCallbacks.

Definition at line 80 of file object_gui.cpp.

◆ SetSelectedClass()

void ObjectPickerCallbacks::SetSelectedClass ( int  id) const
inlineoverridevirtual

Set the selected class.

Implements PickerCallbacks.

Definition at line 62 of file object_gui.cpp.

References _object_gui, and ObjectPickerSelection::sel_class.

◆ SetSelectedType()

void ObjectPickerCallbacks::SetSelectedType ( int  id) const
inlineoverridevirtual

Set the selected type.

Implements PickerCallbacks.

Definition at line 72 of file object_gui.cpp.

References _object_gui, and ObjectPickerSelection::sel_type.

Field Documentation

◆ instance

ObjectPickerCallbacks ObjectPickerCallbacks::instance
static

Definition at line 108 of file object_gui.cpp.


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