33 #include <wx/platform.h>
50 "View Manager Service - view factories");
72 LOG_POST(
Info <<
"Initializing View Manager Service...");
76 LOG_POST(
Info <<
"Finished initializing View Manager Service");
82 LOG_POST(
Info <<
"Shutting down View Manager Service...");
86 LOG_POST(
Error <<
"Some views are still open! Closing them forecefully");
92 vector<IWMClient*> clients;
97 for(
size_t i = 0;
i < clients.size();
i++) {
108 LOG_POST(
Info <<
"Finished shutting down View Manager Service");
117 const string& ui_name = descr.
GetLabel();
131 vector<CUICommand*> cmds = cmd_ctrb->
GetCommands();
139 LOG_POST(
Info <<
"CViewManagerService - added a view factory for " << ui_name);
141 LOG_POST(
Error <<
"CViewManagerService::RegisterFactory() - a factory for view type "
142 << ui_name <<
" is already registered.");
152 descrs.push_back(&descr);
161 factories.push_back(factory);
175 LOG_POST(
Error <<
"CViewManagerService::CreateViewInstance() - cannot create " <<
176 type_ui_name <<
", factory is not registred for this type");
214 Error <<
"CViewManagerService::AddToWorkbench() - view "
215 << descr.
GetLabel() <<
" does not implement IWMClient"
222 TViews::iterator it = std::find(
m_Views.begin(),
m_Views.end(), &view);
225 const char*
msg =
"View Manager Service - view already registered!";
233 const string& ui_name = descr.
GetLabel();
236 Error <<
"CViewManagerService::AddToWorkbench() - singleton view"
237 << ui_name <<
" already exists."
262 parent->SendSizeEvent();
274 TViews::iterator it = std::find(
m_Views.begin(),
m_Views.end(), &view);
310 for( TViews::reverse_iterator it = views.rbegin(); it != views.rend(); it++) {
319 TViews::const_iterator it = std::find(
m_Views.begin(),
m_Views.end(), &view);
349 const string& ui_name = descr.
GetLabel();
371 const string& ui_name = descr.
GetLabel();
378 TViews::iterator it = std::find(
m_Views.begin(),
m_Views.end(), &view);
410 LOG_POST(
Error <<
"CViewManagerService::ExistsInWorkbench() view "
411 << singleton_ui_name <<
" is not registered");
424 LOG_POST(
Error <<
"CViewManagerService::ExistsInWorkbench() view "
425 << singleton_ui_name <<
" is not a singleton.");
491 vector< CIRef<IViewFactory> > factories;
494 for(
size_t i = 0;
i < factories.size();
i++ ) {
514 string reg_path =
m_RegPath +
".Views." + view_key;
523 const string& icon_alias,
525 const string& description,
526 const string& help_id,
527 const string& category,
530 , m_Category( category )
531 , m_Singleton( singleton )
CExtensionPointDeclaration - static declaration helper.
CUICommandRegistry is a centralized registry where all application commands should be registered.
int RegisterCommand(CUICommand *cmd)
assumes ownership of the given object returns a command id (useful when registry is used for auto id ...
void ApplyAccelerators(wxWindow *frame)
apply accumulated accelerators to the specifed frame
CUIObject - default mix-in implementation of IUIObject.
CViewTypeDescriptor - holds description of a view type.
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
virtual void SaveSettings() const =0
virtual void LoadSettings()=0
virtual void SetRegistryPath(const string &path)=0
IUICommandContributor - contributes commands to the common command space.
virtual vector< CUICommand * > GetCommands()=0
returns a vector of commands (takes ownership over CUICommand pointers)
IViewFactory - view factory for use with IViewManagerService.
IView - represents a standard visual part of Workbench UI.
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
IWClient - abstract Window Manager client.
IWindowManagerService Window Manager Service provides access to Window Manager functionality.
IWorkbench is the central interface in the application framework.
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Info(CExceptionArgs_Base &args)
virtual wxFrame * GetMainWindow()=0
returns a pointer to the main application frame window
virtual void GetFactories(TFactories &factories)
virtual void AddClient(IWMClient &client, bool bFloat)=0
places the given IWMClient in the Main Tabbed Pane in Window Manager
virtual ~CViewTypeDescriptor()
virtual void ShutDownService()
virtual CIRef< IView > ShowSingletonView(const string &singleton_ui_name)
activates the specified view, create a new view if it does not exist
void x_SaveViewSettings(IView &view)
virtual CUICommandRegistry & GetUICommandRegistry()=0
returns an instance of Command Registry associated with the Workbench
virtual IView * CreateInstanceByFingerprint(const TFingerprint &fingerprint) const =0
if fingerprint is recognized - creates and returns a new instance
TSingletonMap m_SingletonMap
virtual ~CViewManagerService()
virtual const CViewTypeDescriptor & GetViewTypeDescriptor() const =0
returns a Descriptor for the View Type supported by the Factory
virtual void AddToWorkbench(IView &view, bool bFloat)
adds view to Workbench and connects to the services the view must be already initialized
vector< CIRef< IView > > TViews
virtual bool IsSingleton() const
true if only one instance of this type can be created
virtual void SetRegistryPath(const string &path)
virtual wxFileArtProvider & GetFileArtProvider()=0
virtual void RemoveAllViewsFromWorkbench()
disconnects and removes all view from Workbench
virtual CIRef< IView > CreateViewInstanceByFingerprint(const TFingerprint &fingerprint)
create a view instance of the specified type
vector< const CViewTypeDescriptor * > TDescrVec
virtual void SetWorkbench(IWorkbench *workbench)=0
connect / disconnect this view with / from Workbench
void x_DoRemoveViewFromWorkbench(IView &view)
vector< CIRef< IViewFactory > > TFactories
CViewTypeDescriptor(const string &label, const string &icon_alias, const string &hint, const string &description, const string &help_id, const string &category, bool singleton)
CViewTypeDescriptor.
virtual void DestroyViewWindow()=0
destroy Window corresponding to the view
virtual string GetCategory() const
get view category (used for view grouping in UI)
void x_DoAddToWorkbench(IView &view, wxWindow *parent)
TViewNameToFactory m_ViewNameToFactory
virtual void InitService()
virtual IWindowManagerService * GetWindowManagerService()=0
virtual void SetWorkbench(IWorkbench *workbench)
connect / disconnect to / from Workbench
virtual void RemoveFromWorkbench(IView &view)
disconnects view from services and removes from the Workbench
virtual void GetAllClients(TClients &clients)=0
returns a list of all registered IWMClients
virtual void CloseClient(IWMClient &client)=0
remove client(s) from Window Manager these functions do not disconnect clients from other services
virtual void RegisterFactory(IViewFactory &factory)
assumes ownership of the factory
void x_LoadViewSettings(IView &view)
void x_RegisterExtensionFactories()
virtual IView * CreateInstance() const =0
creates a view instance
virtual void CreateViewWindow(wxWindow *parent)=0
create Window corresponding to the view
virtual bool HasView(const IView &view) const
virtual CIRef< IView > CreateViewInstance(const string &type_ui_name)
create a view instance of the specified type
virtual void RegisterCommands(CUICommandRegistry &, wxFileArtProvider &)
called by the framework to give Factory a chance to register commands used by view
virtual void ActivateClient(IWMClient &client)=0
makes client visible and focused
virtual void LoadSettings()
virtual const CViewTypeDescriptor & GetTypeDescriptor() const =0
return an object providing meta information about thei view type
virtual void GetTypeDescriptors(TDescrVec &descrs)
virtual bool CanCreateView(const string &type_ui_name)
virtual IWMClient * CreateClient(const TFingerprint &fingerprint, wxWindow *parent)
creates a client by fingerprint returns NULL if fingerprint is not recognized.
virtual void RegisterIconAliases(wxFileArtProvider &provider)=0
called by the framework to give Factory a chance to register images used by view
virtual void GetViews(TViews &views)
get all registered views
virtual CIRef< IView > GetSingletonView(const string &singleton_ui_name)
returns a pointer singleton view if it already exists in workbench or NULL
virtual void SetSingleton(bool singleton)
virtual void SaveSettings() const
string x_GetViewRegistryPath(IView &view)
virtual void SetCategory(const string &category)
void GetExtensionAsInterface(const string &ext_point_id, vector< CIRef< I > > &interfaces)
GetExtensionAsInterface() is a helper function that extracts all extensions implementing the specifie...
virtual const string & GetLabel() const
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static CNamedPipeClient * client
static CExtensionPointDeclaration decl("view_manager_service::view_factory", "View Manager Service - view factories")