Ember
Loading...
Searching...
No Matches
ITab.h
Go to the documentation of this file.
1#pragma once
2
16
17#include <memory>
18#include <wx/wx.h>
19
28class ITab {
29 public:
30 virtual ~ITab() = default;
31
36 virtual wxWindow *GetWidget() = 0;
37
42 virtual wxString GetTitle() const = 0;
43
48 virtual wxString GetTabType() const = 0;
49
54 virtual wxBitmap GetIcon() const { return wxNullBitmap; }
55
60 virtual void Initialize() {}
61
66 virtual void Refresh() {}
67
71 virtual void OnActivated() {}
72
76 virtual void OnDeactivated() {}
77
82 virtual void OnClosed() {}
83
88 virtual bool IsValid() const { return true; }
89
94 virtual bool CanClose() const { return true; }
95
100 virtual bool CanMove() const { return true; }
101
106 virtual wxString SerializeState() const { return ""; }
107
112 virtual void DeserializeState(const wxString &state) {}
113
118 virtual bool HasUnsavedChanges() const { return false; }
119
124 virtual bool Save() { return true; }
125
131 virtual bool SupportsOperation(const wxString &operation) const { return false; }
132
139 virtual bool ExecuteOperation(const wxString &operation, const wxString &parameter = "") { return false; }
140};
141
145using ITabPtr = std::unique_ptr<ITab>;
std::unique_ptr< ITab > ITabPtr
Smart pointer type for ITab instances.
Definition ITab.h:145
Abstract interface for individual tabs that can be moved between panels.
Definition ITab.h:28
virtual void OnDeactivated()
Called when the tab becomes inactive/hidden.
Definition ITab.h:76
virtual bool CanMove() const
Check if this tab can be moved to other panels.
Definition ITab.h:100
virtual bool CanClose() const
Check if this tab can be closed by the user.
Definition ITab.h:94
virtual bool SupportsOperation(const wxString &operation) const
Check if this tab supports the given operation.
Definition ITab.h:131
virtual bool ExecuteOperation(const wxString &operation, const wxString &parameter="")
Execute a named operation on this tab.
Definition ITab.h:139
virtual wxBitmap GetIcon() const
Get an optional icon for this tab.
Definition ITab.h:54
virtual void DeserializeState(const wxString &state)
Restore the tab's state from serialized data.
Definition ITab.h:112
virtual wxString GetTitle() const =0
Get the display title for this tab.
virtual wxString SerializeState() const
Serialize the tab's current state to a string.
Definition ITab.h:106
virtual bool Save()
Save the tab's data (if applicable)
Definition ITab.h:124
virtual ~ITab()=default
virtual wxWindow * GetWidget()=0
Get the main widget for this tab.
virtual void OnActivated()
Called when the tab becomes the active/visible tab.
Definition ITab.h:71
virtual void OnClosed()
Called when the tab is about to be closed/removed Use this for cleanup operations.
Definition ITab.h:82
virtual bool HasUnsavedChanges() const
Check if this tab has unsaved changes.
Definition ITab.h:118
virtual wxString GetTabType() const =0
Get a unique identifier for this tab type.
virtual void Refresh()
Called when the tab should refresh its display This should update the tab's content to reflect curren...
Definition ITab.h:66
virtual bool IsValid() const
Check if the tab is in a valid state.
Definition ITab.h:88
virtual void Initialize()
Initialize the tab after construction Called once after the tab is created and configured.
Definition ITab.h:60