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

Draggable, dockable panel for editor sub-windows. More...

#include <editor_layout.h>

Classes

struct  HeaderButton
 

Public Types

enum class  Position {
  Free , Right , Left , Bottom ,
  Top , Center , Floating
}
 

Public Member Functions

 PanelWindow (const char *title, const char *icon=nullptr)
 
 PanelWindow (const char *title, const char *icon, bool *p_open)
 
void SetDefaultSize (float width, float height)
 
void SetPosition (Position pos)
 
void SetStableId (const std::string &stable_id)
 
void SetMinimizable (bool minimizable)
 
void SetClosable (bool closable)
 
void SetHeadless (bool headless)
 
void SetDockingAllowed (bool allowed)
 
void SetIconCollapsible (bool collapsible)
 
void SetPinnable (bool pinnable)
 
void SetSaveSettings (bool save)
 
void SetStartOffset (const ImVec2 &offset)
 
void AddHeaderButton (const char *icon, const char *tooltip, std::function< void()> callback)
 
bool Begin (bool *p_open=nullptr)
 
void End ()
 
void SetMinimized (bool minimized)
 
bool IsMinimized () const
 
void SetPinned (bool pinned)
 
bool IsPinned () const
 
void SetPinChangedCallback (std::function< void(bool)> callback)
 
void Focus ()
 
bool IsFocused () const
 
const char * GetWindowName () const
 

Static Public Member Functions

static void ResetFrameTracking ()
 
static bool HasDuplicateRendering ()
 
static const std::string & GetDuplicatePanelName ()
 

Private Member Functions

void DrawFloatingIconButton ()
 
void DrawHeaderButtons ()
 
void UpdateWindowName ()
 

Private Attributes

std::string title_
 
std::string icon_
 
std::string window_name_
 
std::string stable_id_
 
ImVec2 default_size_
 
bool default_size_set_ = false
 
Position position_ = Position::Free
 
bool minimizable_ = true
 
bool closable_ = true
 
bool minimized_ = false
 
bool first_draw_ = true
 
bool focused_ = false
 
bool * p_open_ = nullptr
 
bool imgui_begun_ = false
 
bool headless_ = false
 
bool docking_allowed_ = true
 
bool icon_collapsible_ = false
 
bool collapsed_to_icon_ = false
 
ImVec2 saved_icon_pos_ = ImVec2(10, 100)
 
ImVec2 start_offset_ = ImVec2(0, 0)
 
bool start_offset_set_ = false
 
bool pinnable_ = false
 
bool pinned_ = false
 
std::function< void(bool)> on_pin_changed_
 
bool save_settings_ = true
 
std::vector< HeaderButtonheader_buttons_
 
std::optional< StyleVarGuardpanel_var_guard_
 
std::optional< StyleColorGuardpanel_color_guard_
 

Static Private Attributes

static int last_frame_count_ = 0
 
static std::vector< std::string > panels_begun_this_frame_
 
static bool duplicate_detected_ = false
 
static std::string duplicate_panel_name_
 

Detailed Description

Draggable, dockable panel for editor sub-windows.

Replaces traditional child windows with modern panels that can be:

  • Dragged and positioned freely
  • Docked to edges (optional)
  • Minimized to title bar
  • Resized responsively
  • Themed beautifully

Usage:

PanelWindow tile_panel("Tile Selector", ICON_MD_GRID_VIEW);
tile_panel.SetDefaultSize(300, 400);
tile_panel.SetPosition(PanelWindow::Position::Right);
if (tile_panel.Begin()) {
// Draw tile selector content when visible
}
tile_panel.End(); // Always call End() after Begin()
Draggable, dockable panel for editor sub-windows.
#define ICON_MD_GRID_VIEW
Definition icons.h:897

Definition at line 112 of file editor_layout.h.

Member Enumeration Documentation

◆ Position

Enumerator
Free 
Right 
Left 
Bottom 
Top 
Center 
Floating 

Definition at line 114 of file editor_layout.h.

Constructor & Destructor Documentation

◆ PanelWindow() [1/2]

