yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::PaletteControlsPanel Class Reference

Panel for managing palettes applied to graphics sheets. More...

#include <palette_controls_panel.h>

Inheritance diagram for yaze::editor::PaletteControlsPanel:
Collaboration diagram for yaze::editor::PaletteControlsPanel:

Public Member Functions

 PaletteControlsPanel (GraphicsEditorState *state, Rom *rom, zelda3::GameData *game_data=nullptr)
 
void SetGameData (zelda3::GameData *game_data)
 
std::string GetId () const override
 Unique identifier for this panel.
 
std::string GetDisplayName () const override
 Human-readable name shown in menus and title bars.
 
std::string GetIcon () const override
 Material Design icon for this panel.
 
std::string GetEditorCategory () const override
 Editor category this panel belongs to.
 
int GetPriority () const override
 Get display priority for menu ordering.
 
void Initialize ()
 Initialize the panel.
 
void Draw (bool *p_open) override
 Draw the palette controls UI (EditorPanel interface)
 
absl::Status Update ()
 Legacy Update method for backward compatibility.
 
- Public Member Functions inherited from yaze::editor::EditorPanel
virtual ~EditorPanel ()=default
 
virtual void OnFirstDraw ()
 Called once before the first Draw() in a session.
 
virtual bool RequiresLazyInit () const
 Whether this panel uses lazy initialization.
 
void InvalidateLazyInit ()
 Reset lazy init state so OnFirstDraw() runs again.
 
virtual void OnOpen ()
 Called when panel becomes visible.
 
virtual void OnClose ()
 Called when panel is hidden.
 
virtual void OnFocus ()
 Called when panel receives focus.
 
virtual PanelCategory GetPanelCategory () const
 Get the lifecycle category for this panel.
 
virtual PanelContextScope GetContextScope () const
 Optional context binding for this panel (room/selection/etc)
 
virtual PanelScope GetScope () const
 Get the registration scope for this panel.
 
virtual bool IsEnabled () const
 Check if this panel is currently enabled.
 
virtual std::string GetDisabledTooltip () const
 Get tooltip text when panel is disabled.
 
virtual std::string GetShortcutHint () const
 Get keyboard shortcut hint for display.
 
virtual float GetPreferredWidth () const
 Get preferred width for this panel (optional)
 
virtual bool IsVisibleByDefault () const
 Whether this panel should be visible by default.
 
virtual std::string GetParentPanelId () const
 Get parent panel ID for cascade behavior.
 
virtual bool CascadeCloseChildren () const
 Whether closing this panel should close child panels.
 
void DrawWithLazyInit (bool *p_open)
 Execute lazy initialization if needed, then call Draw()
 

Private Member Functions

void DrawPresets ()
 Draw quick preset buttons.
 
void DrawPaletteGroupSelector ()
 Draw palette group selection.
 
void DrawPaletteDisplay ()
 Draw the current palette display.
 
void DrawApplyButtons ()
 Draw apply buttons.
 
void ApplyPaletteToSheet (uint16_t sheet_id)
 Apply current palette to specified sheet.
 
void ApplyPaletteToAllSheets ()
 Apply current palette to all active sheets.
 

Private Attributes

GraphicsEditorStatestate_
 
Romrom_
 
zelda3::GameDatagame_data_ = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from yaze::editor::EditorPanel
void InvalidateCache ()
 Invalidate all cached computations.
 
template<typename T >
T & GetCached (const std::string &key, std::function< T()> compute)
 Get or compute a cached value.
 
bool IsCacheValid () const
 Check if cache has been invalidated.
 
void ClearCache ()
 Clear all cached values (more aggressive than InvalidateCache)
 

Detailed Description

Panel for managing palettes applied to graphics sheets.

Provides palette group selection, quick presets, and apply-to-sheet functionality.

Definition at line 20 of file palette_controls_panel.h.

Constructor & Destructor Documentation

