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

Go to the SVN repository for this file.

1 #ifndef GUI_CORE___PROJECT_VIEW__HPP
2 #define GUI_CORE___PROJECT_VIEW__HPP
3 
4 /* $Id: project_view.hpp 47479 2023-05-02 13:24:02Z ucko $
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: Mike DiCuccio, Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 
37 #include <gui/gui_export.h>
38 
39 #include <gui/framework/view.hpp>
40 
42 
44 
45 #include <gui/objutils/objects.hpp>
46 
48 
49 #include <memory>
50 
51 
53 
54 class IServiceLocator;
55 class ISelectionService;
56 class CProjectViewEvent;
57 class IGBDocument;
58 
60  class CPluginMessage;
61  class CDataHandle;
62  class CUser_object;
63  class CGBProjectHandle;
65 
66 
67 ///////////////////////////////////////////////////////////////////////////////
68 /// class IProjectView defines the abstract interface for views observing projects.
69 
71  : public IView
72  , public IWMClient
73  , public ISelectionClient
74 {
75 public:
76  using TProjectId = objects::CGBProjectHandle::TId;
77  typedef size_t TId;
78 
79  /// Retrieve a label for this view. The label has several different
80  enum ELabelType {
81  eType, //< usually a description of the class
82  eContent, //< The content (what the view is looking at)
84  eId, //< an identifier for the view, usually given as a base-26 letter
86  eDefault = eTypeAndContent
87  };
88 
89 public:
90  /// initialize view with data, inside this function the view
91  /// must call CProjectService::AttachView to connect to a project
92  virtual bool InitView(TConstScopedObjects& objects, const objects::CUser_object* params) = 0;
93 
94  /// disconnects view from the project and associated data
95  virtual void DestroyView() = 0;
96 
97  /// called when view creation is completed and view size is known
98  virtual void InitialLayout() = 0;
99  virtual void Destroy() = 0;
100  /// Set async destruction mode
101  virtual void SetAsyncDestroy(bool reset_hist_async) = 0;
102 
103  /// retrieve a unique ID for this view
104  virtual TId GetId() const = 0;
105 
106  virtual TProjectId GetProjectId() const = 0;
107 
108  /// returns name of the plug-in created this view (view class name)
109  virtual string GetLabel( ELabelType type ) const = 0;
110  virtual void SetOrigObject(SConstScopedObject& obj) {}
111 
112  virtual IServiceLocator* GetServiceLocator() const = 0;
113  virtual CRef<objects::CScope> GetScope() const = 0;
114 
115  /// @name Event Handling
116  /// @{
117  virtual void OnSelectionChanged( const TConstScopedObjects& sels ) = 0;
118  virtual void OnProjectChanged( CProjectViewEvent& evt ) = 0;
119  virtual void OnViewReleased( IView& view ) = 0;
120  virtual void OnPrint() = 0;
121  /// @}
122 
123  virtual ~IProjectView() {}
124 };
125 
127 {
128 public:
130  virtual void SaveSettingsAtProject(objects::CGBProjectHandle& project) const = 0;
131 };
132 
134 {
135 public:
136  virtual ~IProjectViewLabel() {}
137  virtual bool GetLabel(string& label, const IProjectView& view, IProjectView::ELabelType type) = 0;
138 };
139 
141 
142 #endif /// GUI_CORE___PROJECT_VIEW__HPP
User-defined methods of the data storage class.
CProjectViewEvent.
Definition: document.hpp:62
virtual bool GetLabel(string &label, const IProjectView &view, IProjectView::ELabelType type)=0
virtual ~IProjectViewLabel()
class IProjectView defines the abstract interface for views observing projects.
ELabelType
Retrieve a label for this view. The label has several different.
objects::CGBProjectHandle::TId TProjectId
virtual void OnProjectChanged(CProjectViewEvent &evt)=0
virtual CRef< objects::CScope > GetScope() const =0
virtual bool InitView(TConstScopedObjects &objects, const objects::CUser_object *params)=0
initialize view with data, inside this function the view must call CProjectService::AttachView to con...
virtual void OnPrint()=0
virtual TProjectId GetProjectId() const =0
virtual void OnSelectionChanged(const TConstScopedObjects &sels)=0
virtual void OnViewReleased(IView &view)=0
virtual void Destroy()=0
virtual TId GetId() const =0
retrieve a unique ID for this view
virtual void SetOrigObject(SConstScopedObject &obj)
virtual void InitialLayout()=0
called when view creation is completed and view size is known
virtual void SetAsyncDestroy(bool reset_hist_async)=0
Set async destruction mode.
virtual void DestroyView()=0
disconnects view from the project and associated data
virtual string GetLabel(ELabelType type) const =0
returns name of the plug-in created this view (view class name)
virtual IServiceLocator * GetServiceLocator() const =0
virtual ~IProjectView()
ISelectionClient - represents an object that support a notion of selection.
ISelectionService - an interface.
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
virtual void SaveSettingsAtProject(objects::CGBProjectHandle &project) const =0
virtual ~IViewSettingsAtProject()
IView - represents a standard visual part of Workbench UI.
Definition: view.hpp:73
IWClient - abstract Window Manager client.
Definition: wm_client.hpp:50
Include a standard set of the NCBI C++ Toolkit most basic headers.
@ eDefault
Definition: ncbi_types.h:112
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static const char label[]
Defines to provide correct exporting from DLLs in Windows.
Definition: type.c:6
Modified on Mon May 27 04:34:46 2024 by modify_doxy.py rev. 669887