yaze::gui::PanelWindow::PanelWindow ( const char * title,
const char * icon = nullptr )
explicit

Definition at line 241 of file editor_layout.cc.

References UpdateWindowName().

Here is the call graph for this function:

◆ PanelWindow() [2/2]

yaze::gui::PanelWindow::PanelWindow ( const char * title,
const char * icon,
bool * p_open )

Definition at line 246 of file editor_layout.cc.

References p_open_, and UpdateWindowName().

Here is the call graph for this function:

Member Function Documentation

◆ ResetFrameTracking()

static void yaze::gui::PanelWindow::ResetFrameTracking ( )
inlinestatic

Definition at line 128 of file editor_layout.h.

References last_frame_count_, and panels_begun_this_frame_.

◆ HasDuplicateRendering()

static bool yaze::gui::PanelWindow::HasDuplicateRendering ( )
inlinestatic

Definition at line 134 of file editor_layout.h.

References duplicate_detected_.

◆ GetDuplicatePanelName()

static const std::string & yaze::gui::PanelWindow::GetDuplicatePanelName ( )
inlinestatic

Definition at line 135 of file editor_layout.h.

References duplicate_panel_name_.

◆ SetDefaultSize()

◆ SetPosition()

void yaze::gui::PanelWindow::SetPosition ( Position pos)

◆ SetStableId()

void yaze::gui::PanelWindow::SetStableId ( const std::string & stable_id)

Definition at line 261 of file editor_layout.cc.

References stable_id_, and UpdateWindowName().

Referenced by yaze::editor::PanelManager::DrawAllVisiblePanels().

Here is the call graph for this function:

◆ SetMinimizable()

void yaze::gui::PanelWindow::SetMinimizable ( bool minimizable)
inline

Definition at line 149 of file editor_layout.h.

References minimizable_.

◆ SetClosable()

void yaze::gui::PanelWindow::SetClosable ( bool closable)
inline

Definition at line 150 of file editor_layout.h.

References closable_.

◆ SetHeadless()

void yaze::gui::PanelWindow::SetHeadless ( bool headless)
inline

Definition at line 151 of file editor_layout.h.

References headless_.

◆ SetDockingAllowed()

void yaze::gui::PanelWindow::SetDockingAllowed ( bool allowed)
inline

Definition at line 152 of file editor_layout.h.

References docking_allowed_.

◆ SetIconCollapsible()

void yaze::gui::PanelWindow::SetIconCollapsible ( bool collapsible)
inline

Definition at line 153 of file editor_layout.h.

References icon_collapsible_.

◆ SetPinnable()

void yaze::gui::PanelWindow::SetPinnable ( bool pinnable)
inline

Definition at line 154 of file editor_layout.h.

References pinnable_.

Referenced by yaze::editor::PanelManager::DrawAllVisiblePanels().

◆ SetSaveSettings()

void yaze::gui::PanelWindow::SetSaveSettings ( bool save)
inline

Definition at line 155 of file editor_layout.h.

References save_settings_.

Referenced by yaze::editor::DashboardPanel::DashboardPanel().

◆ SetStartOffset()

void yaze::gui::PanelWindow::SetStartOffset ( const ImVec2 & offset)
inline

Definition at line 156 of file editor_layout.h.

References start_offset_, and start_offset_set_.

◆ AddHeaderButton()

void yaze::gui::PanelWindow::AddHeaderButton ( const char * icon,
const char * tooltip,
std::function< void()> callback )

Definition at line 266 of file editor_layout.cc.

References header_buttons_.

◆ Begin()

◆ End()

◆ SetMinimized()

void yaze::gui::PanelWindow::SetMinimized ( bool minimized)
inline

Definition at line 172 of file editor_layout.h.

References minimized_.

◆ IsMinimized()

bool yaze::gui::PanelWindow::IsMinimized ( ) const
inline

Definition at line 173 of file editor_layout.h.

References minimized_.

◆ SetPinned()

void yaze::gui::PanelWindow::SetPinned ( bool pinned)
inline

Definition at line 176 of file editor_layout.h.

