![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
ImGui dropdown widget for selecting a ConditionPreset from the registry. More...
#include <PresetDropdownHelper.h>
Collaboration diagram for Olympe::PresetDropdownHelper:Public Member Functions | |
| PresetDropdownHelper (ConditionPresetRegistry ®istry) | |
| Constructs the dropdown helper bound to the preset registry. | |
| ~PresetDropdownHelper ()=default | |
| void | SetLabel (const std::string &label) |
| Sets the label displayed next to the dropdown. | |
| void | SetFilter (const std::string &filter) |
| Sets optional filter — only presets matching this substring are shown in the dropdown. | |
| void | ClearFilter () |
| Clears any active filter. | |
| bool | Render (std::string &selectedPresetID) |
| Renders the dropdown widget and handles selection. | |
| size_t | GetVisiblePresetCount () const |
| Returns the number of presets visible after filtering. | |
| std::string | GetPresetDisplayName (const std::string &presetID) const |
| Returns the display name of a preset, or empty if not found. | |
Private Attributes | |
| ConditionPresetRegistry & | m_registry |
| std::string | m_label |
| std::string | m_filter |
| bool | m_isOpen = false |
| int | m_hoveredIndex = -1 |
ImGui dropdown widget for selecting a ConditionPreset from the registry.
Definition at line 38 of file PresetDropdownHelper.h.
|
explicit |
Constructs the dropdown helper bound to the preset registry.
| registry | Global ConditionPresetRegistry (must outlive this helper). |
Definition at line 25 of file PresetDropdownHelper.cpp.
|
default |
|
inline |
Clears any active filter.
Definition at line 69 of file PresetDropdownHelper.h.
References m_filter.
| std::string Olympe::PresetDropdownHelper::GetPresetDisplayName | ( | const std::string & | presetID | ) | const |
Returns the display name of a preset, or empty if not found.
Definition at line 122 of file PresetDropdownHelper.cpp.
References GetComponentTypeID_Static(), Olympe::ConditionPresetRegistry::GetPreset(), m_registry, and Olympe::ConditionPreset::name.
Here is the call graph for this function:| size_t Olympe::PresetDropdownHelper::GetVisiblePresetCount | ( | ) | const |
Returns the number of presets visible after filtering.
Definition at line 116 of file PresetDropdownHelper.cpp.
References GetComponentTypeID_Static(), Olympe::ConditionPresetRegistry::GetFilteredPresets(), m_filter, and m_registry.
Here is the call graph for this function:| bool Olympe::PresetDropdownHelper::Render | ( | std::string & | selectedPresetID | ) |
Renders the dropdown widget and handles selection.
Must be called once per frame inside the ImGui render loop.
| [in,out] | selectedPresetID | Current selection; updated on user change. Pass empty string for "no selection". |
The dropdown displays presets filtered by m_filter and the registry's internal search state. Clicking a preset updates selectedPresetID and returns true.
Definition at line 35 of file PresetDropdownHelper.cpp.
References GetComponentTypeID_Static(), Olympe::ConditionPresetRegistry::GetFilteredPresets(), Olympe::ConditionPresetRegistry::GetPreset(), m_filter, m_label, m_registry, and Olympe::ConditionPreset::name.
Here is the call graph for this function:Sets optional filter — only presets matching this substring are shown in the dropdown.
| filter | Filter string (empty = no filter). |
Definition at line 64 of file PresetDropdownHelper.h.
References GetComponentTypeID_Static(), and m_filter.
Here is the call graph for this function:Sets the label displayed next to the dropdown.
| label | Display label (e.g. "Select Condition"). |
Definition at line 57 of file PresetDropdownHelper.h.
References m_label.
|
private |
Definition at line 109 of file PresetDropdownHelper.h.
Referenced by ClearFilter(), GetVisiblePresetCount(), Render(), and SetFilter().
|
private |
Definition at line 111 of file PresetDropdownHelper.h.
Definition at line 110 of file PresetDropdownHelper.h.
|
private |
Definition at line 108 of file PresetDropdownHelper.h.
Referenced by Render(), and SetLabel().
|
private |
Definition at line 107 of file PresetDropdownHelper.h.
Referenced by GetPresetDisplayName(), GetVisiblePresetCount(), and Render().