![]() |
Ember
|
Base class for sidebar panels with shared tab management backend. More...
#include <SidePanel.h>
Public Member Functions | |
| SidePanel (wxWindow *parent, MainFrame *mainFrame=nullptr, const wxString &panelName="Side Panel", EmberForge::PanelType panelType=EmberForge::PanelType::LeftPanel, EmberForge::PanelDescriptor *parentDescriptor=nullptr) | |
| virtual | ~SidePanel () |
| void | FinishSetup () |
| Complete panel setup after construction. | |
| wxString | GetTitle () const override=0 |
| Get the display title for this panel. | |
| wxString | GetPanelType () const override=0 |
| Get a unique identifier for this panel type. | |
| int | AddTab (ITabPtr tab) |
| Add a tab to this panel. | |
| ITabPtr | RemoveTab (int index) |
| Remove a tab by index. | |
| ITab * | GetTab (int index) const |
| Get a tab by index. | |
| size_t | GetTabCount () const |
| Get the number of tabs. | |
| bool | SetActiveTab (int index) |
| Set the active tab by index. | |
| ITab * | GetActiveTab () const |
| Get the currently active tab. | |
| EmberForge::CustomAuiNotebook * | GetNotebook () const |
| Get the notebook widget for direct access. | |
| bool | HasTabWithName (const wxString &tabName) const |
| Check if this panel has a tab with the given name. | |
| void | ResetToDefaultTab (EmberForge::TabType defaultTabType) |
| Reset the panel to a single default tab Closes all tabs and creates only the specified default tab. | |
| void | ResetToDefaultTabs (const std::vector< EmberForge::TabType > &defaultTabTypes) |
| Reset the panel to multiple default tabs Closes all tabs and creates the specified default tabs. | |
| void | ClearAllTabs () |
| Clear all tabs from the panel Removes all tabs without creating any new ones. | |
| virtual void | ApplyPreferences () |
| Apply preferences to the side panel Virtual to allow derived classes to use their specific settings. | |
| virtual void | SaveState () |
| Save the current state (last active tab, etc.) Virtual to allow derived classes to use their specific settings. | |
| virtual void | RestoreState () |
| Restore state from preferences Virtual to allow derived classes to use their specific settings. | |
| void | SetTabBarButtonsEnabled (bool enabled) |
| Enable or disable the tab bar buttons (+ and menu) | |
| bool | AreTabBarButtonsEnabled () const |
| Check if tab bar buttons are enabled. | |
| void | ToggleTabBarButtons () |
| Toggle tab bar buttons visibility. | |
| void | SetPanelName (const wxString &name) |
| Set the panel name (for split panels) | |
| const EmberForge::PanelDescriptor & | GetPanelDescriptor () const |
| Get the panel descriptor for this panel. | |
| void | SetPanelDescriptor (const EmberForge::PanelDescriptor &descriptor) |
| Update the panel descriptor (used when creating split panels) | |
| Public Member Functions inherited from Panel | |
| Panel (wxWindow *parent, const wxString &name="Panel", long style=wxTAB_TRAVERSAL) | |
| Constructor. | |
| virtual | ~Panel () |
| Destructor. | |
| wxPanel * | GetPanel () override |
| Get the main panel widget. | |
| 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 ¶meter="") 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 Types | |
| enum | BaseEventIDs { ID_BASE_NOTEBOOK = wxID_HIGHEST + 1000 , ID_BASE_HIDE_PANEL_MENU_ITEM , ID_BASE_PREFERENCES_MENU_ITEM , ID_BASE_ADD_TAB_BUTTON , ID_BASE_MENU_BUTTON , ID_BASE_LAST } |
Protected Member Functions | |
| void | CreateLayout () override |
| Create the panel's UI layout Called during initialization. | |
| virtual void | CreateNotebook () |
| virtual void | SetupEventHandlers () |
| virtual void | OnPanelSpecificSetup () |
| virtual bool | GetRememberLastTab () const =0 |
| virtual const std::vector< std::string > & | GetLastOpenTabs () const =0 |
| virtual std::string | GetLastActiveTab () const =0 |
| virtual std::string | GetDefaultActiveTab () const =0 |
| void | RestoreAndEnsureTabs () |
| void | DoCreateLayout () |
| void | DoCreateNotebook () |
| void | DoSetupEventHandlers () |
| virtual void | OnAddTabButtonClicked (wxCommandEvent &event) |
| virtual std::vector< EmberForge::TabType > | GetSupportedTabTypes () const |
| void | OnTabChanged (wxAuiNotebookEvent &event) |
| void | OnTabClosed (wxAuiNotebookEvent &event) |
| void | OnAddTabButtonClickedInternal (wxCommandEvent &event) |
| virtual void | OnMenuButtonClicked (wxCommandEvent &event) |
| void | OnHidePanelClicked (wxCommandEvent &event) |
| void | OnPanelPreferencesClicked (wxCommandEvent &event) |
| void | OnTabBarAddButtonClicked (wxCommandEvent &event) |
| void | OnTabBarMenuButtonClicked (wxCommandEvent &event) |
| void | CreateAndAddTab (EmberForge::TabType tabType) |
| void | ShowTabCreationMenu () |
| Protected Member Functions inherited from Panel | |
| 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) |
Protected Attributes | |
| MainFrame * | m_mainFrame |
| EmberForge::CustomAuiNotebook * | m_notebook |
| std::vector< ITabPtr > | m_tabs |
| int | m_activeTabIndex |
| wxString | m_panelName |
| bool | m_tabBarButtonsEnabled |
| bool | m_isInitializing |
| EmberForge::PanelDescriptor | m_descriptor |
Private Member Functions | |
| wxDECLARE_EVENT_TABLE () | |
Base class for sidebar panels with shared tab management backend.
This class provides all the common functionality for both left and right sidebar panels, including tab management, notebook handling, and event processing. Derived classes can specialize behavior while sharing the same backend implementation.
Design Pattern: Template Method Pattern + Strategy Pattern
Definition at line 33 of file SidePanel.h.
|
protected |
| Enumerator | |
|---|---|
| ID_BASE_NOTEBOOK | |
| ID_BASE_HIDE_PANEL_MENU_ITEM | |
| ID_BASE_PREFERENCES_MENU_ITEM | |
| ID_BASE_ADD_TAB_BUTTON | |
| ID_BASE_MENU_BUTTON | |
| ID_BASE_LAST | |
Definition at line 245 of file SidePanel.h.
| SidePanel::SidePanel | ( | wxWindow * | parent, |
| MainFrame * | mainFrame = nullptr, | ||
| const wxString & | panelName = "Side Panel", | ||
| EmberForge::PanelType | panelType = EmberForge::PanelType::LeftPanel, | ||
| EmberForge::PanelDescriptor * | parentDescriptor = nullptr ) |
|
virtual |
Definition at line 42 of file SidePanel.cpp.
| int SidePanel::AddTab | ( | ITabPtr | tab | ) |
Add a tab to this panel.
| tab | The tab to add |
Definition at line 204 of file SidePanel.cpp.
|
virtual |
Apply preferences to the side panel Virtual to allow derived classes to use their specific settings.
Reimplemented in BottomPanel, LeftSidePanel, and RightSidePanel.
Definition at line 711 of file SidePanel.cpp.
|
inline |
Check if tab bar buttons are enabled.
Definition at line 157 of file SidePanel.h.
| void SidePanel::ClearAllTabs | ( | ) |
Clear all tabs from the panel Removes all tabs without creating any new ones.
Definition at line 380 of file SidePanel.cpp.
|
protected |
Definition at line 577 of file SidePanel.cpp.
|
overrideprotectedvirtual |
Create the panel's UI layout Called during initialization.
Override in derived classes.
Reimplemented from Panel.
Definition at line 57 of file SidePanel.cpp.
|
protectedvirtual |
Definition at line 98 of file SidePanel.cpp.
|
protected |
Definition at line 61 of file SidePanel.cpp.
|
protected |
Definition at line 102 of file SidePanel.cpp.
|
protected |
Definition at line 124 of file SidePanel.cpp.
| void SidePanel::FinishSetup | ( | ) |
Complete panel setup after construction.
This must be called after the derived class is fully constructed to ensure proper virtual dispatch for OnPanelSpecificSetup(). Creates default tabs and applies preferences.
Definition at line 83 of file SidePanel.cpp.
| ITab * SidePanel::GetActiveTab | ( | ) | const |
Get the currently active tab.
Definition at line 303 of file SidePanel.cpp.
|
protectedpure virtual |
Implemented in BottomPanel, LeftSidePanel, and RightSidePanel.
|
protectedpure virtual |
Implemented in BottomPanel, LeftSidePanel, and RightSidePanel.
|
protectedpure virtual |
Implemented in BottomPanel, LeftSidePanel, and RightSidePanel.
|
inline |
Get the notebook widget for direct access.
Definition at line 98 of file SidePanel.h.
|
inline |
Get the panel descriptor for this panel.
Definition at line 174 of file SidePanel.h.
|
overridepure virtual |
Get a unique identifier for this panel type.
Reimplemented from Panel.
Implemented in BottomPanel, LeftSidePanel, and RightSidePanel.
|
protectedpure virtual |
Implemented in BottomPanel, LeftSidePanel, and RightSidePanel.
|
inlineprotectedvirtual |
Reimplemented in BottomPanel, LeftSidePanel, and RightSidePanel.
Definition at line 212 of file SidePanel.h.
| ITab * SidePanel::GetTab | ( | int | index | ) | const |
Get a tab by index.
| index | Index of the tab |
Definition at line 283 of file SidePanel.cpp.
|
inline |
Get the number of tabs.
Definition at line 79 of file SidePanel.h.
|
overridepure virtual |
Get the display title for this panel.
Reimplemented from Panel.
Implemented in BottomPanel, LeftSidePanel, and RightSidePanel.
| bool SidePanel::HasTabWithName | ( | const wxString & | tabName | ) | const |
Check if this panel has a tab with the given name.
| tabName | The name to check for |
Definition at line 568 of file SidePanel.cpp.
|
inlineprotectedvirtual |
Reimplemented in BottomPanel, LeftSidePanel, and RightSidePanel.
Definition at line 211 of file SidePanel.h.
|
protected |
Definition at line 464 of file SidePanel.cpp.
|
protected |
Definition at line 514 of file SidePanel.cpp.
|
protectedvirtual |
Definition at line 492 of file SidePanel.cpp.
|
protected |
Definition at line 544 of file SidePanel.cpp.
|
protectedvirtual |
Reimplemented in BottomPanel, LeftSidePanel, and RightSidePanel.
Definition at line 130 of file SidePanel.cpp.
|
protected |
Definition at line 476 of file SidePanel.cpp.
|
protected |
Definition at line 484 of file SidePanel.cpp.
|
protected |
Definition at line 395 of file SidePanel.cpp.
|
protected |
Definition at line 420 of file SidePanel.cpp.
| ITabPtr SidePanel::RemoveTab | ( | int | index | ) |
Remove a tab by index.
| index | Index of the tab to remove |
Definition at line 246 of file SidePanel.cpp.
| void SidePanel::ResetToDefaultTab | ( | EmberForge::TabType | defaultTabType | ) |
Reset the panel to a single default tab Closes all tabs and creates only the specified default tab.
| defaultTabType | The tab type to use as the default |
Definition at line 310 of file SidePanel.cpp.
| void SidePanel::ResetToDefaultTabs | ( | const std::vector< EmberForge::TabType > & | defaultTabTypes | ) |
Reset the panel to multiple default tabs Closes all tabs and creates the specified default tabs.
| defaultTabTypes | The tab types to create as defaults |
Definition at line 352 of file SidePanel.cpp.
|
protected |
Definition at line 135 of file SidePanel.cpp.
|
virtual |
Restore state from preferences Virtual to allow derived classes to use their specific settings.
Reimplemented in BottomPanel, LeftSidePanel, and RightSidePanel.
Definition at line 725 of file SidePanel.cpp.
|
virtual |
Save the current state (last active tab, etc.) Virtual to allow derived classes to use their specific settings.
Reimplemented in BottomPanel, LeftSidePanel, and RightSidePanel.
Definition at line 718 of file SidePanel.cpp.
| bool SidePanel::SetActiveTab | ( | int | index | ) |
Set the active tab by index.
| index | Index of the tab to activate |
Definition at line 290 of file SidePanel.cpp.
|
inline |
Update the panel descriptor (used when creating split panels)
| descriptor | The new descriptor to use |
Definition at line 180 of file SidePanel.h.
|
inline |
Set the panel name (for split panels)
| name | The new panel name |
Definition at line 168 of file SidePanel.h.
| void SidePanel::SetTabBarButtonsEnabled | ( | bool | enabled | ) |
Enable or disable the tab bar buttons (+ and menu)
| enabled | True to enable, false to disable |
Definition at line 691 of file SidePanel.cpp.
|
protectedvirtual |
Definition at line 120 of file SidePanel.cpp.
|
protected |
Definition at line 624 of file SidePanel.cpp.
| void SidePanel::ToggleTabBarButtons | ( | ) |
Toggle tab bar buttons visibility.
Definition at line 705 of file SidePanel.cpp.
|
private |
|
protected |
Definition at line 238 of file SidePanel.h.
|
protected |
Definition at line 242 of file SidePanel.h.
|
protected |
Definition at line 241 of file SidePanel.h.
|
protected |
Definition at line 235 of file SidePanel.h.
|
protected |
Definition at line 236 of file SidePanel.h.
|
protected |
Definition at line 239 of file SidePanel.h.
|
protected |
Definition at line 240 of file SidePanel.h.
|
protected |
Definition at line 237 of file SidePanel.h.