References pinned_.

Referenced by yaze::editor::PanelManager::DrawAllVisiblePanels().

◆ IsPinned()

bool yaze::gui::PanelWindow::IsPinned ( ) const
inline

Definition at line 177 of file editor_layout.h.

References pinned_.

◆ SetPinChangedCallback()

void yaze::gui::PanelWindow::SetPinChangedCallback ( std::function< void(bool)> callback)
inline

Definition at line 178 of file editor_layout.h.

References on_pin_changed_.

Referenced by yaze::editor::PanelManager::DrawAllVisiblePanels().

◆ Focus()

void yaze::gui::PanelWindow::Focus ( )

Definition at line 468 of file editor_layout.cc.

References focused_, and window_name_.

◆ IsFocused()

bool yaze::gui::PanelWindow::IsFocused ( ) const
inline

Definition at line 184 of file editor_layout.h.

References focused_.

◆ GetWindowName()

const char * yaze::gui::PanelWindow::GetWindowName ( ) const
inline

Definition at line 187 of file editor_layout.h.

References window_name_.

◆ DrawFloatingIconButton()

void yaze::gui::PanelWindow::DrawFloatingIconButton ( )
private

Definition at line 474 of file editor_layout.cc.

References collapsed_to_icon_, icon_, saved_icon_pos_, title_, and window_name_.

Referenced by Begin().

◆ DrawHeaderButtons()

void yaze::gui::PanelWindow::DrawHeaderButtons ( )
private

Definition at line 506 of file editor_layout.cc.

Referenced by Begin().

◆ UpdateWindowName()

void yaze::gui::PanelWindow::UpdateWindowName ( )
private

Definition at line 520 of file editor_layout.cc.

References icon_, stable_id_, title_, and window_name_.

Referenced by PanelWindow(), PanelWindow(), and SetStableId().

Member Data Documentation

◆ last_frame_count_

int yaze::gui::PanelWindow::last_frame_count_ = 0
staticprivate

Definition at line 138 of file editor_layout.h.

Referenced by Begin(), and ResetFrameTracking().

◆ panels_begun_this_frame_

std::vector< std::string > yaze::gui::PanelWindow::panels_begun_this_frame_
staticprivate

Definition at line 139 of file editor_layout.h.

Referenced by Begin(), and ResetFrameTracking().

◆ duplicate_detected_

bool yaze::gui::PanelWindow::duplicate_detected_ = false
staticprivate

Definition at line 140 of file editor_layout.h.

Referenced by Begin(), and HasDuplicateRendering().

◆ duplicate_panel_name_

std::string yaze::gui::PanelWindow::duplicate_panel_name_
staticprivate

Definition at line 141 of file editor_layout.h.

Referenced by Begin(), and GetDuplicatePanelName().

◆ title_

std::string yaze::gui::PanelWindow::title_
private

Definition at line 190 of file editor_layout.h.

Referenced by Begin(), DrawFloatingIconButton(), and UpdateWindowName().

◆ icon_

std::string yaze::gui::PanelWindow::icon_
private

Definition at line 191 of file editor_layout.h.

Referenced by DrawFloatingIconButton(), and UpdateWindowName().

◆ window_name_

std::string yaze::gui::PanelWindow::window_name_
private

◆ stable_id_

std::string yaze::gui::PanelWindow::stable_id_
private

Definition at line 193 of file editor_layout.h.

Referenced by SetStableId(), and UpdateWindowName().

◆ default_size_

ImVec2 yaze::gui::PanelWindow::default_size_
private

Definition at line 194 of file editor_layout.h.

Referenced by Begin(), and SetDefaultSize().

◆ default_size_set_

bool yaze::gui::PanelWindow::default_size_set_ = false
private

Definition at line 195 of file editor_layout.h.

Referenced by Begin(), and SetDefaultSize().

◆ position_

Position yaze::gui::PanelWindow::position_ = Position::Free
private

Definition at line 196 of file editor_layout.h.

Referenced by Begin(), and SetPosition().

◆ minimizable_

bool yaze::gui::PanelWindow::minimizable_ = true
private

