Ember
Loading...
Searching...
No Matches
Panel Class Reference

Base implementation of IPanel interface. More...

#include <Panel.h>

Inheritance diagram for Panel:
IPanel MainPanel SidePanel BottomPanel LeftSidePanel RightSidePanel

Public Member Functions

 Panel (wxWindow *parent, const wxString &name="Panel", long style=wxTAB_TRAVERSAL)
 Constructor.
virtual ~Panel ()
 Destructor.
wxPanel * GetPanel () override
 Get the main panel widget.
wxString GetTitle () const override
 Get the display title for this panel.
wxString GetPanelType () const override
 Get a unique identifier for this panel type.
void Initialize () override
 Initialize the panel after construction Called once after the panel is created and configured.
void Refresh () override
 Called when the panel should refresh its display This should update the panel's content to reflect current state.
void OnActivated () override
 Called when the panel becomes visible/active.
void OnDeactivated () override
 Called when the panel becomes hidden/inactive.
void Cleanup () override
 Called when the panel is about to be destroyed Use this for cleanup operations.
bool IsValid () const override
 Check if the panel is in a valid state.
wxString SerializeState () const override
 Serialize the panel's current state to a string.
void DeserializeState (const wxString &state) override
 Restore the panel's state from serialized data.
bool HasUnsavedChanges () const override
 Check if this panel has unsaved changes.
bool Save () override
 Save the panel's data (if applicable)
bool SupportsOperation (const wxString &operation) const override
 Check if this panel supports the given operation.
bool ExecuteOperation (const wxString &operation, const wxString &parameter="") override
 Execute a named operation on this panel.
wxString GetName () const override
void SetName (const wxString &name) override
void SetTitle (const wxString &title)
void SetPanelType (const wxString &type)
Public Member Functions inherited from IPanel
virtual ~IPanel ()=default

Protected Member Functions

virtual void CreateLayout ()
 Create the panel's UI layout Called during initialization.
virtual void ApplyTheme ()
 Apply current theme to the panel Called when theme changes.
virtual void UpdateContent ()
 Update panel content Called during refresh.
virtual void HandleActivation ()
 Handle panel activation Called when panel becomes active.
virtual void HandleDeactivation ()
 Handle panel deactivation Called when panel becomes inactive.
virtual bool ValidateState () const
 Validate panel state Override to provide custom validation logic.
void MarkChanged ()
 Mark panel as having unsaved changes.
void MarkSaved ()
 Mark panel as saved (no unsaved changes)
wxSizer * GetMainSizer () const
 Get the main sizer for layout management.
void SetMainSizer (wxSizer *sizer)
 Set the main sizer (takes ownership)
virtual void OnPanelSize (wxSizeEvent &event)
virtual void OnPanelPaint (wxPaintEvent &event)
virtual void OnPanelRightClick (wxContextMenuEvent &event)

Private Member Functions

void InitializePanel ()
void SetupEventHandlers ()
void UpdateAppearance ()
void DoCleanup ()
void DoApplyTheme ()
 Panel (const Panel &)=delete
Panel & operator= (const Panel &)=delete

Private Attributes

wxSizer * main_sizer_
wxString name_
wxString title_
wxString panel_type_
bool is_initialized_
bool is_active_
bool has_unsaved_changes_
wxColour background_color_
wxColour foreground_color_
wxFont panel_font_

Detailed Description

Base implementation of IPanel interface.

This class provides a concrete implementation of the IPanel interface with common functionality that can be inherited by specific panel types. It handles basic panel lifecycle, theming, and state management.

Definition at line 28 of file Panel.h.

Constructor & Destructor Documentation

◆ Panel() [1/2]

Panel::Panel ( wxWindow * parent,
const wxString & name = "Panel",
long style = wxTAB_TRAVERSAL )
explicit

Constructor.

Parameters
parentParent window
namePanel name/identifier
stylewxWidgets panel style flags

◆ ~Panel()

Panel::~Panel ( )
virtual

Destructor.

Definition at line 23 of file Panel.cpp.

◆ Panel() [2/2]

Panel::Panel ( const Panel & )
privatedelete

Member Function Documentation

◆ ApplyTheme()

void Panel::ApplyTheme ( )
protectedvirtual

Apply current theme to the panel Called when theme changes.