◆ PaletteControlsPanel()

yaze::editor::PaletteControlsPanel::PaletteControlsPanel ( GraphicsEditorState * state,
Rom * rom,
zelda3::GameData * game_data = nullptr )
inlineexplicit

Definition at line 22 of file palette_controls_panel.h.

Member Function Documentation

◆ SetGameData()

void yaze::editor::PaletteControlsPanel::SetGameData ( zelda3::GameData * game_data)
inline

Definition at line 26 of file palette_controls_panel.h.

References game_data_.

◆ GetId()

std::string yaze::editor::PaletteControlsPanel::GetId ( ) const
inlineoverridevirtual

Unique identifier for this panel.

Returns
Panel ID in format "{category}.{name}" (e.g., "dungeon.room_selector")

IDs should be:

  • Lowercase with underscores
  • Prefixed with editor category
  • Unique across all panels

Implements yaze::editor::EditorPanel.

Definition at line 32 of file palette_controls_panel.h.

◆ GetDisplayName()

std::string yaze::editor::PaletteControlsPanel::GetDisplayName ( ) const
inlineoverridevirtual

Human-readable name shown in menus and title bars.

Returns
Display name (e.g., "Room Selector")

Implements yaze::editor::EditorPanel.

Definition at line 33 of file palette_controls_panel.h.

◆ GetIcon()

std::string yaze::editor::PaletteControlsPanel::GetIcon ( ) const
inlineoverridevirtual

Material Design icon for this panel.

Returns
Icon constant (e.g., ICON_MD_LIST)

Implements yaze::editor::EditorPanel.

Definition at line 34 of file palette_controls_panel.h.

References ICON_MD_PALETTE.

◆ GetEditorCategory()

std::string yaze::editor::PaletteControlsPanel::GetEditorCategory ( ) const
inlineoverridevirtual

Editor category this panel belongs to.

Returns
Category name matching EditorType (e.g., "Dungeon", "Overworld")

Implements yaze::editor::EditorPanel.

Definition at line 35 of file palette_controls_panel.h.

◆ GetPriority()

int yaze::editor::PaletteControlsPanel::GetPriority ( ) const
inlineoverridevirtual

Get display priority for menu ordering.

Returns
Priority value (lower = higher in list, default 50)

Reimplemented from yaze::editor::EditorPanel.

Definition at line 36 of file palette_controls_panel.h.

◆ Initialize()

void yaze::editor::PaletteControlsPanel::Initialize ( )

◆ Draw()

void yaze::editor::PaletteControlsPanel::Draw ( bool * p_open)
overridevirtual

Draw the palette controls UI (EditorPanel interface)

Implements yaze::editor::EditorPanel.

Definition at line 115 of file palette_controls_panel.cc.

References DrawApplyButtons(), DrawPaletteDisplay(), DrawPaletteGroupSelector(), DrawPresets(), yaze::Rom::is_loaded(), and rom_.

◆ Update()

absl::Status yaze::editor::PaletteControlsPanel::Update ( )

Legacy Update method for backward compatibility.

Returns
Status of the render operation

Definition at line 131 of file palette_controls_panel.cc.

References DrawApplyButtons(), DrawPaletteDisplay(), DrawPaletteGroupSelector(), DrawPresets(), yaze::Rom::is_loaded(), and rom_.

◆ DrawPresets()

void yaze::editor::PaletteControlsPanel::DrawPresets ( )
private

◆ DrawPaletteGroupSelector()

◆ DrawPaletteDisplay()

◆ DrawApplyButtons()

◆ ApplyPaletteToSheet()

◆ ApplyPaletteToAllSheets()

Member Data Documentation

◆ state_

◆ rom_

Rom* yaze::editor::PaletteControlsPanel::rom_
private

◆ game_data_

zelda3::GameData* yaze::editor::PaletteControlsPanel::game_data_ = nullptr
private

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