CResourceManager Class Reference
[Simple Extensions and Wrappers Wround FLTK]

Search Toolkit Book for CResourceManager

#include <resource_manager.hpp>

Inheritance diagram for CResourceManager:

Inheritance graph
[legend]
Collaboration diagram for CResourceManager:

Collaboration graph
[legend]
List of all members.

Detailed Description

CResourceManager.

Provides access to application-specific resources such images and icons. Resources are stored as files in repository which is a directory in file system. Resources are identified by local paths inside repository or aliases. Aliases are symbolic names of resources making programming GUI independent from the actual filenames.

Definition at line 146 of file resource_manager.hpp.

Public Types

typedef CFLTKImageHandle::TImage TImage

Public Member Functions

 CResourceManager (const string &dir_list)
 Specifies ";" - separated list of directorries where resources are located.
void RegisterAlias (const string &alias, const string &local_path)
 register symbolic name (alias) for a resource identified by "local_path"
CFLTKImageHandle GetImage (const string &alias)

Static Public Member Functions

static CRef< CResourceManagerGetInstance ()
 returns the defaul application Resource Manager.
static void CreateInstance (const string &dir_list)
 explicitly creates the singleton with the dir_list.

Protected Types

typedef list< string > TDirList
typedef map< string, string > TAliasToPathMap
typedef map< string, CFLTKImageHandleTAliasToImageMap

Protected Attributes

TDirList m_DirList
TAliasToPathMap m_AliasToPath
TAliasToImageMap m_AliasToImage

Static Protected Attributes

static CRef< CResourceManagersm_Instance
 CResourceManager.


Member Typedef Documentation

typedef map<string, CFLTKImageHandle> CResourceManager::TAliasToImageMap [protected]
 

Definition at line 176 of file resource_manager.hpp.

typedef map<string, string> CResourceManager::TAliasToPathMap [protected]
 

Definition at line 175 of file resource_manager.hpp.

typedef list<string> CResourceManager::TDirList [protected]
 

Definition at line 174 of file resource_manager.hpp.

typedef CFLTKImageHandle::TImage CResourceManager::TImage
 

Definition at line 149 of file resource_manager.hpp.


Constructor & Destructor Documentation

CResourceManager::CResourceManager const string &  dir_list  ) 
 

Specifies ";" - separated list of directorries where resources are located.

When CResourceManager is loading a resource it concatenates local path corresponding to a resource with directories from this list and tries to resolve the resultant path. If path exists - resource is loaded using this path

Definition at line 136 of file resource_manager.cpp.

References ITERATE, kListDelim, m_DirList, CSystemPath::ResolvePath(), NStr::Split(), and NStr::TruncateSpaces().

Referenced by CreateInstance().


Member Function Documentation

void CResourceManager::CreateInstance const string &  dir_list  )  [static]
 

explicitly creates the singleton with the dir_list.

This function is supposed to be called during application initialization.

Definition at line 127 of file resource_manager.cpp.

References CResourceManager(), CRef< C, Locker >::Reset(), and sm_Instance.

Referenced by GetInstance(), CSnpDemoApp::Init(), CGBenchApp::Run(), SUBMENU(), and CWGLDemoApp::x_Create().

CFLTKImageHandle CResourceManager::GetImage const string &  alias  ) 
 

Definition at line 162 of file resource_manager.cpp.

References map_checker< Container >::end(), error(), map_checker< Container >::find(), m_AliasToImage, and m_AliasToPath.

Referenced by CMenu::x_SetItems().

CRef< CResourceManager > CResourceManager::GetInstance  )  [static]
 

returns the defaul application Resource Manager.

This manager should be used in most cases, however its lifetime is bound to the lifetime of the application so any images loaded into this instance will remain in memeory untill appplication exits.

Definition at line 117 of file resource_manager.cpp.

References CreateInstance(), LOG_POST, and sm_Instance.

Referenced by CGroupMapWidget::AddItem(), CAlnMultiView::CAlnMultiView(), CHitMatrixView::CHitMatrixView(), CHomePageService::CHomePageService(), CMapItem::CMapItem(), CPluginArgColumnHandler::CPluginArgColumnHandler(), CStandardColumnHandler::CStandardColumnHandler(), CViewCrossAlign::CViewCrossAlign(), CViewFeatTable::CViewFeatTable(), CViewFlatfile::CViewFlatfile(), CGBenchGUI::GetResourceManager(), CSnpDemoApp::Init(), CProjectTree::Init(), ON_MESSAGE(), CSystemView::SetIcon(), CButton::SetImage(), SUBMENU(), CWGLDemoApp::x_Create(), CHomePageView::x_CreateItems(), CWinManagerApp::x_CreateWindowManager(), CGroupMapWidget::x_Init(), CSelectionView::x_Init(), and CDataMiningView::x_Init().

void CResourceManager::RegisterAlias const string &  alias,
const string &  local_path
 

register symbolic name (alias) for a resource identified by "local_path"

Definition at line 155 of file resource_manager.cpp.

References m_AliasToPath.

Referenced by CGBenchWorkspaceWindow::x_RegisterIcons().


Member Data Documentation

TAliasToImageMap CResourceManager::m_AliasToImage [protected]
 

Definition at line 180 of file resource_manager.hpp.

Referenced by GetImage().

TAliasToPathMap CResourceManager::m_AliasToPath [protected]
 

Definition at line 179 of file resource_manager.hpp.

Referenced by GetImage(), and RegisterAlias().

TDirList CResourceManager::m_DirList [protected]
 

Definition at line 178 of file resource_manager.hpp.

Referenced by CResourceManager().

CRef< CResourceManager > CResourceManager::sm_Instance [static, protected]
 

CResourceManager.

Definition at line 182 of file resource_manager.hpp.

Referenced by CreateInstance(), and GetInstance().


The documentation for this class was generated from the following files:
Generated on Mon Nov 9 13:40:36 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Nov 09 15:48:06 2009 by modify_doxy.py rev. 173732