Override for custom theming.

Definition at line 143 of file Panel.cpp.

◆ Cleanup()

void Panel::Cleanup ( )
overridevirtual

Called when the panel is about to be destroyed Use this for cleanup operations.

Reimplemented from IPanel.

Definition at line 72 of file Panel.cpp.

◆ CreateLayout()

void Panel::CreateLayout ( )
protectedvirtual

Create the panel's UI layout Called during initialization.

Override in derived classes.

Reimplemented in MainPanel, and SidePanel.

Definition at line 135 of file Panel.cpp.

◆ DeserializeState()

void Panel::DeserializeState ( const wxString & state)
overridevirtual

Restore the panel's state from serialized data.

Parameters
stateThe serialized state data

Reimplemented from IPanel.

Definition at line 100 of file Panel.cpp.

◆ DoApplyTheme()

void Panel::DoApplyTheme ( )
private

Definition at line 147 of file Panel.cpp.

◆ DoCleanup()

void Panel::DoCleanup ( )
private

Definition at line 76 of file Panel.cpp.

◆ ExecuteOperation()

bool Panel::ExecuteOperation ( const wxString & operation,
const wxString & parameter = "" )
overridevirtual

Execute a named operation on this panel.

Parameters
operationThe operation to execute
parameterOptional parameter for the operation
Returns
bool True if the operation was successful

Reimplemented from IPanel.

Definition at line 120 of file Panel.cpp.

◆ GetMainSizer()

wxSizer * Panel::GetMainSizer ( ) const
inlineprotected

Get the main sizer for layout management.

Definition at line 122 of file Panel.h.

◆ GetName()

wxString Panel::GetName ( ) const
inlineoverride

Definition at line 66 of file Panel.h.

◆ GetPanel()

wxPanel * Panel::GetPanel ( )
inlineoverridevirtual

Get the main panel widget.

Returns
wxPanel* The panel widget that can be added to containers

Implements IPanel.

Definition at line 44 of file Panel.h.

◆ GetPanelType()

wxString Panel::GetPanelType ( ) const
inlineoverridevirtual

Get a unique identifier for this panel type.

Returns
wxString Identifier like "Properties", "SceneHierarchy", etc.

Implements IPanel.

Reimplemented in RightSidePanel, and SidePanel.

Definition at line 46 of file Panel.h.

◆ GetTitle()

wxString Panel::GetTitle ( ) const
inlineoverridevirtual

Get the display title for this panel.

Returns
wxString The title to show in tabs, captions, etc.

Implements IPanel.

Reimplemented in RightSidePanel, and SidePanel.

Definition at line 45 of file Panel.h.

◆ HandleActivation()

void Panel::HandleActivation ( )
protectedvirtual

Handle panel activation Called when panel becomes active.

Override for custom behavior.

Definition at line 158 of file Panel.cpp.

◆ HandleDeactivation()

void Panel::HandleDeactivation ( )
protectedvirtual

Handle panel deactivation Called when panel becomes inactive.

Override for custom behavior.

Definition at line 162 of file Panel.cpp.

◆ HasUnsavedChanges()

bool Panel::HasUnsavedChanges ( ) const
inlineoverridevirtual

Check if this panel has unsaved changes.

Returns
bool True if the panel has been modified

Reimplemented from IPanel.

Definition at line 59 of file Panel.h.

◆ Initialize()

void Panel::Initialize ( )
overridevirtual

Initialize the panel after construction Called once after the panel is created and configured.

Reimplemented from IPanel.

Definition at line 33 of file Panel.cpp.

◆ InitializePanel()

void Panel::InitializePanel ( )
private

Definition at line 191 of file Panel.cpp.

◆ IsValid()

bool Panel::IsValid ( ) const
inlineoverridevirtual

Check if the panel is in a valid state.

Returns
bool True if the panel is properly initialized and functional

Reimplemented from IPanel.

Definition at line 54 of file Panel.h.

◆ MarkChanged()

void Panel::MarkChanged ( )
inlineprotected

Mark panel as having unsaved changes.

Definition at line 112 of file Panel.h.

◆ MarkSaved()

void Panel::MarkSaved ( )
inlineprotected

Mark panel as saved (no unsaved changes)

Definition at line 117 of file Panel.h.

◆ OnActivated()

