Ember
Loading...
Searching...
No Matches
IPanel.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <wx/wx.h>
5
13class IPanel {
14 public:
15 virtual ~IPanel() = default;
16
21 virtual wxPanel *GetPanel() = 0;
22
27 virtual wxString GetTitle() const = 0;
28
33 virtual wxString GetPanelType() const = 0;
34
39 virtual void Initialize() {}
40
45 virtual void Refresh() {}
46
50 virtual void OnActivated() {}
51
55 virtual void OnDeactivated() {}
56
61 virtual void Cleanup() {}
62
67 virtual bool IsValid() const { return true; }
68
73 virtual wxString SerializeState() const { return ""; }
74
79 virtual void DeserializeState(const wxString &state) {}
80
85 virtual bool HasUnsavedChanges() const { return false; }
86
91 virtual bool Save() { return true; }
92
98 virtual bool SupportsOperation(const wxString &operation) const { return false; }
99
106 virtual bool ExecuteOperation(const wxString &operation, const wxString &parameter = "") { return false; }
107};
108
112using IPanelPtr = std::unique_ptr<IPanel>;
std::unique_ptr< IPanel > IPanelPtr
Smart pointer type for IPanel instances.
Definition IPanel.h:112
Abstract interface for all panels in the Ember application.
Definition IPanel.h:13
virtual bool SupportsOperation(const wxString &operation) const
Check if this panel supports the given operation.
Definition IPanel.h:98
virtual wxPanel * GetPanel()=0
Get the main panel widget.
virtual wxString GetPanelType() const =0
Get a unique identifier for this panel type.
virtual void DeserializeState(const wxString &state)
Restore the panel's state from serialized data.
Definition IPanel.h:79
virtual bool ExecuteOperation(const wxString &operation, const wxString &parameter="")
Execute a named operation on this panel.
Definition IPanel.h:106
virtual bool IsValid() const
Check if the panel is in a valid state.
Definition IPanel.h:67
virtual bool HasUnsavedChanges() const
Check if this panel has unsaved changes.
Definition IPanel.h:85
virtual void Refresh()
Called when the panel should refresh its display This should update the panel's content to reflect cu...
Definition IPanel.h:45
virtual void Initialize()
Initialize the panel after construction Called once after the panel is created and configured.
Definition IPanel.h:39
virtual bool Save()
Save the panel's data (if applicable)
Definition IPanel.h:91
virtual wxString SerializeState() const
Serialize the panel's current state to a string.
Definition IPanel.h:73
virtual void OnActivated()
Called when the panel becomes visible/active.
Definition IPanel.h:50
virtual void OnDeactivated()
Called when the panel becomes hidden/inactive.
Definition IPanel.h:55
virtual void Cleanup()
Called when the panel is about to be destroyed Use this for cleanup operations.
Definition IPanel.h:61
virtual ~IPanel()=default
virtual wxString GetTitle() const =0
Get the display title for this panel.