NCBI C++ ToolKit
view_manager_service_impl.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_FRAMEWORK___VIEW_MANAGER_IMPL__HPP
2 #define GUI_FRAMEWORK___VIEW_MANAGER_IMPL__HPP
3 
4 /* $Id: view_manager_service_impl.hpp 32743 2015-04-20 16:11:13Z katargir $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 /** @addtogroup GUI_FRAMEWORK
36 *
37 * @{
38 */
39 
40 #include <corelib/ncbistd.hpp>
41 
44 
47 
49 
50 #include <set>
51 
52 
54 
55 ///////////////////////////////////////////////////////////////////////////////
56 /// CViewManagerService - the standard implementation of IViewManagerService
57 /// interface.
58 ///
59 /// This class implements IWMClientFactory so that it can be used with
60 /// Window Manager to instantiate view for loaded window layouts.
61 
63  public CObject,
64  public IViewManagerService,
65  public IService,
66  public IWMClientFactory,
67  public IRegSettings
68 {
69 public:
71  virtual ~CViewManagerService();
72 
73  /// connect / disconnect to / from Workbench
74  virtual void SetWorkbench(IWorkbench* workbench);
75 
76  /// @name IService interface implementation
77  /// @{
78  virtual void InitService();
79  virtual void ShutDownService();
80  /// @}
81 
82  /// @name IViewManagerService implementation
83  /// @{
84  virtual void RegisterFactory(IViewFactory& factory);
85 
86  virtual void GetTypeDescriptors(TDescrVec& descrs);
87  virtual void GetFactories(TFactories& factories);
88 
89  virtual CIRef<IView> CreateViewInstance(const string& type_ui_name);
90  virtual CIRef<IView>
92 
93  virtual bool CanCreateView(const string& type_ui_name);
94 
95  virtual void AddToWorkbench(IView& view, bool bFloat);
96  virtual void RemoveFromWorkbench(IView& view);
97  virtual void RemoveAllViewsFromWorkbench();
98 
99  virtual bool HasView(const IView& view) const;
100  virtual void GetViews(TViews& views);
101 
102  virtual CIRef<IView> GetSingletonView(const string& singleton_ui_name);
103 
104  virtual CIRef<IView> ShowSingletonView(const string& singleton_ui_name);
105  /// @}
106 
107  /// @name IWMClientFactory interface implementation
108  /// @{
109  virtual IWMClient* CreateClient(const TFingerprint& fingerprint, wxWindow* parent);
110  /// @}
111 
112  /// @name IRegSettings interface implementation
113  /// @{
114  virtual void SetRegistryPath(const string& path);
115  virtual void LoadSettings();
116  virtual void SaveSettings() const;
117  /// @}
118 
119 protected:
120  void x_RegisterExtensionFactories();
121  string x_GetViewRegistryPath(IView& view);
122 
123  void x_DoAddToWorkbench(IView& view, wxWindow* parent);
124  void x_DoRemoveViewFromWorkbench(IView& view);
125 
126  void x_LoadViewSettings(IView& view);
127  void x_SaveViewSettings(IView& view);
128 
129 protected:
132 
134 
136  TViews m_Views; // a list of all registered views
137  TSingletonMap m_SingletonMap; // map of existing Singleton Views
138 
139  string m_RegPath;
140 };
141 
142 
144 
145 /* @} */
146 
147 #endif // GUI_FRAMEWORK___VIEW_MANAGER_IMPL__HPP
148 
CObject –.
Definition: ncbiobj.hpp:180
CViewManagerService - the standard implementation of IViewManagerService interface.
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
IService an abstraction that represents an application component providing specific functional capa...
Definition: service.hpp:56
IViewFactory - view factory for use with IViewManagerService.
Definition: view.hpp:140
IViewManagerService IViewManagerService manages views in Workbench.
IView - represents a standard visual part of Workbench UI.
Definition: view.hpp:73
IWMClientFactory - IWMClient factory.
Definition: wm_client.hpp:133
virtual IWMClient * CreateClient(const TFingerprint &fingerprint, wxWindow *parent)=0
creates a client by fingerprint returns NULL if fingerprint is not recognized.
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
Definition: wm_client.hpp:58
IWClient - abstract Window Manager client.
Definition: wm_client.hpp:50
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
virtual bool CanCreateView(const string &type_ui_name)=0
virtual void RegisterFactory(IViewFactory &factory)=0
assumes ownership of the factory
map< string, CIRef< IView > > TSingletonMap
virtual CIRef< IView > ShowSingletonView(const string &singleton_ui_name)=0
activates the specified view, create a new view if it does not exist
virtual bool HasView(const IView &view) const =0
virtual void AddToWorkbench(IView &view, bool bFloat=false)=0
adds view to Workbench and connects to the services the view must be already initialized
vector< CIRef< IView > > TViews
virtual void GetViews(TViews &views)=0
get all registered views
virtual void RemoveFromWorkbench(IView &view)=0
disconnects view from services and removes from the Workbench
vector< const CViewTypeDescriptor * > TDescrVec
virtual CIRef< IView > CreateViewInstance(const string &type_ui_name)=0
create a view instance of the specified type
vector< CIRef< IViewFactory > > TFactories
virtual CIRef< IView > CreateViewInstanceByFingerprint(const IWMClient::CFingerprint &fingerprint)=0
create a view instance of the specified type
TViewNameToFactory m_ViewNameToFactory
virtual void GetFactories(TFactories &factories)=0
virtual void InitService()=0
virtual void RemoveAllViewsFromWorkbench()=0
disconnects and removes all view from Workbench
map< string, CIRef< IViewFactory > > TViewNameToFactory
virtual void ShutDownService()=0
virtual void GetTypeDescriptors(TDescrVec &descrs)=0
virtual CIRef< IView > GetSingletonView(const string &singleton_ui_name)=0
returns a pointer singleton view if it already exists in workbench or NULL
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIFRAMEWORK_EXPORT
Definition: gui_export.h:509
Modified on Sat Feb 24 07:47:34 2024 by modify_doxy.py rev. 669887