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

Go to the SVN repository for this file.

1 #ifndef GUI_FRAMEWORK___VIEW_MANAGER__HPP
2 #define GUI_FRAMEWORK___VIEW_MANAGER__HPP
3 
4 /* $Id: view_manager_service.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  * IViewManagerService interface declaration.
33  */
34 
35 /** @addtogroup GUI_FRAMEWORK
36 *
37 * @{
38 */
39 
40 #include <corelib/ncbiobj.hpp>
41 
42 #include <gui/gui_export.h>
43 
44 #include <gui/framework/view.hpp>
45 
47 
48 #include <gui/utils/mru_list.hpp>
49 
50 
52 
53 class IWorkbench;
54 
55 ///////////////////////////////////////////////////////////////////////////////
56 /// IViewManagerService uses the following extension point to obtain
57 /// registered view factories (instances of IViewFactory)
58 
59 #define EXT_POINT__VIEW_MANAGER_SERVICE__VIEW_FACTORY "view_manager_service::view_factory"
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// IViewManagerService
63 /// IViewManagerService manages views in Workbench.
64 
66 {
67 public:
68  typedef vector< CIRef<IView> > TViews;
70  typedef vector< CIRef<IViewFactory> > TFactories;
71  typedef vector<const CViewTypeDescriptor*> TDescrVec;
72 
73 public:
74  /// assumes ownership of the factory
75  virtual void RegisterFactory(IViewFactory& factory) = 0;
76 
77  virtual void GetTypeDescriptors(TDescrVec& descrs) = 0;
78  virtual void GetFactories(TFactories& factories) = 0;
79 
80  /// create a view instance of the specified type
81  virtual CIRef<IView> CreateViewInstance(const string& type_ui_name) = 0;
82 
83  /// create a view instance of the specified type
84  virtual CIRef<IView>
86 
87  virtual bool CanCreateView(const string& type_ui_name) = 0;
88 
89  /// adds view to Workbench and connects to the services
90  /// the view must be already initialized
91  virtual void AddToWorkbench(IView& view, bool bFloat = false) = 0;
92 
93  /// disconnects view from services and removes from the Workbench
94  virtual void RemoveFromWorkbench(IView& view) = 0;
95 
96  /// disconnects and removes all view from Workbench
97  virtual void RemoveAllViewsFromWorkbench() = 0;
98 
99  virtual bool HasView(const IView& view) const = 0;
100 
101  /// get all registered views
102  virtual void GetViews(TViews& views) = 0;
103 
104  /// returns a pointer singleton view if it already exists in workbench or NULL
105  virtual CIRef<IView> GetSingletonView(const string& singleton_ui_name) = 0;
106 
107  /// activates the specified view, create a new view if it does not exist
108  virtual CIRef<IView> ShowSingletonView(const string& singleton_ui_name) = 0;
109 
110  virtual ~IViewManagerService() {};
111 };
112 
113 
115 
116 /* @} */
117 
118 #endif // GUI_FRAMEWORK___VIEW_MANAGER__HPP
119 
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
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
Definition: wm_client.hpp:58
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
virtual bool CanCreateView(const string &type_ui_name)=0
virtual void RegisterFactory(IViewFactory &factory)=0
assumes ownership of the factory
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
virtual void GetFactories(TFactories &factories)=0
virtual void RemoveAllViewsFromWorkbench()=0
disconnects and removes all view from Workbench
CMRUList< string > TMRUViews
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
Defines to provide correct exporting from DLLs in Windows.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Fri Feb 23 11:50:21 2024 by modify_doxy.py rev. 669887