Definition at line 197 of file editor_layout.h.

Referenced by SetMinimizable().

◆ closable_

bool yaze::gui::PanelWindow::closable_ = true
private

Definition at line 198 of file editor_layout.h.

Referenced by Begin(), and SetClosable().

◆ minimized_

bool yaze::gui::PanelWindow::minimized_ = false
private

Definition at line 199 of file editor_layout.h.

Referenced by IsMinimized(), and SetMinimized().

◆ first_draw_

bool yaze::gui::PanelWindow::first_draw_ = true
private

Definition at line 200 of file editor_layout.h.

Referenced by Begin().

◆ focused_

bool yaze::gui::PanelWindow::focused_ = false
private

Definition at line 201 of file editor_layout.h.

Referenced by End(), Focus(), and IsFocused().

◆ p_open_

bool* yaze::gui::PanelWindow::p_open_ = nullptr
private

Definition at line 202 of file editor_layout.h.

Referenced by Begin(), and PanelWindow().

◆ imgui_begun_

bool yaze::gui::PanelWindow::imgui_begun_ = false
private

Definition at line 203 of file editor_layout.h.

Referenced by Begin(), and End().

◆ headless_

bool yaze::gui::PanelWindow::headless_ = false
private

Definition at line 206 of file editor_layout.h.

Referenced by Begin(), and SetHeadless().

◆ docking_allowed_

bool yaze::gui::PanelWindow::docking_allowed_ = true
private

Definition at line 207 of file editor_layout.h.

Referenced by Begin(), and SetDockingAllowed().

◆ icon_collapsible_

bool yaze::gui::PanelWindow::icon_collapsible_ = false
private

Definition at line 208 of file editor_layout.h.

Referenced by Begin(), and SetIconCollapsible().

◆ collapsed_to_icon_

bool yaze::gui::PanelWindow::collapsed_to_icon_ = false
private

Definition at line 209 of file editor_layout.h.

Referenced by Begin(), and DrawFloatingIconButton().

◆ saved_icon_pos_

ImVec2 yaze::gui::PanelWindow::saved_icon_pos_ = ImVec2(10, 100)
private

Definition at line 210 of file editor_layout.h.

Referenced by DrawFloatingIconButton().

◆ start_offset_

ImVec2 yaze::gui::PanelWindow::start_offset_ = ImVec2(0, 0)
private

Definition at line 211 of file editor_layout.h.

Referenced by Begin(), and SetStartOffset().

◆ start_offset_set_

bool yaze::gui::PanelWindow::start_offset_set_ = false
private

Definition at line 212 of file editor_layout.h.

Referenced by Begin(), and SetStartOffset().

◆ pinnable_

bool yaze::gui::PanelWindow::pinnable_ = false
private

Definition at line 215 of file editor_layout.h.

Referenced by SetPinnable().

◆ pinned_

bool yaze::gui::PanelWindow::pinned_ = false
private

Definition at line 216 of file editor_layout.h.

Referenced by IsPinned(), and SetPinned().

◆ on_pin_changed_

std::function<void(bool)> yaze::gui::PanelWindow::on_pin_changed_
private

Definition at line 217 of file editor_layout.h.

Referenced by SetPinChangedCallback().

◆ save_settings_

bool yaze::gui::PanelWindow::save_settings_ = true
private

Definition at line 220 of file editor_layout.h.

Referenced by Begin(), and SetSaveSettings().

◆ header_buttons_

std::vector<HeaderButton> yaze::gui::PanelWindow::header_buttons_
private

Definition at line 228 of file editor_layout.h.

Referenced by AddHeaderButton().

◆ panel_var_guard_

std::optional<StyleVarGuard> yaze::gui::PanelWindow::panel_var_guard_
private

Definition at line 234 of file editor_layout.h.

Referenced by Begin(), and End().

◆ panel_color_guard_

std::optional<StyleColorGuard> yaze::gui::PanelWindow::panel_color_guard_
private

Definition at line 235 of file editor_layout.h.

Referenced by Begin(), and End().


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