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 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 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 ()
 

Private Attributes

std::string title_
 
std::string icon_
 
std::string window_name_
 
ImVec2 default_size_
 
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)
 
bool pinnable_ = false
 
bool pinned_ = false
 
std::function< void(bool)> on_pin_changed_
 
bool save_settings_ = true
 
std::vector< HeaderButtonheader_buttons_
 

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 108 of file editor_layout.h.

Member Enumeration Documentation

◆ Position

Enumerator
Free 
Right 
Left 
Bottom 
Top 
Center 
Floating 

Definition at line 110 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 237 of file editor_layout.cc.

References icon_, title_, and window_name_.

◆ PanelWindow() [2/2]

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

Definition at line 242 of file editor_layout.cc.

References icon_, p_open_, title_, and window_name_.

Member Function Documentation

◆ ResetFrameTracking()

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

Definition at line 124 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 130 of file editor_layout.h.

References duplicate_detected_.

◆ GetDuplicatePanelName()

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

Definition at line 131 of file editor_layout.h.

References duplicate_panel_name_.

◆ SetDefaultSize()

◆ SetPosition()

◆ SetMinimizable()

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

Definition at line 144 of file editor_layout.h.

References minimizable_.

◆ SetClosable()

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

Definition at line 145 of file editor_layout.h.

References closable_.

◆ SetHeadless()

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

Definition at line 146 of file editor_layout.h.

References headless_.

◆ SetDockingAllowed()

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

Definition at line 147 of file editor_layout.h.

References docking_allowed_.

◆ SetIconCollapsible()

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

Definition at line 148 of file editor_layout.h.

References icon_collapsible_.

◆ SetPinnable()

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

Definition at line 149 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 150 of file editor_layout.h.

References save_settings_.

◆ AddHeaderButton()

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

Definition at line 256 of file editor_layout.cc.

References header_buttons_.

◆ Begin()

◆ End()

◆ SetMinimized()

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

Definition at line 163 of file editor_layout.h.

References minimized_.

◆ IsMinimized()

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

Definition at line 164 of file editor_layout.h.

References minimized_.

◆ SetPinned()

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

Definition at line 167 of file editor_layout.h.

References pinned_.

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

◆ IsPinned()

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

Definition at line 168 of file editor_layout.h.

References pinned_.

◆ SetPinChangedCallback()

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

Definition at line 169 of file editor_layout.h.

References on_pin_changed_.

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

◆ Focus()

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

Definition at line 399 of file editor_layout.cc.

References focused_, and window_name_.

◆ IsFocused()

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

Definition at line 175 of file editor_layout.h.

References focused_.

◆ GetWindowName()

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

Definition at line 178 of file editor_layout.h.

References window_name_.

◆ DrawFloatingIconButton()

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

Definition at line 405 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 437 of file editor_layout.cc.

Referenced by Begin().

Member Data Documentation

◆ last_frame_count_

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

Definition at line 134 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 135 of file editor_layout.h.

Referenced by Begin(), and ResetFrameTracking().

◆ duplicate_detected_

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

Definition at line 136 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 137 of file editor_layout.h.

Referenced by Begin(), and GetDuplicatePanelName().

◆ title_

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

Definition at line 181 of file editor_layout.h.

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

◆ icon_

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

Definition at line 182 of file editor_layout.h.

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

◆ window_name_

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

◆ default_size_

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

Definition at line 184 of file editor_layout.h.

Referenced by Begin(), and SetDefaultSize().

◆ position_

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

Definition at line 185 of file editor_layout.h.

Referenced by Begin(), and SetPosition().

◆ minimizable_

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

Definition at line 186 of file editor_layout.h.

Referenced by SetMinimizable().

◆ closable_

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

Definition at line 187 of file editor_layout.h.

Referenced by Begin(), and SetClosable().

◆ minimized_

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

Definition at line 188 of file editor_layout.h.

Referenced by IsMinimized(), and SetMinimized().

◆ first_draw_

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

Definition at line 189 of file editor_layout.h.

Referenced by Begin().

◆ focused_

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

Definition at line 190 of file editor_layout.h.

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

◆ p_open_

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

Definition at line 191 of file editor_layout.h.

Referenced by Begin(), and PanelWindow().

◆ imgui_begun_

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

Definition at line 192 of file editor_layout.h.

Referenced by Begin(), and End().

◆ headless_

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

Definition at line 195 of file editor_layout.h.

Referenced by Begin(), and SetHeadless().

◆ docking_allowed_

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

Definition at line 196 of file editor_layout.h.

Referenced by Begin(), and SetDockingAllowed().

◆ icon_collapsible_

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

Definition at line 197 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 198 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 199 of file editor_layout.h.

Referenced by DrawFloatingIconButton().

◆ pinnable_

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

Definition at line 202 of file editor_layout.h.

Referenced by SetPinnable().

◆ pinned_

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

Definition at line 203 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 204 of file editor_layout.h.

Referenced by SetPinChangedCallback().

◆ save_settings_

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

Definition at line 207 of file editor_layout.h.

Referenced by Begin(), and SetSaveSettings().

◆ header_buttons_

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

Definition at line 215 of file editor_layout.h.

Referenced by AddHeaderButton().


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