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

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

#include <editor_layout.h>

Public Types

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

Public Member Functions

 EditorCard (const char *title, const char *icon=nullptr)
 
 EditorCard (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)
 
bool Begin (bool *p_open=nullptr)
 
void End ()
 
void SetMinimized (bool minimized)
 
bool IsMinimized () const
 
void Focus ()
 
bool IsFocused () const
 
const char * GetWindowName () const
 

Private Member Functions

void DrawFloatingIconButton ()
 

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 headless_ = false
 
bool docking_allowed_ = true
 
bool icon_collapsible_ = false
 
bool collapsed_to_icon_ = false
 
ImVec2 saved_icon_pos_ = ImVec2(10, 100)
 

Detailed Description

Draggable, dockable card for editor sub-windows.

Replaces traditional child windows with modern cards that can be:

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

Usage:

EditorCard tile_card("Tile Selector", ICON_MD_GRID_VIEW);
tile_card.SetDefaultSize(300, 400);
tile_card.SetPosition(CardPosition::Right);
if (tile_card.Begin()) {
// Draw tile selector content
tile_card.End();
}
Draggable, dockable card for editor sub-windows.
#define ICON_MD_GRID_VIEW
Definition icons.h:895

Definition at line 106 of file editor_layout.h.

Member Enumeration Documentation

◆ Position

Enumerator
Free 
Right 
Left 
Bottom 
Floating 

Definition at line 108 of file editor_layout.h.

Constructor & Destructor Documentation

◆ EditorCard() [1/2]

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

Definition at line 231 of file editor_layout.cc.

References icon_, title_, and window_name_.

◆ EditorCard() [2/2]

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

Definition at line 236 of file editor_layout.cc.

References icon_, p_open_, title_, and window_name_.

Member Function Documentation

◆ SetDefaultSize()

◆ SetPosition()

◆ SetMinimizable()

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

Definition at line 122 of file editor_layout.h.

References minimizable_.

◆ SetClosable()

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

Definition at line 123 of file editor_layout.h.

References closable_.

◆ SetHeadless()

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

Definition at line 124 of file editor_layout.h.

References headless_.

◆ SetDockingAllowed()

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

Definition at line 125 of file editor_layout.h.

References docking_allowed_.

◆ SetIconCollapsible()

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

Definition at line 126 of file editor_layout.h.

References icon_collapsible_.

◆ Begin()

◆ End()

◆ SetMinimized()

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

Definition at line 135 of file editor_layout.h.

References minimized_.

◆ IsMinimized()

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

Definition at line 136 of file editor_layout.h.

References minimized_.

◆ Focus()

void yaze::gui::EditorCard::Focus ( )

Definition at line 338 of file editor_layout.cc.

References focused_, and window_name_.

◆ IsFocused()

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

Definition at line 140 of file editor_layout.h.

References focused_.

◆ GetWindowName()

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

Definition at line 143 of file editor_layout.h.

References window_name_.

◆ DrawFloatingIconButton()

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

Definition at line 344 of file editor_layout.cc.

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

Referenced by Begin().

Member Data Documentation

◆ title_

std::string yaze::gui::EditorCard::title_
private

Definition at line 146 of file editor_layout.h.

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

◆ icon_

std::string yaze::gui::EditorCard::icon_
private

Definition at line 147 of file editor_layout.h.

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

◆ window_name_

std::string yaze::gui::EditorCard::window_name_
private

Definition at line 148 of file editor_layout.h.

Referenced by DrawFloatingIconButton(), EditorCard(), EditorCard(), Focus(), and GetWindowName().

◆ default_size_

ImVec2 yaze::gui::EditorCard::default_size_
private

Definition at line 149 of file editor_layout.h.

Referenced by Begin(), and SetDefaultSize().

◆ position_

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

Definition at line 150 of file editor_layout.h.

Referenced by Begin(), and SetPosition().

◆ minimizable_

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

Definition at line 151 of file editor_layout.h.

Referenced by SetMinimizable().

◆ closable_

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

Definition at line 152 of file editor_layout.h.

Referenced by Begin(), and SetClosable().

◆ minimized_

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

Definition at line 153 of file editor_layout.h.

Referenced by IsMinimized(), and SetMinimized().

◆ first_draw_

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

Definition at line 154 of file editor_layout.h.

Referenced by Begin().

◆ focused_

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

Definition at line 155 of file editor_layout.h.

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

◆ p_open_

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

Definition at line 156 of file editor_layout.h.

Referenced by Begin(), and EditorCard().

◆ headless_

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

Definition at line 159 of file editor_layout.h.

Referenced by Begin(), and SetHeadless().

◆ docking_allowed_

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

Definition at line 160 of file editor_layout.h.

Referenced by Begin(), and SetDockingAllowed().

◆ icon_collapsible_

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

Definition at line 161 of file editor_layout.h.

Referenced by Begin(), and SetIconCollapsible().

◆ collapsed_to_icon_

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

Definition at line 162 of file editor_layout.h.

Referenced by Begin(), and DrawFloatingIconButton().

◆ saved_icon_pos_

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

Definition at line 163 of file editor_layout.h.

Referenced by DrawFloatingIconButton().


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