void Panel::OnActivated ( )
overridevirtual

Called when the panel becomes visible/active.

Reimplemented from IPanel.

Definition at line 54 of file Panel.cpp.

◆ OnDeactivated()

void Panel::OnDeactivated ( )
overridevirtual

Called when the panel becomes hidden/inactive.

Reimplemented from IPanel.

Definition at line 63 of file Panel.cpp.

◆ OnPanelPaint()

void Panel::OnPanelPaint ( wxPaintEvent & event)
protectedvirtual

Definition at line 180 of file Panel.cpp.

◆ OnPanelRightClick()

void Panel::OnPanelRightClick ( wxContextMenuEvent & event)
protectedvirtual

Definition at line 186 of file Panel.cpp.

◆ OnPanelSize()

void Panel::OnPanelSize ( wxSizeEvent & event)
protectedvirtual

Definition at line 173 of file Panel.cpp.

◆ operator=()

Panel & Panel::operator= ( const Panel & )
privatedelete

◆ Refresh()

void Panel::Refresh ( )
overridevirtual

Called when the panel should refresh its display This should update the panel's content to reflect current state.

Reimplemented from IPanel.

Definition at line 45 of file Panel.cpp.

◆ Save()

bool Panel::Save ( )
overridevirtual

Save the panel's data (if applicable)

Returns
bool True if save was successful

Reimplemented from IPanel.

Definition at line 106 of file Panel.cpp.

◆ SerializeState()

wxString Panel::SerializeState ( ) const
overridevirtual

Serialize the panel's current state to a string.

Returns
wxString Serialized state data

Reimplemented from IPanel.

Definition at line 91 of file Panel.cpp.

◆ SetMainSizer()

void Panel::SetMainSizer ( wxSizer * sizer)
protected

Set the main sizer (takes ownership)

Definition at line 168 of file Panel.cpp.

◆ SetName()

void Panel::SetName ( const wxString & name)
override

Definition at line 28 of file Panel.cpp.

◆ SetPanelType()

void Panel::SetPanelType ( const wxString & type)
inline

Definition at line 70 of file Panel.h.

◆ SetTitle()

void Panel::SetTitle ( const wxString & title)
inline

Definition at line 69 of file Panel.h.

◆ SetupEventHandlers()

void Panel::SetupEventHandlers ( )
private

Definition at line 196 of file Panel.cpp.

◆ SupportsOperation()

bool Panel::SupportsOperation ( const wxString & operation) const
overridevirtual

Check if this panel supports the given operation.

Parameters
operationThe operation to check (e.g., "save", "export", "search")
Returns
bool True if the operation is supported

Reimplemented from IPanel.

Definition at line 115 of file Panel.cpp.

◆ UpdateAppearance()

void Panel::UpdateAppearance ( )
private

Definition at line 200 of file Panel.cpp.

◆ UpdateContent()

void Panel::UpdateContent ( )
protectedvirtual

Update panel content Called during refresh.

Override in derived classes.

Definition at line 154 of file Panel.cpp.

◆ ValidateState()

bool Panel::ValidateState ( ) const
protectedvirtual

Validate panel state Override to provide custom validation logic.

Definition at line 166 of file Panel.cpp.

Member Data Documentation

◆ background_color_

wxColour Panel::background_color_
private

Definition at line 147 of file Panel.h.

◆ foreground_color_

wxColour Panel::foreground_color_
private

Definition at line 148 of file Panel.h.

◆ has_unsaved_changes_

bool Panel::has_unsaved_changes_
private

Definition at line 144 of file Panel.h.

◆ is_active_

bool Panel::is_active_
private

Definition at line 143 of file Panel.h.

◆ is_initialized_

bool Panel::is_initialized_
private

Definition at line 142 of file Panel.h.

◆ main_sizer_

wxSizer* Panel::main_sizer_
private

Definition at line 136 of file Panel.h.

◆ name_

wxString Panel::name_
private

Definition at line 139 of file Panel.h.

◆ panel_font_

wxFont Panel::panel_font_
private

Definition at line 149 of file Panel.h.

◆ panel_type_

wxString Panel::panel_type_
private

Definition at line 141 of file Panel.h.

◆ title_

wxString Panel::title_
private

Definition at line 140 of file Panel.h.


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