Ember
Loading...
Searching...
No Matches
EmberForge::TabFactory Class Reference

Factory class for creating different types of tabs. More...

#include <TabFactory.h>

Static Public Member Functions

static std::unique_ptr< ITabCreateTab (TabType type, wxWindow *parent, MainFrame *mainFrame=nullptr)
 Create a tab of the specified type.
static wxString GetTabDisplayName (TabType type)
 Get the display name for a tab type.
static wxString GetTabTooltip (TabType type)
 Get the tooltip text for a tab type.
static bool AllowMultipleInstances (TabType type)
 Check if a tab type can be created multiple times within a single panel.
static int GetMaxGlobalInstances (TabType type)
 Get the maximum number of instances allowed globally across all panels.
static bool IsTabAllowedInPanel (TabType tabType, EmberForge::PanelType panelType)
 Check if a tab type is allowed in a specific panel type.
static std::vector< TabTypeGetAvailableTabTypes ()
 Get all available tab types.
static std::vector< TabTypeGetBottomPanelTabTypes ()
 Get tab types supported by the bottom panel.
static std::vector< TabTypeGetSidePanelTabTypes ()
 Get tab types supported by the side panels.
static std::string TabTypeToString (TabType type)
 Convert tab type to string identifier (for preferences storage)
static TabType StringToTabType (const std::string &str)
 Convert string identifier to tab type.

Private Member Functions

 TabFactory ()=default

Detailed Description

Factory class for creating different types of tabs.

This factory centralizes tab creation logic and makes it easy to:

  • Add new tab types
  • Configure tabs with different parameters
  • Maintain consistent tab creation patterns
  • Handle dependencies and initialization

Definition at line 28 of file TabFactory.h.

Constructor & Destructor Documentation

◆ TabFactory()

EmberForge::TabFactory::TabFactory ( )
privatedefault

Member Function Documentation

◆ AllowMultipleInstances()

bool EmberForge::TabFactory::AllowMultipleInstances ( TabType type)
static

Check if a tab type can be created multiple times within a single panel.

Parameters
typeThe tab type
Returns
bool True if multiple instances are allowed in the same panel

Definition at line 105 of file TabFactory.cpp.

◆ CreateTab()

std::unique_ptr< ITab > EmberForge::TabFactory::CreateTab ( TabType type,
wxWindow * parent,
MainFrame * mainFrame = nullptr )
static

Create a tab of the specified type.

Parameters
typeThe type of tab to create
parentThe parent window for the tab
mainFramePointer to the main frame (for tabs that need it)
Returns
std::unique_ptr<ITab> The created tab, or nullptr if creation failed

Definition at line 12 of file TabFactory.cpp.

◆ GetAvailableTabTypes()

std::vector< TabType > EmberForge::TabFactory::GetAvailableTabTypes ( )
static

Get all available tab types.

Returns
std::vector<TabType> Vector of all available tab types

Definition at line 171 of file TabFactory.cpp.

◆ GetBottomPanelTabTypes()

std::vector< TabType > EmberForge::TabFactory::GetBottomPanelTabTypes ( )
static

Get tab types supported by the bottom panel.

Returns
std::vector<TabType> Vector of tab types for the bottom panel

Definition at line 175 of file TabFactory.cpp.

◆ GetMaxGlobalInstances()

int EmberForge::TabFactory::GetMaxGlobalInstances ( TabType type)
static

Get the maximum number of instances allowed globally across all panels.

Parameters
typeThe tab type
Returns
int Maximum instances allowed (0 = unlimited, 1 = single instance, etc.)

Examples:

  • Return 1 for tabs that should only exist once in the entire application
  • Return 2 to allow the tab in two panels simultaneously
  • Return 0 for unlimited instances

Definition at line 122 of file TabFactory.cpp.

◆ GetSidePanelTabTypes()

std::vector< TabType > EmberForge::TabFactory::GetSidePanelTabTypes ( )
static

Get tab types supported by the side panels.

Returns
std::vector<TabType> Vector of tab types for the side panels

Definition at line 179 of file TabFactory.cpp.

◆ GetTabDisplayName()

wxString EmberForge::TabFactory::GetTabDisplayName ( TabType type)
static

Get the display name for a tab type.

Parameters
typeThe tab type
Returns
wxString The human-readable name of the tab

Definition at line 71 of file TabFactory.cpp.

◆ GetTabTooltip()

wxString EmberForge::TabFactory::GetTabTooltip ( TabType type)
static

Get the tooltip text for a tab type.

Parameters
typeThe tab type
Returns
wxString The tooltip description for the tab

Definition at line 88 of file TabFactory.cpp.

◆ IsTabAllowedInPanel()

bool EmberForge::TabFactory::IsTabAllowedInPanel ( TabType tabType,
EmberForge::PanelType panelType )
static

Check if a tab type is allowed in a specific panel type.

Parameters
tabTypeThe tab type to check
panelTypeThe panel type to check against
Returns
bool True if the tab can be added to the specified panel type

This provides fine-grained control over which tabs can appear in which panels.

Definition at line 143 of file TabFactory.cpp.

◆ StringToTabType()

TabType EmberForge::TabFactory::StringToTabType ( const std::string & str)
static

Convert string identifier to tab type.

Parameters
strThe string identifier
Returns
TabType The tab type (defaults to FileExplorer if unknown)

Definition at line 198 of file TabFactory.cpp.

◆ TabTypeToString()

std::string EmberForge::TabFactory::TabTypeToString ( TabType type)
static

Convert tab type to string identifier (for preferences storage)

Parameters
typeThe tab type
Returns
std::string The string identifier

Definition at line 181 of file TabFactory.cpp.


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